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

Re: [libvirt] [PATCH] build: avoid non-portable shell in test setup



2011/7/29 Eric Blake <eblake redhat com>:
> 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.
> ---
>
> Spotted by inspection based on an IRC report; hopefully someone
> on BSD can test if it actually makes a difference.
>
>  tests/Makefile.am |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 43a4301..f4afcb9 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`             \
> --
> 1.7.4.4

ACK, this make gmake check pass completely on FreeBSD.

-- 
Matthias Bolte
http://photron.blogspot.com


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