Commit | Line | Data |
---|---|---|
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 | ||
10 | namespace gold_testsuite | |
11 | { | |
12 | ||
13 | using namespace gold; | |
14 | ||
15 | // Test basic Object functionality. | |
16 | ||
17 | bool | |
18 | Object_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 | ||
39 | Register_test object_register("Object", Object_test); | |
40 | ||
41 | } // End namespace gold_testsuite. |