aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite/object_unittest.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2006-11-30 23:52:50 +0000
committerIan Lance Taylor <iant@google.com>2006-11-30 23:52:50 +0000
commit5a6f7e2db556f93765b75baf2d1ee1509225410d (patch)
tree6db53a1cd843958dc18135430dbf37bd7b92b17e /gold/testsuite/object_unittest.cc
parent2621033b5dbe773f00cb90d24604b70a1cead2f1 (diff)
downloadgdb-5a6f7e2db556f93765b75baf2d1ee1509225410d.zip
gdb-5a6f7e2db556f93765b75baf2d1ee1509225410d.tar.gz
gdb-5a6f7e2db556f93765b75baf2d1ee1509225410d.tar.bz2
Added a testsuite. More support for COPY relocations.
Diffstat (limited to 'gold/testsuite/object_unittest.cc')
-rw-r--r--gold/testsuite/object_unittest.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/gold/testsuite/object_unittest.cc b/gold/testsuite/object_unittest.cc
new file mode 100644
index 0000000..c15237d
--- /dev/null
+++ b/gold/testsuite/object_unittest.cc
@@ -0,0 +1,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.