Re: using atlocal variables in autotest macros

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

 



-----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             ebb9@xxxxxxx
-----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-----


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux