[CMake] Testing an installation

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Dec 3 02:39:48 EST 2013


On 2013-12-02 20:58-0500 Michael Jackson wrote:

> I need to implement a "test" that does an installation of my project
into a location and then check that all the files indeed got installed
or if there are any errors during the installation. Is there a "best
practice" way of achieving this with CMake? Does CMake itself do
something like this in their own test suite?

Hi Michael:

I advocate testing the install tree by running the same set of tests
for that tree as you do for the source tree. Here is how I have
implemented that idea with PLplot.

We test PLplot with a set of 34 standard examples written in the 14
different computer languages we support. When we install that examples
sub-tree we also install the CMakeLists.txt files in that sub-tree as
well as a top-level CMakeLists.txt file that is specific just to the
installed examples case. Inside those files we distinguish between the
core build and installed examples build with the CORE_BUILD variable
to allow different CMake logic when necessary in the two cases.  But
most of the CMake logic in those files is identical for the two cases.
So the big advantage of organizing tests this way is every time I
write a new test, it is automatically available in the build tree
corresponding to the core build system and the completely separate
build tree for the installed examples build system.

To get back to your original question, if your install tree passes all
the tests that you have dreamed up over the years for you source tree,
then, pretty much by definition, that proves your install tree has
been installed correctly.

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); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); 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