This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold][patch] First test for the incremental linker


Add a simple test for the incremental linking information. For now it
checks only the command line. I will try to add more to the test as
the implementation advances.

2009-11-30  Rafael Avila de Espindola  <espindola@google.com>

	* testsuite/Makefile.am: Add the incremental_test.sh test.
	* testsuite/incremental_test.sh: New.
	* testsuite/incremental_test_1.c: New.
	* testsuite/incremental_test_2.c: New.

Cheers,
-- 
Rafael Ãvila de EspÃndola
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 0351828..54e8843 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -105,6 +105,17 @@ flagstest_debug.o: constructor_test.cc
 flagstest_ndebug.o: constructor_test.cc
 	$(CXXCOMPILE) -O0 -c -o $@ $<
 
+check_SCRIPTS += incremental_test.sh
+check_DATA += incremental_test.stdout
+MOSTLYCLEANFILES += incremental_test
+incremental_test_1.o: incremental_test_1.c
+	$(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
+incremental_test_2.o: incremental_test_2.c
+	$(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
+incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
+	$(LINK) -Bgcctestdir/ -Wl,-incremental incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
+incremental_test.stdout: incremental_test ../incremental-dump
+	../incremental-dump incremental_test > $@
 
 check_SCRIPTS += gc_comdat_test.sh
 check_DATA += gc_comdat_test.stdout
diff --git a/gold/testsuite/incremental_test.sh b/gold/testsuite/incremental_test.sh
new file mode 100755
index 0000000..dab3202
--- /dev/null
+++ b/gold/testsuite/incremental_test.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+cat incremental_test.cmdline | grep "gcctestdir/ld " | cut -d ' ' -f 2- > \
+  actual
+
+cat incremental_test.stdout | grep "Link command line" | cut -d : -f 2- | \
+  cut -d ' ' -f 3- | sed "s/'//g" > recorded
+
+diff actual recorded
+rm actual recorded
+
+exit 0
\ No newline at end of file
diff --git a/gold/testsuite/incremental_test_1.c b/gold/testsuite/incremental_test_1.c
new file mode 100644
index 0000000..4e610c0
--- /dev/null
+++ b/gold/testsuite/incremental_test_1.c
@@ -0,0 +1 @@
+int a;
diff --git a/gold/testsuite/incremental_test_2.c b/gold/testsuite/incremental_test_2.c
new file mode 100644
index 0000000..114a478
--- /dev/null
+++ b/gold/testsuite/incremental_test_2.c
@@ -0,0 +1,5 @@
+int b;
+
+int main(void) {
+  return 0;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]