[cmake-developers] Run program/command before test

Roman Wüger roman.wueger at gmx.at
Wed Feb 17 01:58:07 EST 2016


Ok thanks

Would it be an opinion to have a COMMAND parameter for the add_test function like execute_process where every COMMAND must return the exit code and this would be ored?

add_test(MyTest COMMAND myserver --port 80
                              COMMAND mytest 
                              COMMAND myserver --graceful-shutdown)

Or

add_test(MyTest PRE_COMMAND myserver --port 80
                              COMMAND mytest 
                              POST_COMMAND myserver --graceful-shutdown)

Best Regards
Roman

> Am 16.02.2016 um 16:49 schrieb Brad King <brad.king at kitware.com>:
> 
>> On 02/16/2016 07:17 AM, Roman Wüger wrote:
>> Is it possible with CMake >= 3.4.0 to run a program/command before the
>> test and another program after the test was run?
>> 
>> The meaning of that would be, that I want to start a small server
>> program and run the "client" test. After the test was finished,
>> kill the process of the server program or do a graceful shutdown of it.
> 
> There is currently no builtin feature for that.  Other than a few
> test output matching properties, ctest always expects the process
> to be independent and report results via its exit code.
> 
> -Brad
> 


More information about the cmake-developers mailing list