On 17.02.2016 07:58, Roman Wüger wrote:
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)

What you could already do is wrap your test in a cmake script.

E.g.

    add_test(NAME MyTest
COMMAND ${CMAKE_COMMAND} -DACTUAL_TEST=$<TARGET_FILE:mytest> -P ${CMAKE_CURRENT_SOURCE_DIR}/mywrapper.cmake
    )

Where mywrapper.cmake could do something like:

    execute_process(COMMAND mysever --port 80 ...)

    execute_process(COMMAND ${ACTUAL_TEST} ....)

    execute_process(COMMAND mysever --graceful-shutdown)

To have the test fail you could call message(FATAL_ERROR "...")

For this to work myserver would have to daemonize/fork (but I assume that is the case given your example).

Nils
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to