Split up rules for tests using mtrace and something else.

Most glibc tests that use mtrace to verify that there were no memory
leaks from the glibc facilities used in a given test depend on the
.out file of the previous test so that the mtrace test runs mtrace and
nothing else.

Two, however, have a single target combining mtrace with something
else.  In the case of libio/tst-fopenloc.check, the test both compares
the output with an expected baseline and runs mtrace.  In the case of
posix/tst-rxspencer-mem, the test is run (with different command line
from the main run) and then mtrace is run, from the same makefile
target.

This patch splits both of these tests up to use separate makefile
targets for each thing tested; in the tst-rxspencer case, a file
tst-rxspencer-no-utf8.c is created that just includes tst-rxspencer.c,
as is usual for tests where the same code gets tested in different
compile-time or runtime configurations.

Adding $(evaluate-test) to test commands, as in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00194.html>, will no
longer need to insert && between multiple commands, as all tests will
either have just a single command or already use &&.

Tested x86_64.

	* libio/Makefile ($(objpfx)tst-fopenloc.check): Split into
	separate $(objpfx)tst-fopenloc-cmp.out and
	$(objpfx)tst-fopenloc-mem.out targets.
	(tests): Update dependencies.
	* posix/Makefile (tests variable): Add tst-rxspencer-no-utf8.
	(generated): Change tst-rxspencer-mem and tst-rxspencer.mtrace to
	tst-rxspencer-no-utf8-mem and tst-rxspencer-no-utf8.mtrace.
	(tst-rxspencer-no-utf8-ARGS): New variable.
	(tst-rxspencer-no-utf8-ENV): Likewise.
	(tests target): Depend on $(objpfx)tst-rxspencer-no-utf8-mem
	instead of $(objpfx)tst-rxspencer-mem.
	($(objpfx)tst-rxspencer-mem): Change target to
	$(objpfx)tst-rxspencer-no-utf8-mem.  Depend on
	$(objpfx)tst-rxspencer-no-utf8.out instead of running test program.
	* posix/tst-rxspencer-no-utf8.c: New file.
This commit is contained in:
Joseph Myers 2014-02-14 13:45:14 +00:00
parent 6e89caf118
commit 7f98f1806a
4 changed files with 39 additions and 18 deletions

View File

@ -1,5 +1,21 @@
2014-02-14 Joseph Myers <joseph@codesourcery.com> 2014-02-14 Joseph Myers <joseph@codesourcery.com>
* libio/Makefile ($(objpfx)tst-fopenloc.check): Split into
separate $(objpfx)tst-fopenloc-cmp.out and
$(objpfx)tst-fopenloc-mem.out targets.
(tests): Update dependencies.
* posix/Makefile (tests variable): Add tst-rxspencer-no-utf8.
(generated): Change tst-rxspencer-mem and tst-rxspencer.mtrace to
tst-rxspencer-no-utf8-mem and tst-rxspencer-no-utf8.mtrace.
(tst-rxspencer-no-utf8-ARGS): New variable.
(tst-rxspencer-no-utf8-ENV): Likewise.
(tests target): Depend on $(objpfx)tst-rxspencer-no-utf8-mem
instead of $(objpfx)tst-rxspencer-mem.
($(objpfx)tst-rxspencer-mem): Change target to
$(objpfx)tst-rxspencer-no-utf8-mem. Depend on
$(objpfx)tst-rxspencer-no-utf8.out instead of running test program.
* posix/tst-rxspencer-no-utf8.c: New file.
* elf/Makefile ($(objpfx)order.out): Remove rule. * elf/Makefile ($(objpfx)order.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on [$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order-cmp.out. $(objpfx)order-cmp.out.

View File

@ -179,9 +179,9 @@ include ../Rules
ifeq ($(run-built-tests),yes) ifeq ($(run-built-tests),yes)
tests: $(objpfx)test-freopen.out tests: $(objpfx)test-freopen.out
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
# Run tst-fopenloc.check only if shared library is enabled since it # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
# depends on tst-fopenloc.out. # library is enabled since they depend on tst-fopenloc.out.
tests: $(objpfx)tst-fopenloc.check tests: $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
endif endif
endif endif
@ -189,7 +189,9 @@ $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
$(common-objpfx)libio/ $(common-objpfx)libio/
$(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out $(objpfx)tst-fopenloc-cmp.out: ../iconvdata/testdata/ISO-8859-1..UTF8 \
cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \ $(objpfx)tst-fopenloc.out
> $@ cmp $^ > $@
$(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@
$(objpfx)tst-fopenloc-mem.out: $(objpfx)tst-fopenloc.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace > $@

View File

@ -86,7 +86,7 @@ tests := tstgetopt testfnm runtests runptests \
tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \ tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \ bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
tst-pathconf tst-getaddrinfo4 tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8
xtests := bug-ga2 xtests := bug-ga2
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
test-srcs := globtest test-srcs := globtest
@ -106,7 +106,8 @@ generated := $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \ bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \
bug-regex21-mem bug-regex21.mtrace \ bug-regex21-mem bug-regex21.mtrace \
bug-regex31-mem bug-regex31.mtrace \ bug-regex31-mem bug-regex31.mtrace \
tst-rxspencer-mem tst-rxspencer.mtrace tst-getconf.out \ tst-rxspencer-no-utf8-mem tst-rxspencer-no-utf8.mtrace \
tst-getconf.out \
tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \ tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \ bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
tst-vfork3-mem tst-vfork3.mtrace getconf.speclist \ tst-vfork3-mem tst-vfork3.mtrace getconf.speclist \
@ -202,7 +203,9 @@ bug-regex33-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex34-ENV = LOCPATH=$(common-objpfx)localedata bug-regex34-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex35-ENV = LOCPATH=$(common-objpfx)localedata bug-regex35-ENV = LOCPATH=$(common-objpfx)localedata
tst-rxspencer-ARGS = --utf8 rxspencer/tests tst-rxspencer-ARGS = --utf8 rxspencer/tests
tst-rxspencer-no-utf8-ARGS = rxspencer/tests
tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
tst-rxspencer-no-utf8-ENV = LOCPATH=$(common-objpfx)localedata
tst-pcre-ARGS = PCRE.tests tst-pcre-ARGS = PCRE.tests
tst-boost-ARGS = BOOST.tests tst-boost-ARGS = BOOST.tests
bug-glob1-ARGS = "$(objpfx)" bug-glob1-ARGS = "$(objpfx)"
@ -221,7 +224,8 @@ ptestcases.h: PTESTS PTESTS2C.sed
tests: $(objpfx)annexc.out tests: $(objpfx)annexc.out
ifeq ($(run-built-tests),yes) ifeq ($(run-built-tests),yes)
tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \ tests: $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
$(objpfx)bug-regex21-mem $(objpfx)bug-regex31-mem $(objpfx)tst-rxspencer-mem\ $(objpfx)bug-regex21-mem $(objpfx)bug-regex31-mem \
$(objpfx)tst-rxspencer-no-utf8-mem \
$(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \ $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
$(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-mem $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-mem
xtests: $(objpfx)bug-ga2-mem xtests: $(objpfx)bug-ga2-mem
@ -265,14 +269,12 @@ tst-vfork3-ENV = MALLOC_TRACE=$(objpfx)tst-vfork3.mtrace
$(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out $(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@ $(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@
# tst-rxspencer.mtrace is generated only when run without --utf8 # tst-rxspencer.mtrace is not generated, only
# option, since otherwise the file has almost 100M and takes very long # tst-rxspencer-no-utf8.mtrace, since otherwise the file has almost
# time to process. # 100M and takes very long time to process.
$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out tst-rxspencer-no-utf8-ENV += MALLOC_TRACE=$(objpfx)tst-rxspencer-no-utf8.mtrace
MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \ $(objpfx)tst-rxspencer-no-utf8-mem: $(objpfx)tst-rxspencer-no-utf8.out
$(test-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \ $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer-no-utf8.mtrace > $@
> /dev/null
$(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@
tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace
$(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out $(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out

View File

@ -0,0 +1 @@
#include "tst-rxspencer.c"