autoconf
[Top][All Lists]
Advanced

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

using atlocal variables in autotest macros


From: John Wohlbier
Subject: using atlocal variables in autotest macros
Date: Wed, 25 Feb 2009 12:03:00 -0700

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.

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

In my macros I just want to check for whether this variable is set, viz,
if test -n "$DOING_MPI" ; then
 do some stuff
fi

In particular I'd like to change the command I send to AT_CHECK to execute
the test executable.


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],
[
#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
])
=================================================================

(you can see that I've tried both "if test" commands as well as using
"AS_IF." I get the same result)


a file test.at with
=================================================================
AT_RUN_PROGRAM(test_Cell_Field,2)
=================================================================


and I have testsuite.at with
=================================================================
AT_INIT([pika_fields])

AT_BANNER([pika fields])

m4_include(local.at)
m4_include(test.at)
=================================================================

(sorry for all of the files, but I'm trying to set up a system where I can
plug in lots of test*.at files with
a common local.at. Btw, I am using automake and I have testsuite depending
on all of these *.at files and that dependency is working. I.e., when I make
changes to one of them my testsuite script gets regenerated.)

Here is some output from make check
=================================================================
autom4te --language=autotest -I '../../../../src/pika_fields/test' -o
testsuite.tmp testsuite.at
mv testsuite.tmp testsuite
/bin/sh 'testsuite' -d
## -------------------------------------- ##
## pika_fields 0 test suite: pika_fields. ##
## -------------------------------------- ##

pika fields


executing $run test_Cell_Field 2

  1: test_Cell_Field                                 ok

## ------------- ##
## Test results. ##
## ------------- ##

1 test was successful.
=================================================================

You can see that $run is being treated as a constant, and my variables are
not getting evaluated.

I also have gone directly into the testsuite script that is generated and
added
echo "$DOING_MPI"
and verified that that value is being read in properly from atlocal.

What is it that I don't understand about how autotest macros should be
written?


Thanks very much.

jgw



-- 
John G. Wohlbier


reply via email to

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