From 53629fa30ca1d35880a2d9341ffe83795aa7d25a Mon Sep 17 00:00:00 2001 From: Darrell Wright Date: Mon, 27 Nov 2017 00:00:14 -0500 Subject: [PATCH] No longer hardwiring subfolders of test Hid build errors on should fail tests --- CMakeLists.txt | 23 ++++++++++++----------- compile_fail.sh | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d2f493..955a7c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ add_custom_target( testit COMMAND ${CMAKE_CTEST_COMMAND} ) add_dependencies( testit tz ) function( add_pass_tests TEST_GLOB TEST_PREFIX ) - file( GLOB FILENAMES ${TEST_GLOB} ) + file( GLOB_RECURSE FILENAMES ${TEST_GLOB} ) include_directories( "${HEADER_FOLDER}/date" ) foreach( TEST_FILE ${FILENAMES} ) @@ -83,7 +83,7 @@ function( add_pass_tests TEST_GLOB TEST_PREFIX ) endfunction( ) function( add_fail_tests TEST_GLOB TEST_PREFIX ) - file( GLOB FILENAMES ${TEST_GLOB} ) + file( GLOB_RECURSE FILENAMES ${TEST_GLOB} ) foreach( TEST_FILE ${FILENAMES} ) get_filename_component( TEST_NAME ${TEST_FILE} NAME_WE ) @@ -108,13 +108,14 @@ function( add_fail_tests TEST_GLOB TEST_PREFIX ) endforeach( ) endfunction( ) -add_pass_tests( "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/date_test/*.pass.cpp" "date_test" ) -add_pass_tests( "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/iso_week_test/*.pass.cpp" "iso_week_test" ) -add_pass_tests( "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/tz_test/*.pass.cpp" "tz_test" ) - -if( NOT WIN32 ) - add_fail_tests( "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/date_test/*.fail.cpp" "date_test" ) - add_fail_tests( "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/iso_week_test/*.fail.cpp" "iso_week_test" ) - add_fail_tests( "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/tz_test/*.fail.cpp" "tz_test" ) -endif( ) +file( GLOB children RELATIVE "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}" "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/*" ) +foreach( child ${children} ) + if( IS_DIRECTORY "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/${child}" ) + set( CUR_FOLDER "${PROJECT_SOURCE_DIR}/${TEST_FOLDER}/${child}" ) + add_pass_tests( "${CUR_FOLDER}/*.pass.cpp" ${child} ) + if( NOT WIN32 ) + add_fail_tests( "${CUR_FOLDER}/*.fail.cpp" ${child} ) + endif( ) + endif( ) +endforeach( ) diff --git a/compile_fail.sh b/compile_fail.sh index d418a24..60cf6b9 100755 --- a/compile_fail.sh +++ b/compile_fail.sh @@ -1,10 +1,10 @@ #!/bin/bash export TEST_BIN_NAME=$1 -echo "Building ${TEST_BIN_NAME}" +#echo "Building ${TEST_BIN_NAME}" shift 1 export BUILD_COMMAND=$@ -echo "Build command: ${BUILD_COMMAND}" -eval ${BUILD_COMMAND} #>/dev/null 2>/dev/null +#echo "Build command: ${BUILD_COMMAND}" +eval ${BUILD_COMMAND} >/dev/null 2>/dev/null if [ $? -eq 0 ]; then echo -ne "#!/bin/bash\nexit 1;" > ${TEST_BIN_NAME}