No longer hardwiring subfolders of test

Hid build errors on should fail tests
This commit is contained in:
Darrell Wright 2017-11-27 00:00:14 -05:00 committed by Howard Hinnant
parent 748a1fd5a9
commit 53629fa30c
2 changed files with 15 additions and 14 deletions

View File

@ -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" )
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( "${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" )
add_fail_tests( "${CUR_FOLDER}/*.fail.cpp" ${child} )
endif( )
endif( )
endforeach( )

View File

@ -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}