[CMake] make test missing
Michael Hertling
mhertling at online.de
Mon Nov 8 20:52:55 EST 2010
On 11/08/2010 10:03 PM, Jochen Issing wrote:
> Hi list,
>
> I tried to add ctest to my project and did this by adding ENABLE_TESTING() and several ADD_TEST(...) to my CMakeLists.txt file.
> The tests are run on executables, which are built inside a dedicated test directory in my project root and the execs show up in my Makefile.
> After reading through some docs, I am told to call make test after building. However, no target named 'test' is available.
I.e. it doesn't show up in the listing of "make help"?
> Here my question: Does my directory 'test' interfere with the 'test' rule or do I have to install the executables before testing or do I still miss something?
On *nix, I can see the following CMakeLists.txt work:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(TEST C)
ENABLE_TESTING()
FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/test ${CMAKE_BINARY_DIR}/test)
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
ADD_EXECUTABLE(main main.c)
SET_TARGET_PROPERTIES(
main
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test
)
ADD_TEST(NAME main COMMAND main)
The output of "make test" - without installation - is:
Running tests...
Test project /home/hertling/work/cmake/issing/obj
Start 1: main
1/1 Test #1: main ............................. Passed 0.00 sec
100% tests passed, 0 tests failed out of 1
Total Test time (real) = 0.11 sec
So, I'd conclude the "test" directories' presence doesn't matter,
nor does the fact if an installation has already been performed.
Maybe, you could post your CMakeLists.txt for further inspection.
Regards,
Michael
> Anyhow, 'ctest -D Experimental' seems to do something :/
>
> Also, I am not sure if I need to setup a Dashboard-Server to use testing at all. I suppose it's possible without a dashboard, but don't know how.
> Thanks in advance!
> Cheers,
>
> - jochen
> gpg: 1024D/013400C7
More information about the CMake
mailing list