]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Split up rules for tests using mtrace and something else.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 14 Feb 2014 13:45:14 +0000 (13:45 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 14 Feb 2014 13:45:14 +0000 (13:45 +0000)
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.

ChangeLog
libio/Makefile
posix/Makefile
posix/tst-rxspencer-no-utf8.c [new file with mode: 0644]

index c2c5c3b3dbd040f434eb81a0f95db6408740e4f4..ed9f24c6fabb60a20230436af2c1e53219e7f91f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 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.
        [$(run-built-tests) = yes] (tests): Depend on
        $(objpfx)order-cmp.out.
index 747a7799511ac4ae75c13057bf03ac58698472a8..8c333ce8e06a74b23a3425a5cf3d73eb1b720729 100644 (file)
@@ -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 > $@
index 6709900cb2f0827ddfb3b0a6849cc2651da3ef1b..2c9868ed83508d87e452d552b62374a6bb15b9ad 100644 (file)
@@ -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 (file)
index 0000000..62d4c7d
--- /dev/null
@@ -0,0 +1 @@
+#include "tst-rxspencer.c"