[CMake] Adding Tests - Suggestions needed
Richard Wackerbarth
rkw at dataplex.net
Tue Jun 21 10:12:59 EDT 2005
I'm working on a legacy Unix program that I need to port to multiple
platforms.
I've now gotten it to compile in CMake on a number of the platforms
and would like to add some regression tests before I start really
messing things up.
The program was written to read part of its input from stdin. But I
don't see how to source stdin from a file when I use ADD_TEST.
At the moment, I am using a template shell command.
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Test1Shell.in
${CMAKE_CURRENT_BINARY_DIR}/Test1Shell.sh )
ADD_TEST ( Test1
/bin/sh
${CMAKE_CURRENT_BINARY_DIR}/Test1Shell.sh )
where Test1Shell.in is
#!/bin/sh
${PROJECT_BINARY_DIR}/MyProgramBeingTested \
--using ${CMAKE_CURRENT_SOURCE_DIR}/Test1Database.txt \
-o ${CMAKE_CURRENT_BINARY_DIR}/Test1Output.txt \
< ${CMAKE_CURRENT_SOURCE_DIR}/Test1TestData.txt
Is there a better way?
Second question...
In some tests, I want to verify that the output generated "matches" a
reference copy.
If they were identical, "diff" would work. However, in this case,
there are a few places where the date/time or host name appear.
Can someone suggest a comparison program that would be easy to use
and, importantly, express the comparison in a simple manner.
At the moment, I am using sed/awk to edit the output and thereby
eliminate the variable part of the output before calling diff to do
the comparison.
More information about the CMake
mailing list