aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite/object_unittest.cc
blob: c15237d822bd0923cc33da9f7faedc8969f0f4ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// object_unittest.cc -- test Object, Relobj, etc.

#include "gold.h"

#include "object.h"

#include "test.h"
#include "testfile.h"

namespace gold_testsuite
{

using namespace gold;

// Test basic Object functionality.

bool
Object_test(Test_report*)
{
  Input_file input_file("test.o", test_file_1, test_file_1_size);
  Object* object = make_elf_object("test.o", &input_file, 0,
				   test_file_1, test_file_1_size);
  CHECK(object->name() == "test.o");
  CHECK(!object->is_dynamic());
  CHECK(object->target() == target_test_pointer);
  CHECK(object->is_locked());
  object->unlock();
  CHECK(!object->is_locked());
  object->lock();
  CHECK(object->shnum() == 5);
  CHECK(object->section_name(0).empty());
  CHECK(object->section_name(1) == ".test");
  CHECK(object->section_flags(0) == 0);
  CHECK(object->section_flags(1) == elfcpp::SHF_ALLOC);
  object->unlock();
  return true;
}

Register_test object_register("Object", Object_test);

} // End namespace gold_testsuite.