automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 09/32] tests: update PATH early from AM_TESTS_ENVIRONMENT and run


From: Stefano Lattarini
Subject: [PATCH 09/32] tests: update PATH early from AM_TESTS_ENVIRONMENT and runtest
Date: Thu, 26 Jul 2012 14:04:35 +0200

Because the POSIX standards mandate that sourcing a file with ". FILE"
will cause FILE (assuming it is a relative containing no slashes) to be
looked for in PATH, such a move will allow us to simplify our sourcing
of shell testing libraries like (currently) 't/ax/test-init.sh' and
'defs', and to modularize and re-organize them better in the feature,
with minimal churn.

* runtest.in, Makefile.am (AM_TEST_ENVIRONMENT): Prepend $(abs_srcdir)/t/ax
and $(abs_builddir)/t/ax (in that order) to PATH; do so avoiding repetition
in the common case of non-VPATH builds.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 Makefile.am | 10 ++++++++++
 runtest.in  | 12 ++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 6b6e938..1636623 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -350,6 +350,16 @@ AM_TESTS_ENVIRONMENT = \
 AM_TESTS_FD_REDIRECT = 9>&2
 AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
 
+# For sourcing of extra "shell libraries" by our test scripts.  As per
+# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+# in case it is given with a relative name containing no slashes.
+AM_TESTS_ENVIRONMENT += \
+  if test "$srcdir" != .; then \
+    PATH='$(abs_srcdir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
+  fi; \
+  PATH='$(abs_builddir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
+  export PATH;
+
 # Hand-written tests.
 
 include $(srcdir)/t/list-of-tests.mk
diff --git a/runtest.in b/runtest.in
index 53e2498..c818840 100644
--- a/runtest.in
+++ b/runtest.in
@@ -23,6 +23,18 @@ set -e; set -u
 : ${AM_PROVE_CMD='prove'}
 : ${AM_PROVEFLAGS='--merge --verbose'}
 : ${srcdir='@srcdir@'}
+: ${abs_srcdir='@abs_srcdir@'}
+: ${abs_builddir='@abs_builddir@'}
+: ${PATH_SEPARATOR='@PATH_SEPARATOR@'}
+
+# For sourcing of extra "shell libraries" by our test scripts.  As per
+# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+# in case it is given with a relative name containing no slashes.
+if test "$srcdir" != .; then
+  PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH
+fi
+PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH
+export PATH
 
 # For use by the testsuite framework.  The Automake test harness
 # define this, so we better do the same.
-- 
1.7.12.rc0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]