]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gold/testsuite/object_unittest.cc
Added a testsuite. More support for COPY relocations.
[thirdparty/binutils-gdb.git] / gold / testsuite / object_unittest.cc
CommitLineData
5a6f7e2d
ILT
1// object_unittest.cc -- test Object, Relobj, etc.
2
3#include "gold.h"
4
5#include "object.h"
6
7#include "test.h"
8#include "testfile.h"
9
10namespace gold_testsuite
11{
12
13using namespace gold;
14
15// Test basic Object functionality.
16
17bool
18Object_test(Test_report*)
19{
20 Input_file input_file("test.o", test_file_1, test_file_1_size);
21 Object* object = make_elf_object("test.o", &input_file, 0,
22 test_file_1, test_file_1_size);
23 CHECK(object->name() == "test.o");
24 CHECK(!object->is_dynamic());
25 CHECK(object->target() == target_test_pointer);
26 CHECK(object->is_locked());
27 object->unlock();
28 CHECK(!object->is_locked());
29 object->lock();
30 CHECK(object->shnum() == 5);
31 CHECK(object->section_name(0).empty());
32 CHECK(object->section_name(1) == ".test");
33 CHECK(object->section_flags(0) == 0);
34 CHECK(object->section_flags(1) == elfcpp::SHF_ALLOC);
35 object->unlock();
36 return true;
37}
38
39Register_test object_register("Object", Object_test);
40
41} // End namespace gold_testsuite.