diff --git a/CMakeLists.txt b/CMakeLists.txt index 091651c49ee0f09f88ddfe377d688cff0e74d603..4c2568530326423935f990fcf4be7975a1a05927 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,10 +77,25 @@ configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) include_directories("${CMAKE_CURRENT_BINARY_DIR}") add_definitions(-DHAVE_CONFIG_H) +# Create a custom target for building the tests. +# Thus they will not be built by make all any more. +# Actually I wanted this target to be a dependency +# of make test but that is currently not possible. +# See http://public.kitware.com/Bug/view.php?id=8438 +# This really sucks! +# Therefore currently make build_tests has to be called +# before make test. +add_custom_target(build_tests DEPENDS ${TESTPROGS}) + +# mimic make check of the autotools +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS build_tests) + # enable testing before adding the subdirectories. # Thus we can add the tests in the subdirectories # where they actually are. enable_testing() +#add_custom_target(build_test) +set_property(TEST APPEND PROPERTY DEPENDS build_tests) # add subdirectories to execute CMakeLists.txt there add_subdirectory("dune") @@ -116,96 +131,4 @@ if(PKG_CONFIG_FOUND ) endif(PKG_CONFIG_FOUND) include(CTest) -# add tests from dune/common/test -add_test(arraylisttest dune/common/test/arraylisttest) -add_test(arraytest dune/common/test/arraytest) -add_test(bigunsignedinttest dune/common/test/bigunsignedinttest) -add_test(bitsetvectortest dune/common/test/bitsetvectortest) -add_test(check_fvector_size dune/common/test/check_fvector_size) -add_test(conversiontest dune/common/test/conversiontest) -add_test(deprtuplestest dune/common/test/deprtuplestest) -add_test(dynmatrixtest dune/common/test/dynmatrixtest) -add_test(dynvectortest dune/common/test/dynvectortest) -add_test(enumsettest dune/common/test/enumsettest) -add_test(fmatrixtest dune/common/test/fmatrixtest) -add_test(fvectortest dune/common/test/fvectortest) -add_test(gcdlcmtest dune/common/test/gcdlcmtest) -add_test(iteratorfacadetest dune/common/test/iteratorfacadetest) -add_test(iteratorfacadetest2 dune/common/test/iteratorfacadetest2) -add_test(lrutest dune/common/test/lrutest) -if(MPI_CXX_FOUND) - add_test(mpicollectivecommunication dune/common/test/mpicollectivecommunication) -endif(MPI_CXX_FOUND) -add_test(mpiguardtest dune/common/test/mpiguardtest) -add_test(mpihelpertest dune/common/test/mpihelpertest) -add_test(mpihelpertest2 dune/common/test/mpihelpertest2) -add_test(nullptr_test dune/common/test/nullptr_test) -add_test(parametertreetest dune/common/test/parametertreetest) -add_test(pathtest dune/common/test/pathtest) -add_test(poolallocatortest dune/common/test/poolallocatortest) -add_test(shared_ptrtest_config dune/common/test/shared_ptrtest_config) -add_test(shared_ptrtest_dune dune/common/test/shared_ptrtest_dune) -add_test(singletontest dune/common/test/singletontest) -add_test(streamtest dune/common/test/streamtest) -add_test(testfassign1 dune/common/test/testfassign1) -add_test(testfassign2 dune/common/test/testfassign2) -add_test(testfassign3 dune/common/test/testfassign3) -add_test(testfassign4 dune/common/test/testfassign4) -add_test(test_stack dune/common/test/test_stack) -add_test(tuplestest_config dune/common/test/tuplestest_config) -add_test(tuplestest_dune dune/common/test/tuplestest_dune) -add_test(tuplestest_tr1 dune/common/test/tuplestest_tr1) -add_test(tupleutilitytest dune/common/test/tupleutilitytest) -add_test(utilitytest dune/common/test/utilitytest) -# failing tests -add_test(testfassign_fail1 dune/common/test/testfassign_fail1) -add_test(testfassign_fail2 dune/common/test/testfassign_fail2) -add_test(testfassign_fail3 dune/common/test/testfassign_fail3) -add_test(testfassign_fail4 dune/common/test/testfassign_fail4) -add_test(testfassign_fail5 dune/common/test/testfassign_fail5) -add_test(testfassign_fail6 dune/common/test/testfassign_fail6) -set_tests_properties( - testfassign_fail1 - testfassign_fail2 - testfassign_fail3 - testfassign_fail4 - testfassign_fail5 - testfassign_fail6 - PROPERTIES WILL_FAIL true) -# compile test -add_test(NAME static_assert_test - COMMAND ${CMAKE_COMMAND} --build . --target static_assert_test --config $<CONFIGURATION>) -add_test(NAME testfconstruct - COMMAND ${CMAKE_COMMAND} --build . --target testfconstruct --config $<CONFIGURATION>) -# failing compile tests -add_test(NAME genericiterator_compile_fail - COMMAND ${CMAKE_COMMAND} --build . --target genericiterator_compile_fail --config $<CONFIGURATION>) -add_test(NAME check_fvector_size_fail1 - COMMAND ${CMAKE_COMMAND} --build . --target check_fvector_size_fail1 --config $<CONFIGURATION>) -add_test(NAME check_fvector_size_fail2 - COMMAND ${CMAKE_COMMAND} --build . --target check_fvector_size_fail2 --config $<CONFIGURATION>) -add_test(NAME nullptr_test_fail - COMMAND ${CMAKE_COMMAND} --build . --target nullptr_test_fail --config $<CONFIGURATION>) -add_test(NAME static_assert_test_fail - COMMAND ${CMAKE_COMMAND} --build . --target static_assert_test_fail --config $<CONFIGURATION>) -add_test(NAME testfconstruct_fail1 - COMMAND ${CMAKE_COMMAND} --build . --target testfconstruct_fail1 --config $<CONFIGURATION>) -add_test(NAME testfconstruct_fail2 - COMMAND ${CMAKE_COMMAND} --build . --target testfconstruct_fail2 --config $<CONFIGURATION>) -set_tests_properties( - genericiterator_compile_fail - check_fvector_size_fail1 - check_fvector_size_fail2 - nullptr_test_fail - static_assert_test_fail - testfconstruct_fail1 - testfconstruct_fail2 - PROPERTIES WILL_FAIL true) - -# add tests from dune/common/parallel/test -add_test(indexsettest dune/common/parallel/test/indexsettest) -add_test(selectiontest dune/common/parallel/test/selectiontest) -if(MPI_CXX_FOUND) - add_test(indicestest dune/common/parallel/test/indicestest) - #add_test(syncertest dune/common/parallel/test/syncertest) -endif(MPI_CXX_FOUND) + diff --git a/dune/common/CMakeLists.txt b/dune/common/CMakeLists.txt index 6e7a247f5bd33bfe3340b417d783d7f3bf03c3ac..5d601bd02f9fcd86f4af5be7f22e19e60fc08d96 100644 --- a/dune/common/CMakeLists.txt +++ b/dune/common/CMakeLists.txt @@ -1,5 +1,5 @@ add_subdirectory("parallel") -add_subdirectory("test") +add_subdirectory("test" EXCLUDE_FROM_ALL) #build the library dunecommon add_library("dunecommon" diff --git a/dune/common/parallel/CMakeLists.txt b/dune/common/parallel/CMakeLists.txt index 425398614ca17b751d6573e194c56c8920b6ca68..ff2e13d919af5f9acb0ad6362e5af05b35664e30 100644 --- a/dune/common/parallel/CMakeLists.txt +++ b/dune/common/parallel/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory("test") +add_subdirectory("test" EXCLUDE_FROM_ALL) #install headers install(FILES @@ -11,3 +11,10 @@ install(FILES remoteindices.hh selection.hh DESTINATION include/dune/common/parallel) + +add_test(indexsettest indexsettest) +add_test(selectiontest selectiontest) +if(MPI_CXX_FOUND) + add_test(indicestest indicestest) + #add_test(syncertest syncertest) +endif(MPI_CXX_FOUND) diff --git a/dune/common/parallel/test/CMakeLists.txt b/dune/common/parallel/test/CMakeLists.txt index ff6eb56ffb189c709d281b5d8100488a8d9893e4..1a6782788dea3cf8bfb62e013fdd0f900a0ad2a7 100644 --- a/dune/common/parallel/test/CMakeLists.txt +++ b/dune/common/parallel/test/CMakeLists.txt @@ -1,3 +1,10 @@ +set(MPITESTPROGS indicestest indexsettest syncertest selectiontest) + +add_dependencies(build_tests ${MPITESTPROGS}) + +# We do not want want to build the tests during make all, +# but just build them on demand +add_dependencies(build_tests ${MPITESTPROGS}) add_executable("indexsettest" indexsettest.cc) target_link_libraries("indexsettest" "dunecommon") diff --git a/dune/common/test/CMakeLists.txt b/dune/common/test/CMakeLists.txt index 85e9323fa37a65802316c3160acf6cbddc0a9c7c..227391b3a694cf350cef18d6e1c08410ed667290 100644 --- a/dune/common/test/CMakeLists.txt +++ b/dune/common/test/CMakeLists.txt @@ -1,6 +1,61 @@ # Install some test headers, because they get used by tests in other modules install(FILES iteratortest.hh DESTINATION include/dune/common/test) +set(TESTPROGS + arraylisttest + arraytest + bigunsignedinttest + bitsetvectortest + check_fvector_size + conversiontest + deprtuplestest + dynmatrixtest + dynvectortest + enumsettest + fassigntest + float_cmp + fmatrixtest + fvectortest + gcdlcmtest + iteratorfacadetest + iteratorfacadetest2 + lrutest + mpicollcomm + mpiguardtest + mpihelpertest + mpihelpertest2 + nullptr-test + pathtest + parametertreetest + poolallocatortest + shared_ptrtest_config + shared_ptrtest_dune + singletontest + static_assert_test + streamtest + test-stack + testfassign1 + testfassign2 + testfassign3 + testfassign4 + testfassign_fail1 + testfassign_fail2 + testfassign_fail3 + testfassign_fail4 + testfassign_fail5 + testfassign_fail6 + testfconstruct + tuplestest_dune + tuplestest_std + tuplestest_tr1 + tupleutilitytest + utilitytest) + +# We do not want want to build the tests during make all, +# but just build them on demand +add_dependencies(build_tests ${TESTPROGS}) + +# Add the executables needed for the tests add_executable("arraylisttest" arraylisttest.cc) add_executable("arraytest" arraytest.cc) @@ -130,3 +185,90 @@ add_executable("tuplestest_tr1" tuplestest.cc) set_target_properties(tuplestest_tr1 PROPERTIES COMPILE_FLAGS "-DDISABLE_STD_TUPLE") add_executable("tupleutilitytest" tupleutilitytest.cc) add_executable("utilitytest" utilitytest.cc) + +# Add the tests to be executed +add_test(arraylisttest arraylisttest) +add_test(arraytest arraytest) +add_test(bigunsignedinttest bigunsignedinttest) +add_test(bitsetvectortest bitsetvectortest) +add_test(check_fvector_size check_fvector_size) +add_test(conversiontest conversiontest) +add_test(deprtuplestest deprtuplestest) +add_test(dynmatrixtest dynmatrixtest) +add_test(dynvectortest dynvectortest) +add_test(enumsettest enumsettest) +add_test(fmatrixtest fmatrixtest) +add_test(fvectortest fvectortest) +add_test(gcdlcmtest gcdlcmtest) +add_test(iteratorfacadetest iteratorfacadetest) +add_test(iteratorfacadetest2 iteratorfacadetest2) +add_test(lrutest lrutest) +if(MPI_CXX_FOUND) + add_test(mpicollectivecommunication mpicollectivecommunication) +endif(MPI_CXX_FOUND) +add_test(mpiguardtest mpiguardtest) +add_test(mpihelpertest mpihelpertest) +add_test(mpihelpertest2 mpihelpertest2) +add_test(nullptr_test nullptr_test) +add_test(parametertreetest parametertreetest) +add_test(pathtest pathtest) +add_test(poolallocatortest poolallocatortest) +add_test(shared_ptrtest_config shared_ptrtest_config) +add_test(shared_ptrtest_dune shared_ptrtest_dune) +add_test(singletontest singletontest) +add_test(streamtest streamtest) +add_test(testfassign1 testfassign1) +add_test(testfassign2 testfassign2) +add_test(testfassign3 testfassign3) +add_test(testfassign4 testfassign4) +add_test(test_stack test_stack) +add_test(tuplestest_config tuplestest_config) +add_test(tuplestest_dune tuplestest_dune) +add_test(tuplestest_tr1 tuplestest_tr1) +add_test(tupleutilitytest tupleutilitytest) +add_test(utilitytest utilitytest) +# failing tests +add_test(testfassign_fail1 testfassign_fail1) +add_test(testfassign_fail2 testfassign_fail2) +add_test(testfassign_fail3 testfassign_fail3) +add_test(testfassign_fail4 testfassign_fail4) +add_test(testfassign_fail5 testfassign_fail5) +add_test(testfassign_fail6 testfassign_fail6) +set_tests_properties( + testfassign_fail1 + testfassign_fail2 + testfassign_fail3 + testfassign_fail4 + testfassign_fail5 + testfassign_fail6 + PROPERTIES WILL_FAIL true) +# compile test +add_test(NAME static_assert_test + COMMAND ${CMAKE_COMMAND} --build . --target static_assert_test --config $<CONFIGURATION>) +add_test(NAME testfconstruct + COMMAND ${CMAKE_COMMAND} --build . --target testfconstruct --config $<CONFIGURATION>) +# failing compile tests +add_test(NAME genericiterator_compile_fail + COMMAND ${CMAKE_COMMAND} --build . --target genericiterator_compile_fail --config $<CONFIGURATION>) +add_test(NAME check_fvector_size_fail1 + COMMAND ${CMAKE_COMMAND} --build . --target check_fvector_size_fail1 --config $<CONFIGURATION>) +add_test(NAME check_fvector_size_fail2 + COMMAND ${CMAKE_COMMAND} --build . --target check_fvector_size_fail2 --config $<CONFIGURATION>) +add_test(NAME nullptr_test_fail + COMMAND ${CMAKE_COMMAND} --build . --target nullptr_test_fail --config $<CONFIGURATION>) +add_test(NAME static_assert_test_fail + COMMAND ${CMAKE_COMMAND} --build . --target static_assert_test_fail --config $<CONFIGURATION>) +add_test(NAME testfconstruct_fail1 + COMMAND ${CMAKE_COMMAND} --build . --target testfconstruct_fail1 --config $<CONFIGURATION>) +add_test(NAME testfconstruct_fail2 + COMMAND ${CMAKE_COMMAND} --build . --target testfconstruct_fail2 --config $<CONFIGURATION>) +set_tests_properties( + genericiterator_compile_fail + check_fvector_size_fail1 + check_fvector_size_fail2 + nullptr_test_fail + static_assert_test_fail + testfconstruct_fail1 + testfconstruct_fail2 + PROPERTIES WILL_FAIL true) +