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: Ralf Wildenhues
Subject: Re: using atlocal variables in autotest macros
Date: Sat, 28 Feb 2009 13:43:36 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hello John,

* John Wohlbier wrote on Wed, Feb 25, 2009 at 08:03:00PM CET:
> For the life of me I can't figure out how to use variables I've set in
> atlocal.in in my macros defined in my *.at files. I think it must be due to
> my lack of understanding of the m4 language, and maybe more specifically the
> --language=autotest option of autom4te.

I don't think either of the above is the case.  :-)

> m4_define([AT_RUN_PROGRAM],
> [
> #run=""
> #if test -n "$DOING_MPI" ;
> #  run="mpirun -n $2"
> #fi
> 
> 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
> ])

> /bin/sh 'testsuite' -d
> ## -------------------------------------- ##
> ## pika_fields 0 test suite: pika_fields. ##
> ## -------------------------------------- ##
> 
> pika fields
> 
> 
> 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.

Yes.  But that is because the argument to AT_BANNER is treated as a
shell-literal constant (imagine it were enclosed in single quotes '').
I think this is technically necessary because the argument ends up in a
couple of far-apart places in the testsuite, and allowing shell
parameter expansion could easily lead to inconsistent results (e.g., the
output of ./testsuite being inconsistent with './testsuite -l').

I haven't checked, but IIRC it's not so easy to lift this limitation.

However, the first argument to AT_CHECK does undergo shell expansion.
You should be able to verify this with
  ./testsuite -v -d -x

Hope that helps.

Cheers,
Ralf




reply via email to

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