[CMake] Running two executables sequentially in a test

David Doria daviddoria at gmail.com
Mon May 2 13:18:33 EDT 2011


I am trying to run an executable that produces an output image, then
compare this image to a baseline using a separate Compare executable.

Is it possible to do this in a single add_test command? I tried
separating the two executables with a semicolon, but that doesn't seem
to work.

add_executable(Compare Compare.cpp) #build the Compare executable
add_executable(simple simple.cpp) #build the simple/test executable
add_test(NAME SimpleTest COMMAND simple output.png;Compare output.png
baselines/baseline.png) # run the 'simple' executable to produce the
output, then use 'Compare' to compare it to a baseline

I think doing it in two separate tests would be ok:

add_test(NAME SimpleTest COMMAND simple)# run the 'simple' executable
to produce the output
add_test(NAME CompareSimple COMMAND Compare output.png
baselines/baseline.png) # use 'Compare' to compare it to a baseline

but I'm afraid that they may run in different orders (if multiple
threads are used to run the tests, etc).

What would be the "best practice" way to do this?

Thanks,

David


More information about the CMake mailing list