[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using atlocal variables in autotest macros
From: |
John Wohlbier |
Subject: |
Re: using atlocal variables in autotest macros |
Date: |
Tue, 3 Mar 2009 09:13:17 -0700 |
On Tue, Mar 3, 2009 at 12:13 AM, Ralf Wildenhues <address@hidden>wrote:
>
> > I don't see results from the "echo" in any of the resulting files. Thus I
> > have no way of knowing if the AS_IF should even work since I don't know
> the
> > value of MPI_LIBS.
>
> Ah, another specialty of Autotest. Shell code not enclosed in AT_SETUP/
> AT_CLEANUP is pretty much dropped on the floor. I.e., the banners and
> the number of tests that a testsuite contains as a whole, is a constant
> determined at the time the testsuite is created.
>
> I guess you want something like this instead:
>
> ...
> m4_define([AT_MPIRUN_PROGRAM],
> [AT_BANNER([executing mpirun -n $2 $1])
> AT_SETUP([$1])
> AT_CHECK([test -n "$MPI_LIBS" || exit 77])
> AT_CHECK([mpirun -n $2 $1],[0],[ignore],[ignore])
> AT_CLEANUP
> ])
>
> Hope that helps.
>
> Cheers,
> Ralf
>
Ah ha! Thanks very much. That's what I've been looking for for over a week!
I got the basic functionality to work with the following.
m4_define([AT_MPIRUN_PROGRAM],
[AT_BANNER([executing mpirun -n $2 $1])
AT_SETUP([$1])
AT_CHECK([test -n "$MPI_LIBS" || exit 77])
AT_TESTED([$1])
AT_CHECK([mpirun -n $2 $1],[0],[ignore],[ignore])
AT_CLEANUP
])
m4_define([AT_SERIALRUN_PROGRAM],
[AT_BANNER([executing ./$1])
AT_SETUP([$1])
AT_CHECK([test -z "$MPI_LIBS" || exit 77])
AT_TESTED([$1])
AT_CHECK([$1],[0],[ignore],[ignore])
AT_CLEANUP
])
I was surprised by the AT_CHECK([test -z "$MPI_LIBS" || exit 77]) line
(note it's different than what you suggested). I had to flip the -n and -z
tests. I guess the double pipe (||) means that if the first argument is
true, then take it, otherwise take exit 77.
The last thing is asthetic. I would rather not have the "other" test(s)
execute at all. When I build and test serial I see
## -------------------------------------- ##
## pika_fields 0 test suite: pika_fields. ##
## -------------------------------------- ##
pika fields
executing ./test_Cell_Field
1: test_Cell_Field ok
executing mpirun -n 1 test_Cell_Field
2: test_Cell_Field skipped
(test_Cell_Field.at:3)
executing mpirun -n 2 test_Cell_Field
3: test_Cell_Field skipped
(test_Cell_Field.at:4)
executing mpirun -n 4 test_Cell_Field
4: test_Cell_Field skipped
(test_Cell_Field.at:5)
executing mpirun -n 8 test_Cell_Field
5: test_Cell_Field skipped
(test_Cell_Field.at:6)
## ------------- ##
## Test results. ##
## ------------- ##
1 test was successful.
4 tests were skipped.
but I'd like to have my test_Cell_Field.at look like this
AT_SERIALRUN_PROGRAM([test_Cell_Field])
AT_MPIRUN_PROGRAM([test_Cell_Field],[1])
AT_MPIRUN_PROGRAM([test_Cell_Field],[2])
AT_MPIRUN_PROGRAM([test_Cell_Field],[4])
AT_MPIRUN_PROGRAM([test_Cell_Field],[8])
So I don't have to maintain two files, one for serial and one for parallel.
Any suggestions for how to achieve that?
Thanks again for the help.
jgw
--
John G. Wohlbier