path: root/tests
diff options
authorDavid Gibson <dwg@au1.ibm.com>2009-08-24 15:27:46 +1000
committerEric B Munson <ebmunson@us.ibm.com>2009-08-24 13:56:05 +0100
commita4b3004e3de458321387fc39448ee6512e791a98 (patch)
tree4f8ff6dc41b93f46c2f6be1e72550e3a27a3d046 /tests
parent637db55c57379f6e4c69d320ca16f9b05c873e3f (diff)
Make tests for SPECIAL in linker scripts safe against cross-compiles
Currently, run_tests.py invokes gcc to obtain the standard linker script, in order to tell if the old-style linker-script based relink testcases can work. But this a) assumes that a compiler and linker is available and b) assumes that it has the same linker script as when the testsuite was compiled. If the testsuite is compiled on one machine, then copied to another for execution, either of these could be false. This is a useful common case if the machine we're testing on is highly constrained (e.g. an embedded machine, or a simulator). What we really want is the linker script of the toolchain which was used to build the testsuite. Therefore this patch removes the test-time invocation of gcc. Instead, gcc is invoked to dump the linker script to a file when the testsuite is built, then run_tests.py reads this file back in and checks it for the appropriate linker magic. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Diffstat (limited to 'tests')
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 8a36acd..29ed192 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -31,7 +31,7 @@ LDFLAGS32 = -L../obj32
LDFLAGS64 = -L../obj64
INSTALL = install
ifdef ELF32
@@ -127,6 +127,14 @@ $(NOLIB_TESTS:%=obj64/%): %: %.o obj64/testutils.o
@$(VECHO) LD64 "(nolib test)" $@
$(CC64) $(LDFLAGS) $(LDFLAGS64) -o $@ $^ $(LDLIBS)
+obj32/%.ldscript: obj32/%.o obj32/testutils.o
+ @$(VECHO) SCRIPT32 $@
+ $(CC32) $(LDFLAGS) $(LDFLAGS32) -Wl,--verbose -o/dev/null $^ $(LDLIBS) > $@
+obj64/%.ldscript: obj64/%.o obj64/testutils.o
+ @$(VECHO) SCRIPT64 $@
+ $(CC64) $(LDFLAGS) $(LDFLAGS64) -Wl,--verbose -o/dev/null $^ $(LDLIBS) > $@
$(LDSCRIPT_TESTS:%=obj32/%): obj32/%: %.ld obj32/%.o obj32/testutils.o
@$(VECHO) LD32 "(preload test)" $@
$(CC32) $(LDFLAGS) $(LDFLAGS32) -o $@ -Lobj32 $^ $(LDLIBS) || cp $(BADTOOLCHAIN) $@
diff --git a/tests/run_tests.py b/tests/run_tests.py
index a7d750b..ac87703 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -253,13 +253,13 @@ def check_linkhuge_tests():
which word sizes can be tested with linkhuge. The others will be skipped.
NOTE: The linhuge_rw tests are always safe to run and will not be skipped.
- okbits = []
+ okbits = set()
for bits in wordsizes:
- cmd = "gcc -m%i -Wl,--verbose 2> /dev/null | grep -q SPECIAL" % bits
- (rc, out) = bash(cmd)
- if rc != 0: okbits.append(bits)
- return set(okbits)
+ script = open('obj%d/dummy.ldscript' % bits, 'r').read()
+ if script.count('SPECIAL') == 0:
+ okbits.add(bits)
+ return okbits
def print_cmd(pagesize, bits, cmd, env):
if env: