[CMake] How to get the result of a test during tests

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Oct 22 14:24:27 EDT 2007


On 2007-10-22 11:43+0200 Baptiste Derongs wrote:

> Hello all,
>
> I would like to test a property of my system (actually if an MPI
> function works well). And only if it does, I will launch a part of my
> tests. If not, only the main part will execute.
>
> So I was thinking that the best solution would be to ADD_TEST
> something that will look at my MPI function, and next, get the result
> of this test, and if it's ok, ADD_TEST other tests. But I didn't find
> anything about reading test results during the execution of the tests.
> Is it possible ?

I suggest using normal CMake BOOLEAN logic to set up conditional ADD_TEST's.
That is, use EXECUTE_PROCESS in ordinary cmake code to determine if the MPI
function works well.  Store results in a CMake variable such as MPI_WORKS
(ON or OFF).  Then ADD_TEST your various components depending on the value
of MPI_WORKS.

We use this general method (normal BOOLEAN logic) to set up our various
ADD_TEST's in PLplot.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list