autoconf
[Top][All Lists]
Advanced

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

Re: using atlocal variables in autotest macros


From: Eric Blake
Subject: Re: using atlocal variables in autotest macros
Date: Sat, 28 Feb 2009 06:41:43 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to John Wohlbier on 2/25/2009 12:03 PM:

Hello John,

Sorry for a delay in replying.  And in addition to Ralf's comments,

> 
> For example, here is my atlocal.in:
> DOING_MPI='@MPI_LIBS@'

Looks reasonable.

> But it appears that somehow regular shell commands are stripped out of the
> macros. For example, in my local.at I have
> =================================================================
> m4_define([AT_RUN_PROGRAM],

It's a good habit to use your own namespace for your macros (and not the
AT_ namespace), in case autotest ever adds an AT_RUN_PROGRAM with
different semantics than your macro.

> [
> #run=""
> #if test -n "$DOING_MPI" ;
> #  run="mpirun -n $2"
> #fi
> 
> AS_IF(test -n "$DOING_MPI",[run="mpirun -n $2"],[run=""])

Get in the habit of full quoting; here, you want:

AS_IF([test -n "$DOING_MPI"], [run="mpirun -n $2"], [run=])

> 
> AT_BANNER([executing $run $1 $2])
> AT_TESTED([$1])
> AT_SETUP([$1])
> AT_CHECK([$run $1],0,[ignore],[ignore])
> AT_CLEANUP
> ])
...
> 
> executing $run test_Cell_Field 2
> 
>   1: test_Cell_Field                                 ok
> 
> 
> You can see that $run is being treated as a constant, and my variables are
> not getting evaluated.

Ralf's comment about the banner being literal text holds true.  But do you
really need the banner to be a dynamic string?  It seems like in general,
the output doesn't need to say what $run expands to unless you are doing a
verbose testsuite run (with -v).  But $run is indeed expanded by AT_CHECK.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmpPxcACgkQ84KuGfSFAYBqYQCfZpNmEFHKYzjiC2ZwUDjuhuKK
UwUAoIaku9Tw067tAhOdjvrh1KwoLy3m
=LLuN
-----END PGP SIGNATURE-----




reply via email to

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