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

William Candillon wcandillon at gmail.com
Tue Jul 8 05:37:47 EDT 2008


Hello guys,

Thank you very much for the tip! This is exactly what I needed.

Best regards,

William

On Fri, Jul 4, 2008 at 9:56 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
> 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
> __________________________
>



-- 
William Candillon
http://apdt.googlecode.com


More information about the CMake mailing list