1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-05 19:35:52 +03:00

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.
This commit is contained in:
Joseph Myers
2014-02-14 13:42:44 +00:00
parent ed9a38e21b
commit 6e89caf118
6 changed files with 124 additions and 50 deletions

View File

@@ -1,3 +1,53 @@
2014-02-14 Joseph Myers <joseph@codesourcery.com>
* 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.
2014-02-13 Joseph Myers <joseph@codesourcery.com> 2014-02-13 Joseph Myers <joseph@codesourcery.com>
* bits/mman.h [__USE_MISC]: Remove redundant conditionals. * bits/mman.h [__USE_MISC]: Remove redundant conditionals.

View File

@@ -637,10 +637,11 @@ $(objpfx)circlemod2a.so: $(objpfx)circlemod3a.so
$(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so) $(objpfx)order: $(addprefix $(objpfx),dep4.so dep3.so dep2.so dep1.so)
$(objpfx)order.out: $(objpfx)order ifeq ($(run-built-tests),yes)
$(test-program-prefix) \ tests: $(objpfx)order-cmp.out
$(objpfx)order > $@ endif
(echo "0123456789" | cmp $@ -) > /dev/null $(objpfx)order-cmp.out: $(objpfx)order.out
(echo "0123456789" | cmp $< -) > $@
$(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so) $(objpfx)vismain: $(addprefix $(objpfx),vismod1.so vismod2.so)
$(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so) $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
@@ -848,38 +849,39 @@ endif
LDFLAGS-tst-array2 = $(no-as-needed) LDFLAGS-tst-array2 = $(no-as-needed)
LDFLAGS-tst-array5 = $(no-as-needed) LDFLAGS-tst-array5 = $(no-as-needed)
$(objpfx)tst-array1.out: tst-array1.exp $(objpfx)tst-array1 ifeq ($(run-built-tests),yes)
$(test-program-cmd) > $@ tests: $(objpfx)tst-array1-cmp.out $(objpfx)tst-array1-static-cmp.out \
cmp $@ tst-array1.exp > /dev/null $(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 $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out
$(test-program-cmd) > $@ cmp $^ > $@
cmp $@ tst-array1.exp > /dev/null
$(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: $(objpfx)tst-array2dep.so
$(objpfx)tst-array2.out: tst-array2.exp $(objpfx)tst-array2 $(objpfx)tst-array2-cmp.out: tst-array2.exp $(objpfx)tst-array2.out
$(test-program-cmd) > $@ cmp $^ > $@
cmp $@ tst-array2.exp > /dev/null
$(objpfx)tst-array3.out: tst-array1.exp $(objpfx)tst-array3 $(objpfx)tst-array3-cmp.out: tst-array1.exp $(objpfx)tst-array3.out
$(test-program-cmd) > $@ cmp $^ > $@
cmp $@ tst-array1.exp > /dev/null
$(objpfx)tst-array4: $(libdl) $(objpfx)tst-array4: $(libdl)
$(objpfx)tst-array4.out: tst-array4.exp $(objpfx)tst-array4 \ $(objpfx)tst-array4.out: $(objpfx)tst-array2dep.so
$(objpfx)tst-array2dep.so $(objpfx)tst-array4-cmp.out: tst-array4.exp $(objpfx)tst-array4.out
$(test-program-cmd) > $@ cmp $^ > $@
cmp $@ tst-array4.exp > /dev/null
$(objpfx)tst-array5: $(objpfx)tst-array5dep.so $(objpfx)tst-array5: $(objpfx)tst-array5dep.so
$(objpfx)tst-array5.out: tst-array5.exp $(objpfx)tst-array5 $(objpfx)tst-array5-cmp.out: tst-array5.exp $(objpfx)tst-array5.out
$(test-program-cmd) > $@ cmp $^ > $@
cmp $@ tst-array5.exp > /dev/null
$(objpfx)tst-array5-static.out: tst-array5-static.exp \ $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
$(objpfx)tst-array5-static $(objpfx)tst-array5-static.out
$(test-program-cmd) > $@ cmp $^ > $@
cmp $@ tst-array5-static.exp > /dev/null
CFLAGS-tst-pie1.c += $(pie-ccflag) 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: $(libdl)
$(objpfx)tst-global1.out: $(objpfx)testobj6.so $(objpfx)testobj2.so $(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: $(libdl)
$(objpfx)order2.out: $(objpfx)order2 $(objpfx)order2mod1.so \ $(objpfx)order2.out: $(objpfx)order2mod1.so $(objpfx)order2mod2.so
$(objpfx)order2mod2.so $(objpfx)order2-cmp.out: $(objpfx)order2.out
$(test-program-prefix) \ (echo "12345" | cmp $< -) > $@
$(objpfx)order2 > $@
(echo "12345" | cmp $@ -) > /dev/null
$(objpfx)order2mod1.so: $(objpfx)order2mod4.so $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
$(objpfx)order2mod4.so: $(objpfx)order2mod3.so $(objpfx)order2mod4.so: $(objpfx)order2mod3.so
$(objpfx)order2mod2.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-unique4: $(objpfx)tst-unique4lib.so
$(objpfx)tst-initorder.out: $(objpfx)tst-initorder ifeq ($(run-built-tests),yes)
$(test-program-prefix) \ tests: $(objpfx)tst-initorder-cmp.out
$< > $@ endif
cmp $@ tst-initorder.exp > /dev/null $(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-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so
$(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
@@ -1124,10 +1128,11 @@ endef
object-suffixes-left := a b c d object-suffixes-left := a b c d
include $(o-iterator) include $(o-iterator)
$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2 ifeq ($(run-built-tests),yes)
$(test-program-prefix) \ tests: $(objpfx)tst-initorder2-cmp.out
$< > $@ endif
cmp $@ tst-initorder2.exp > /dev/null $(objpfx)tst-initorder2-cmp.out: tst-initorder2.exp $(objpfx)tst-initorder2.out
cmp $^ > $@
$(objpfx)tst-relsort1: $(libdl) $(objpfx)tst-relsort1: $(libdl)
$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so $(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 $(objpfx)tst-relsort1mod2.so
ifeq ($(run-built-tests),yes) ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-unused-dep.out tests: $(objpfx)tst-unused-dep.out $(objpfx)tst-unused-dep-cmp.out
endif endif
$(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so $(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} \ $(elf-objpfx)${rtld-installed-name} \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ --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 > $@

View File

@@ -1,3 +1,10 @@
2014-02-14 Joseph Myers <joseph@codesourcery.com>
* 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.
2014-02-10 Ondřej Bílka <neleai@seznam.cz> 2014-02-10 Ondřej Bílka <neleai@seznam.cz>
* allocatestack.c (queue_stack, allocate_stack, * allocatestack.c (queue_stack, allocate_stack,

View File

@@ -542,7 +542,13 @@ endif
ifeq ($(build-shared),yes) ifeq ($(build-shared),yes)
$(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0 $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
$(make-test-out) 2>&1 | cmp - tst-cleanup0.expect > $@ $(make-test-out) > $@ 2>&1
ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-cleanup0-cmp.out
endif
$(objpfx)tst-cleanup0-cmp.out: tst-cleanup0.expect $(objpfx)tst-cleanup0.out
cmp $^ > $@
$(objpfx)crti.o: $(objpfx)pt-crti.o $(objpfx)crti.o: $(objpfx)pt-crti.o
ln -f $< $@ ln -f $< $@

View File

@@ -124,9 +124,15 @@ tst-grouping-ENV = LOCPATH=$(common-objpfx)localedata
CPPFLAGS += $(libio-mtsafe) CPPFLAGS += $(libio-mtsafe)
$(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1 ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-setvbuf1-cmp.out
endif
$(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
$(test-program-cmd) > $@ 2>&1 $(test-program-cmd) > $@ 2>&1
cmp tst-setvbuf1.expect $@
$(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
cmp $^ > $@
ifeq ($(build-shared),yes) ifeq ($(build-shared),yes)
link-libm = $(common-objpfx)math/libm.so link-libm = $(common-objpfx)math/libm.so

View File

@@ -74,9 +74,7 @@ CFLAGS-test-ffs.c = -fno-builtin
CFLAGS-tst-inlcall.c = -fno-builtin CFLAGS-tst-inlcall.c = -fno-builtin
ifeq ($(run-built-tests),yes) ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-svc.out tests: $(objpfx)tst-svc-cmp.out
$(objpfx)tst-svc.out: tst-svc.input $(objpfx)tst-svc $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \ cmp $^ > $@
$(test-program-cmd) < $(word 1,$^) > $@
@cmp tst-svc.expect $(objpfx)tst-svc.out
endif endif