From 7f98f1806a9b13fc6425566693e6674fd44e33e4 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 14 Feb 2014 13:45:14 +0000 Subject: [PATCH] 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 , 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. --- ChangeLog | 16 ++++++++++++++++ libio/Makefile | 16 +++++++++------- posix/Makefile | 24 +++++++++++++----------- posix/tst-rxspencer-no-utf8.c | 1 + 4 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 posix/tst-rxspencer-no-utf8.c diff --git a/ChangeLog b/ChangeLog index c2c5c3b3db..ed9f24c6fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2014-02-14 Joseph Myers + * 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. [$(run-built-tests) = yes] (tests): Depend on $(objpfx)order-cmp.out. diff --git a/libio/Makefile b/libio/Makefile index 747a779951..8c333ce8e0 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -179,9 +179,9 @@ include ../Rules ifeq ($(run-built-tests),yes) tests: $(objpfx)test-freopen.out ifeq (yes,$(build-shared)) -# Run tst-fopenloc.check only if shared library is enabled since it -# depends on tst-fopenloc.out. -tests: $(objpfx)tst-fopenloc.check +# Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared +# library is enabled since they depend on tst-fopenloc.out. +tests: $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out endif endif @@ -189,7 +189,9 @@ $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \ $(common-objpfx)libio/ -$(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out - cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \ - > $@ - $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@ +$(objpfx)tst-fopenloc-cmp.out: ../iconvdata/testdata/ISO-8859-1..UTF8 \ + $(objpfx)tst-fopenloc.out + cmp $^ > $@ + +$(objpfx)tst-fopenloc-mem.out: $(objpfx)tst-fopenloc.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace > $@ diff --git a/posix/Makefile b/posix/Makefile index 6709900cb2..2c9868ed83 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -86,7 +86,7 @@ tests := tstgetopt testfnm runtests runptests \ tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \ bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ - tst-pathconf tst-getaddrinfo4 + tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 xtests := bug-ga2 ifeq (yes,$(build-shared)) 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-regex21-mem bug-regex21.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 \ bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \ 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-regex35-ENV = LOCPATH=$(common-objpfx)localedata tst-rxspencer-ARGS = --utf8 rxspencer/tests +tst-rxspencer-no-utf8-ARGS = rxspencer/tests tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata +tst-rxspencer-no-utf8-ENV = LOCPATH=$(common-objpfx)localedata tst-pcre-ARGS = PCRE.tests tst-boost-ARGS = BOOST.tests bug-glob1-ARGS = "$(objpfx)" @@ -221,7 +224,8 @@ ptestcases.h: PTESTS PTESTS2C.sed tests: $(objpfx)annexc.out ifeq ($(run-built-tests),yes) 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)bug-glob2-mem $(objpfx)tst-vfork3-mem $(objpfx)tst-fnmatch-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 $(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@ -# tst-rxspencer.mtrace is generated only when run without --utf8 -# option, since otherwise the file has almost 100M and takes very long -# time to process. -$(objpfx)tst-rxspencer-mem: $(objpfx)tst-rxspencer.out - MALLOC_TRACE=$(objpfx)tst-rxspencer.mtrace $(tst-rxspencer-ENV) \ - $(test-program-prefix) $(objpfx)tst-rxspencer rxspencer/tests \ - > /dev/null - $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer.mtrace > $@ +# tst-rxspencer.mtrace is not generated, only +# tst-rxspencer-no-utf8.mtrace, since otherwise the file has almost +# 100M and takes very long time to process. +tst-rxspencer-no-utf8-ENV += MALLOC_TRACE=$(objpfx)tst-rxspencer-no-utf8.mtrace +$(objpfx)tst-rxspencer-no-utf8-mem: $(objpfx)tst-rxspencer-no-utf8.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer-no-utf8.mtrace > $@ tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace $(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out diff --git a/posix/tst-rxspencer-no-utf8.c b/posix/tst-rxspencer-no-utf8.c new file mode 100644 index 0000000000..62d4c7dd4c --- /dev/null +++ b/posix/tst-rxspencer-no-utf8.c @@ -0,0 +1 @@ +#include "tst-rxspencer.c"