[CMake] About testing with ctest

Brad King brad.king at kitware.com
Wed Sep 20 12:26:34 EDT 2006


Slava Semushin wrote:
>     - I added ENABLE_TESTING() to CMakeLists.txt and ADD_TEST() to
>       tests/CMakeLists.txt and my test works. But I see autogenerated
>       files with name DartTestfile.txt in src/ also:
> 
>       [slava at semushin ~/openfm]$ cat src/DartTestfile.txt
>       # CMake generated Testfile for 
>       # Source directory: /home/slava/openfm/src
>       # Build directory: /home/slava/openfm/src
>       # 
>       # This file replicates the SUBDIRS() and ADD_TEST() commands from the
>       # source
>       # tree CMakeLists.txt file, skipping any SUBDIRS() or ADD_TEST() commands
>       # that are excluded by CMake control structures, i.e. IF() commands.
>       #
>       # The next line is critical for Dart to work
>       # Duh :-)
> 
>       [slava at semushin ~/openfm]$
> 
>       So, is it possible do not create file-tempalate DartTestfile.txt
>       when not SUBDIRS() or ADD_TEST() specified for that directory?
> 
>     - Why I can't set name with spaces for test? For example:
> 
>       ADD_TEST ("print help"  run_tests.sh 1)
> 
>       instead of
> 
>       ADD_TEST ("print_help"  run_tests.sh 1)
> 
>       Now I have error for first case:
> 
>         2/  2 Testing print                         Unable to find
>         executable: help
> 
>         50% tests passed, 1 tests failed out of 2
> 
>         The following tests FAILED:
>                   2 - print (Not Run)
>       Errors while running CTest
>       make: *** [test] Error 8

The format and layout of DartTestfile.txt files is left from an old
tcl-based implementation that provided a Dart client before ctest
(http://public.kitware.com/Dart).  It still needs to be supported so we
cannot change this layout for now.

We could probably make it supports spaces in test names though.  No one
has ever reported this problem or tried to use spaces before so it was
never implemented.

>     - And also why when I run make test VERBOSE=1 ctest works in nornal
>       mode? I expect then ctest should runs with -V flags, for example.

The VERBOSE variable tells *make* to report its rules verbosely and does
not control the way the rules are executed.  CTest should probably look
for that environment variable and enable the option though.

You can submit feature requests here:

http://www.cmake.org/Bug

-Brad


More information about the CMake mailing list