From: Eric Blake Date: Fri, 29 Jul 2011 14:52:27 +0000 (-0600) Subject: build: avoid non-portable shell in test setup X-Git-Tag: v0.9.4~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=343ab98229a60126ec75087dd425207392b77754;p=thirdparty%2Flibvirt.git build: avoid non-portable shell in test setup 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. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 43a4301995..f4afcb9150 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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` \