[CMake] ADD_TEST comparing the command input with a file content

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Jul 4 15:56:36 EDT 2008


On 2008-07-04 12:08+0200 William Candillon wrote:

> Hi,
>
> I'm using the ADD_TEST command to test the output of my executable like this:
> ADD_TEST(test mycommand)
> SET_TEST_PROPERTIES(test PROPERTIES PASS_REGULAR_EXPRESSION "foo")
>
> However, I would like to compare the output with the content of a
> file. Is there a platform independent way to do that without writing a
> perl script for example ?

You can run "cmake -E compare_files file1 file2" as part of your test at
test time (not at the normal cmake time when the tests are configured) to
check whether file1 and file2 are the same or not.

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