[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I pass an argument to a test???
From: |
Dr. David Kirkby |
Subject: |
Re: How do I pass an argument to a test??? |
Date: |
Sun, 13 Apr 2003 01:29:17 +0100 |
Bruce Korb wrote:
>
> "Dr. David Kirkby" wrote:
> >
> > Hi,
> > I'm hoping some king sole can help me here, as I am stuck. The only
> > solution I can think of is rather messy.
> >
> > I have a configure.ac which sets a variable 'mpirun_found' to yes or
> > no, depending on whether or not it can find a program called 'mpirun'.
> > This is done with the following in my configure.ac
> >
> > #configure.ac
> > AC_CHECK_PROG(mpirun_found,mpirun,yes,no,$PATH)
> >
> > I have about 85 tests in the $top_srdir/tests, each exiting with
> > either a 0 (passed) or 1 (failed). Most tests make use of the
> > variables $top_builddir and $top_builddir, which I passed to the tests
> > with a tests/Makefile.am like this
> >
> > # This tests/Makefile.am
> > TESTS_ENVIRONMENT = top_builddir=$(top_builddir)
> > top_srcdir=$(top_srcdir)
> > TESTS = \
> > always.test \
> > sometimes.test
> > etc.
> >
> > I would like the first test 'always.test' to always be executed, but
> > the second 'sometimes.test' to only be executed if the variable
> > 'mpirun_found' is defined.
>
> It's defined at config time, not at run time.
Are you saying that the test itself should not make a decision as to
whether to exit with exit-code 77 (SKIP), or exit codes 0 and 1 ? i.e.
is the following fundamentally wrong for a test ?
# is this test not the way to do it ????
if [ 'some_condition is true' ] ; then
MD5SUM=`$top_builddir/tools/src/mymd5sum $top_builddir/tmp/foo.bmp`
if [ $MD5SUM = 847f4207b1b3cb708814ad9eff4736dc ]; then
exit 0 # pass, right checksum
else
exit 1 # fail, wrong checksum
fi
else
exit 77 # skip this test
fi
> Add: ``mpirun_found=$(mpirun_found)'' to the environment
In what file ? Does this include the two sets of quotes at each end -
I guess not?
> and see this page:
>
> http://Autogen.SourceForge.Net/conftest.html
That page don't work for me. Perhaps it's Internet Explorer specific,
but it fails to do anything sensible with my Netscape 4.78
> using a ``test'' type of test to set up what you want.
I'm not quite sure what you mean here?
--
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden