On 2012-11-01 18:28, Matthew Woehlke wrote:
On 2012-11-01 18:00, Robert Deschambault wrote:
Hello,
I have a situation where I would like to run a unit test that requires
two
separate processes. Is it possible to set this up under CTest?
AFAIK, yes, if you can write a single process that spawns and waits on
your other processes. (If you're relying on something like python or a
UNIX shell being available, you could leverage that, with a script, as
the controller process.)
Basically, anything you can coerce into 'run a single process with some
arguments, wait on it to exit, and take the exit status and/or output
parsing as the test result' can be a CTest test.
...as an example:
find_program(BASH_EXECUTABLE bash)
add_test(my_test ${BASH_EXECUTABLE} run_my_test.sh)
Replace bash with python or whatnot depending on what scripting language
you prefer to use to write the test driver. (Or you can write the driver
as a C/C++ program and use fork(), as suggested by Leif.)
Don't forget, though, that this is not very portable to e.g. Windows, if
that matters to your project. (Though fork() is even less so... if you
care about Windows, using python might be best.)
--
Matthew
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake