]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: avoid non-portable shell in test setup
authorEric Blake <eblake@redhat.com>
Fri, 29 Jul 2011 14:52:27 +0000 (08:52 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 29 Jul 2011 17:47:18 +0000 (11:47 -0600)
POSIX states that 'a=1; a=2 b=$a command' has unspecified results
for the value of $b visible within command.  In particular, on
BSD, this resulted in PATH not picking up the in-test ssh.

* tests/Makefile.am (lv_abs_top_builddir): New macro.
(path_add, TESTS_ENVIRONMENT): Use it to avoid referring to an
environment variable set previously within the same command line.
Reported by Matthias Bolte.

tests/Makefile.am

index 43a4301995574251a0689353b8f37db708d4a4f6..f4afcb9150dd683b0662a3f60d458081223fc49b 100644 (file)
@@ -259,13 +259,17 @@ TESTS += interfacexml2xmltest
 
 TESTS += cputest
 
-path_add = $$abs_top_builddir/daemon$(PATH_SEPARATOR)$$abs_top_builddir/tools$(PATH_SEPARATOR)$$abs_top_builddir/tests
-
 # NB, automake < 1.10 does not provide the real
 # abs_top_{src/build}dir or builddir variables, so don't rely
 # on them here. Fake them with 'pwd'
+# Also, BSD sh doesn't like 'a=b b=$$a', so we can't use an
+# intermediate shell variable, but must do all the expansion in make
+
+lv_abs_top_builddir=`cd '$(top_builddir)'; pwd`
+path_add = $(lv_abs_top_builddir)/daemon$(PATH_SEPARATOR)$(lv_abs_top_builddir)/tools$(PATH_SEPARATOR)$(lv_abs_top_builddir)/tests
+
 TESTS_ENVIRONMENT =                            \
-  abs_top_builddir=`cd '$(top_builddir)'; pwd` \
+  abs_top_builddir=$(lv_abs_top_builddir)      \
   abs_top_srcdir=`cd '$(top_srcdir)'; pwd`     \
   abs_builddir=`pwd`                           \
   abs_srcdir=`cd '$(srcdir)'; pwd`             \