[CMake] for install before running tests

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Oct 9 14:49:49 EDT 2007


On 2007-10-09 10:12-0500 Juan Sanchez wrote:

> The test scripts for an existing project rely greatly on the installed
> directory structure.

For your information, that's contrary to the fundamental idea behind ctest
(and autotools "make check" as well) which is that all tests are run in the
build tree (i.e., potentially before "make install" is run).

For the PLplot case we had a test script that was originally designed to
work just for the install-tree case, but back in our autotools days we
modified that script to have an option to work in the build-tree case to
deal with the "make check" autotools case.  That option continued to be
implemented as part of our later CMake-based build system. For that case,
when the build-tree option is on, the test script depends strictly on build
tree executables, libraries, shell scripts, and data files rather than their
installed counterparts, and the test script is run indirectly by ctest
from the build tree.

The approach of having a test script with build-tree and install-tree
options gives us the best of both worlds.

(1) A comprehensive install-tree test (run from the install tree by merely
executing the test script) for those who install PLplot (including end users
of PLplot who tend to install it in binary form only).

(2) A virtually identical build-tree test run by ctest for those who build
PLplot. The latter is especially useful to our developers to check the
recent changes they have made.  In the future we also plan to take the next
obvious step with our testing which is to use ctest for nightly automated
testing of our svn repository with results collected by a dartboard server.

I suggest a similar approach where you modify your install-tree only script
to have a build-tree option as well would be well worth your while.

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