]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] parallel-tests: minor optimizations
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 19 Apr 2012 13:15:52 +0000 (15:15 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 19 Apr 2012 20:12:28 +0000 (22:12 +0200)
* lib/am/check.am (am__check_pre): Shave off a couple of forks in
the case the test script is placed in a subdirectory.
* t/spy-autovars.sh: New "spy" test, verifying that our expectations
on the behaviour of (some) GNU make automatic variables are correct.
* t/list-of-tests.mk: Add it.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
lib/am/check.am
t/list-of-tests.mk
t/spy-autovars.sh [new file with mode: 0755]

index 395f8d2bf82cc2b7a1ca417ffcfd47214e7820f0..d47043733f50ea4572925f328f87f289dc6b2606 100644 (file)
@@ -79,8 +79,7 @@ am__check_pre =                                               \
 $(am__sh_e_setup);                                     \
 $(am__tty_colors);                                     \
 srcdir=$(srcdir); export srcdir;                       \
-am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;           \
-test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?;        \
+test x$(@D) = x. || test -d $(@D) || $(MKDIR_P) $(@D) || exit $$?; \
 f='$(patsubst $(srcdir)/%,%,$<)';                      \
 ## We need to invoke the test in way that won't cause a PATH search.
 case $< in */*) tst=$<;; *) tst=./$<;; esac;           \
index 4ee9c2406a2eaf1d598c8ff51b423f41bc08b5a5..e97140ec5567a3f00e079ca1739b19ccdfd50596 100644 (file)
@@ -979,6 +979,7 @@ t/spell.sh \
 t/spell2.sh \
 t/spell3.sh \
 t/spelling.sh \
+t/spy-autovars.sh \
 t/spy-double-colon.sh \
 t/spy-phony.sh \
 t/spy-rm.tap \
diff --git a/t/spy-autovars.sh b/t/spy-autovars.sh
new file mode 100755 (executable)
index 0000000..4326745
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Verify that our expectations on the behaviour of (some) GNU make
+# automatic variables are correct.
+# This test is quite incomplete, and should be filled out whenever
+# we want to start assuming and using a further behaviour of
+# automatic variables of GNU make.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+cat > Makefile <<'END'
+foo:
+       test $@ = foo
+       test $(@D) = .
+       test $(@F) = foo
+./bar:
+       test $@ = ./bar || test $@ = bar
+       test $(@D) = .
+       test $(@F) = bar
+../baz:
+       test $@ = ../baz
+       test $(@D) = ..
+       test $(@F) = baz
+1/2/3:
+       test $@ = 1/2/3
+       test $(@D) = 1/2
+       test $(@F) = 3
+/abs/path:
+       test $@ = /abs/path
+       test $(@D) = /abs
+       test $(@F) = path
+END
+
+$MAKE foo
+$MAKE ./foo
+$MAKE bar
+$MAKE ./bar
+$MAKE ../baz
+$MAKE 1/2/3
+$MAKE ./1/2/3
+$MAKE /abs/path
+
+: