[CMake] redirecting standard input in a test

Brad King brad.king at kitware.com
Tue Jul 11 11:31:15 EDT 2006


Alcino Dall'Igna Jr wrote:
> Hi
> 
> How do I wrote an ADD_TEST command so a program reading standard input
> could be redirected to a file?
> 
> I try:
> 
> ADD_TEST(t build/Debug/tcmake < data)
> 
> as it should be in linux, but it doesn't work. The program still
> executes fine but does not understand that the input should be
> redirected to the 'data' file.

Tests are added as full command lines, not shell scripts.  The "<" will 
be passed as a literal argument to the program.  You can create a "test 
driver" program that wraps around the real program to be tested and 
invokes it with the redirected input.  Alternatively if you only care 
about UNIX systems you can run a shell script that invokes the real 
program with redirection.

-Brad


More information about the CMake mailing list