diff options
author | Joseph Myers <joseph@codesourcery.com> | 2014-02-14 13:42:44 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2014-02-14 13:42:44 +0000 |
commit | 6e89caf118d4091356ff79a7a3e9d5439c231cd1 (patch) | |
tree | 91abbc17c036a6701e40046f71a0e77846ca260e /elf | |
parent | ed9a38e21b8c7b4f413d7f8e3fc183297df3c2be (diff) | |
download | glibc-6e89caf118d4091356ff79a7a3e9d5439c231cd1.zip glibc-6e89caf118d4091356ff79a7a3e9d5439c231cd1.tar.gz glibc-6e89caf118d4091356ff79a7a3e9d5439c231cd1.tar.bz2 |
Split up rules for tests that compare output with baselines.
This patch splits makefile rules that generate a file then run cmp to
check the contents of that file into separate rules to generate and
compare the file. This simplifies making those tests generate PASS /
FAIL results, by removing the need to insert && between commands in
the test so that a $(evaluate-test) call is reached. It also avoids
the oddity of the .out file being an intermediate file rather than the
final result generated, as noted for some of these tests in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00894.html>.
In many cases, the rule to run the program was no longer needed
because the default rules for running test programs on the host to
generate a .out file sufficed. (I'm not asserting the commands run
after this patch are *exactly* the same as before, simply that the
rules did nothing special that appeared deliberate or relevant to
anything about what the tests were testing. In cases where the rules
redirected stderr as well as stdout, I left the existing rule's
redirection in place to avoid changing what gets compared with the
expected results.)
It's clear there is a lot in common between the various -cmp.out rules
and it might be possible in future to refactor them into more generic
support for the case of comparing test output against a baseline.
(Some baselines are *.exp, some *.expect, some directly embedded in
the makefiles, and nptl/tst-cleanupx0.expect appears unused.)
Tested x86_64.
* elf/Makefile ($(objpfx)order.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order-cmp.out.
($(objpfx)order-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-array1-cmp.out, $(objpfx)tst-array1-static-cmp.out,
$(objpfx)tst-array2-cmp.out, $(objpfx)tst-array3-cmp.out,
$(objpfx)tst-array4-cmp.out, $(objpfx)tst-array5-cmp.out and
$(objpfx)tst-array5-static-cmp.out.
($(objpfx)tst-array1.out): Remove rule.
($(objpfx)tst-array1-cmp.out): New rule.
($(objpfx)tst-array1-static.out): Remove rule.
($(objpfx)tst-array1-static-cmp.out): New rule.
($(objpfx)tst-array2.out): Remove rule.
($(objpfx)tst-array2-cmp.out): New rule.
($(objpfx)tst-array3.out): Remove rule.
($(objpfx)tst-array3-cmp.out): New rule.
($(objpfx)tst-array4.out): Remove rule.
($(objpfx)tst-array4-cmp.out): New rule.
($(objpfx)tst-array5.out): Remove rule.
($(objpfx)tst-array5-cmp.out): New rule.
($(objpfx)tst-array5-static.out): Remove rule.
($(objpfx)tst-array5-static-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order2-cmp.out.
($(objpfx)order2.out): Remove rule.
($(objpfx)order2-cmp.out): New rule.
($(objpfx)tst-initorder.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-initorder-cmp.out.
($(objpfx)tst-initorder-cmp.out): New rule.
($(objpfx)tst-initorder2.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-initorder2-cmp.out.
($(objpfx)tst-initorder2-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-unused-dep-cmp.out.
($(objpfx)tst-unused-dep-cmp.out): Do not run cmp.
($(objpfx)tst-unused-dep-cmp.out): New rule.
* stdio-common/Makefile [$(run-built-tests) = yes] (tests): Depend
on $(objpfx)tst-setvbuf1-cmp.out.
($(objpfx)tst-setvbuf1.out): Do not run cmp.
($(objpfx)tst-setvbuf1-cmp.out): New rule.
* string/Makefile [$(run-built-tests) = yes] (tests): Depend
$(objpfx)tst-svc-cmp.out instead of $(objpfx)tst-svc.out.
($(objpfx)tst-svc.out): Remove rule.
($(objpfx)tst-svc-cmp.out): New rule.
nptl:
* Makefile ($(objpfx)tst-cleanup0.out): Do not run cmp.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-cleanup0-cmp.out.
($(objpfx)tst-cleanup0-cmp.out): New rule.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/Makefile | 91 |
1 files changed, 49 insertions, 42 deletions
diff --git a/elf/Makefile b/elf/Makefile index a684b6b..6f4f2f8 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -637,10 +637,11 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so) -$(objpfx)order.out: $(objpfx)order - $(test-program-prefix) \ - $(objpfx)order > $@ - (echo "0123456789" | cmp $@ -) > /dev/null +ifeq ($(run-built-tests),yes) +tests: $(objpfx)order-cmp.out +endif +$(objpfx)order-cmp.out: $(objpfx)order.out + (echo "0123456789" | cmp $< -) > $@ $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so) $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so) @@ -848,38 +849,39 @@ endif LDFLAGS-tst-array2 = $(no-as-needed) LDFLAGS-tst-array5 = $(no-as-needed) -$(objpfx)tst-array1.out: tst-array1.exp $(objpfx)tst-array1 - $(test-program-cmd) > $@ - cmp $@ tst-array1.exp > /dev/null +ifeq ($(run-built-tests),yes) +tests: $(objpfx)tst-array1-cmp.out $(objpfx)tst-array1-static-cmp.out \ + $(objpfx)tst-array2-cmp.out $(objpfx)tst-array3-cmp.out \ + $(objpfx)tst-array4-cmp.out $(objpfx)tst-array5-cmp.out \ + $(objpfx)tst-array5-static-cmp.out +endif -$(objpfx)tst-array1-static.out: tst-array1.exp $(objpfx)tst-array1-static - $(test-program-cmd) > $@ - cmp $@ tst-array1.exp > /dev/null +$(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out + cmp $^ > $@ + +$(objpfx)tst-array1-static-cmp.out: tst-array1.exp \ + $(objpfx)tst-array1-static.out + cmp $^ > $@ $(objpfx)tst-array2: $(objpfx)tst-array2dep.so -$(objpfx)tst-array2.out: tst-array2.exp $(objpfx)tst-array2 - $(test-program-cmd) > $@ - cmp $@ tst-array2.exp > /dev/null +$(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out + cmp $^ > $@ -$(objpfx)tst-array3.out: tst-array1.exp $(objpfx)tst-array3 - $(test-program-cmd) > $@ - cmp $@ tst-array1.exp > /dev/null +$(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out + cmp $^ > $@ $(objpfx)tst-array4: $(libdl) -$(objpfx)tst-array4.out: tst-array4.exp $(objpfx)tst-array4 \ - $(objpfx)tst-array2dep.so - $(test-program-cmd) > $@ - cmp $@ tst-array4.exp > /dev/null +$(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so +$(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out + cmp $^ > $@ $(objpfx)tst-array5: $(objpfx)tst-array5dep.so -$(objpfx)tst-array5.out: tst-array5.exp $(objpfx)tst-array5 - $(test-program-cmd) > $@ - cmp $@ tst-array5.exp > /dev/null +$(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out + cmp $^ > $@ -$(objpfx)tst-array5-static.out: tst-array5-static.exp \ - $(objpfx)tst-array5-static - $(test-program-cmd) > $@ - cmp $@ tst-array5-static.exp > /dev/null +$(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \ + $(objpfx)tst-array5-static.out + cmp $^ > $@ CFLAGS-tst-pie1.c += $(pie-ccflag) @@ -1003,12 +1005,13 @@ tst-audit8-ENV = LD_AUDIT=$(objpfx)tst-auditmod1.so $(objpfx)tst-global1: $(libdl) $(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so +ifeq ($(run-built-tests),yes) +tests: $(objpfx)order2-cmp.out +endif $(objpfx)order2: $(libdl) -$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \ - $(objpfx)order2mod2.so - $(test-program-prefix) \ - $(objpfx)order2 > $@ - (echo "12345" | cmp $@ -) > /dev/null +$(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so +$(objpfx)order2-cmp.out: $(objpfx)order2.out + (echo "12345" | cmp $< -) > $@ $(objpfx)order2mod1.so: $(objpfx)order2mod4.so $(objpfx)order2mod4.so: $(objpfx)order2mod3.so $(objpfx)order2mod2.so: $(objpfx)order2mod3.so @@ -1104,10 +1107,11 @@ $(objpfx)tst-unique3.out: $(objpfx)tst-unique3lib2.so $(objpfx)tst-unique4: $(objpfx)tst-unique4lib.so -$(objpfx)tst-initorder.out: $(objpfx)tst-initorder - $(test-program-prefix) \ - $< > $@ - cmp $@ tst-initorder.exp > /dev/null +ifeq ($(run-built-tests),yes) +tests: $(objpfx)tst-initorder-cmp.out +endif +$(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out + cmp $^ > $@ $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so @@ -1124,10 +1128,11 @@ endef object-suffixes-left := a b c d include $(o-iterator) -$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2 - $(test-program-prefix) \ - $< > $@ - cmp $@ tst-initorder2.exp > /dev/null +ifeq ($(run-built-tests),yes) +tests: $(objpfx)tst-initorder2-cmp.out +endif +$(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out + cmp $^ > $@ $(objpfx)tst-relsort1: $(libdl) $(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so @@ -1136,7 +1141,7 @@ $(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \ $(objpfx)tst-relsort1mod2.so ifeq ($(run-built-tests),yes) -tests: $(objpfx)tst-unused-dep.out +tests: $(objpfx)tst-unused-dep.out $(objpfx)tst-unused-dep-cmp.out endif $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so @@ -1147,4 +1152,6 @@ $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so $(elf-objpfx)${rtld-installed-name} \ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ $< > $@ - cmp $@ /dev/null > /dev/null + +$(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out + cmp $< /dev/null > $@ |