This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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-noutf8.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.

This patch and
<https://sourceware.org/ml/libc-alpha/2014-02/msg00414.html> together
have the effect that 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.

2014-02-13  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-noutf8.
	(generated): Change tst-rxspencer-mem and tst-rxspencer.mtrace to
	tst-rxspencer-noutf8-mem and tst-rxspencer-noutf8.mtrace.
	(tst-rxspencer-noutf8-ARGS): New variable.
	(tst-rxspencer-noutf8-ENV): Likewise.
	(tests target): Depend on $(objpfx)tst-rxspencer-noutf8-mem
	instead of $(objpfx)tst-rxspencer-mem.
	($(objpfx)tst-rxspencer-mem): Change target to
	$(objpfx)tst-rxspencer-noutf8-mem.  Depend on
	$(objpfx)tst-rxspencer-noutf8.out instead of running test program.
	* posix/tst-rxspencer-noutf8.c: New file.

diff --git a/libio/Makefile b/libio/Makefile
index 747a779..8c333ce 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 6709900..5e631f6 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-noutf8
 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-noutf8-mem tst-rxspencer-noutf8.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-noutf8-ARGS = rxspencer/tests
 tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
+tst-rxspencer-noutf8-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-noutf8-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-noutf8.mtrace, since otherwise the file has almost
+# 100M and takes very long time to process.
+tst-rxspencer-noutf8-ENV += MALLOC_TRACE=$(objpfx)tst-rxspencer-noutf8.mtrace
+$(objpfx)tst-rxspencer-noutf8-mem: $(objpfx)tst-rxspencer-noutf8.out
+	$(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer-noutf8.mtrace > $@
 
 tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace
 $(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out
diff --git a/posix/tst-rxspencer-noutf8.c b/posix/tst-rxspencer-noutf8.c
new file mode 100644
index 0000000..62d4c7d
--- /dev/null
+++ b/posix/tst-rxspencer-noutf8.c
@@ -0,0 +1 @@
+#include "tst-rxspencer.c"

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]