[CMake] ctest command

Alan W. Irwin irwin at beluga.phys.uvic.ca
Thu Oct 4 15:06:15 EDT 2007


On 2007-10-04 13:03-0500 Juan Sanchez wrote:

> Hi,
>
> I'm trying to run the following test:
> ADD_TEST("foo" ${CMAKE_TEST_COMMAND} --build-run-dir
> ${PROJECT_SOURCE_DIR} -VV --test-command "ls -ltar /tmp")
>
> But it doesn't seem to be running correctly.  It needs to be run from
> ${PROJECT_SOURCE_DIR}, and the test command needs to be able to take the
> arguments given.

I don't have practical experience with many of these ctest options, but I
was curious and looked them up in the documentation, and it appears you are
not using them correctly.  For example, --test-command is documented (by
ctest --help-full) as

"The test to run with the --build-and-test option."

but you don't have a --build-and-test option above so I think that's why
your --test-command option is being ignored.

Also, I am curious about your practical goal.  If/when the above test
works it looks like it would create a a simple test that would allow ctest
to invoke ctest on the command line. Do you need that extra level of ctest
indirection?

An alternative to the above extra layer of ctest indirection is to write a
configurable bash or python or perl script to do what you want at ctest time
and set up ctest for it using

ADD_TEST("foo" full_path/scriptname).

The configurable script, of course, allows you to change directories to any
configured directory before you run your actual test.

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