[CMake] ctest returns 255 after running ctest_test() if no tests are available

Tyler Roscoe tyler at cryptio.net
Thu Jan 27 17:29:10 EST 2011


I have a CTest script that I use to drive dashboard builds. CTest
scripts return 0 (success) if everything works right, or non-zero
(failure; I'm getting 255 in this particular case on Linux) if something
goes wrong.

The problem I'm having is that I call ctest_test() in this script and I
have one platform where we don't build and run unit tests: opensuse 9,
which includes gcc 3.3.x, which is not supported by googletest, so we
just disable the building and running of unit tests on this platform.

The problem is that CTest considers this to be an error condition:

    Test project /satsop/build/kitt-cmake-based-addons-for-legacy-trunk/binary/addons/trunk/linux64.26/release
    Constructing a list of tests
    Done constructing a list of tests
    Checking test dependency graph...
    No tests were found!!!

and upon reaching the end of the script, it exits with an error:

    Error in read script: /satsop/build/kitt-cmake-based-addons-for-legacy-trunk/kitt.cmake


Is this a bug? It seems to me that calling ctest_test() on a project
with no tests added via add_test() is not an erroneous condition.

Is there a way to tell CTest not to freak out about the lack of tests?

Is there a way to ask CTest how many tests are available? If so, I could
skip calling ctest_test() unless that number is non-zero.

I can't just spare out the call to ctest_test() for this platform as
certain products have non-unittest tests that I still want to run via
ctest_test(). I would have to do a test like:

    if (PLATFORM MATCHES opensuse9 AND
        PRODUCT_NAME MATCHES addons)
        set (do_not_run_tests TRUE)
    endif ()
    
which is undesirable.


Any other ideas on how I can proceed here?

Thanks,
tyler


More information about the CMake mailing list