diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f21aba7a..ecb33349 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,7 +24,7 @@ test-asan: ASAN_OPTIONS: 'detect_leaks=0' # AddressSanitizer adds some extra symbols so we expect a failure from # the external symbols test. - XFAIL_TESTS: test_external_symbols.sh + XFAIL_TESTS: test_external_symbols #test-tsan: # <<: *test-template diff --git a/CMakeLists.txt b/CMakeLists.txt index 280842fa..e1fd46a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,11 +142,32 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/greatest/greatest.h") endif() if(NOT DEFINED MSVC) - add_test( NAME external_symbols COMMAND ${PROJECT_SOURCE_DIR}/tests/test_external_symbols.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) - add_test( NAME test_intra COMMAND ${PROJECT_SOURCE_DIR}/tests/test_intra.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) - add_test( NAME test_invalid_input COMMAND ${PROJECT_SOURCE_DIR}/tests/test_invalid_input.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) - add_test( NAME test_monochrome COMMAND ${PROJECT_SOURCE_DIR}/tests/test_monochrome.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) - add_test( NAME test_lmcs COMMAND ${PROJECT_SOURCE_DIR}/tests/test_lmcs.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) - add_test( NAME test_tools COMMAND ${PROJECT_SOURCE_DIR}/tests/test_tools.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) - add_test( NAME test_slices COMMAND ${PROJECT_SOURCE_DIR}/tests/test_slices.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + + # Disable tests in XFAIL_TESTS env, usage: `XFAIL_TESTS="test_intra;test_external_symbols" cmake .` + list(APPEND XFAIL "off") + if(DEFINED ENV{XFAIL_TESTS}) + list(APPEND XFAIL $ENV{XFAIL_TESTS}) + endif() + + if(NOT "test_external_symbols" IN_LIST XFAIL) + add_test( NAME test_external_symbols COMMAND ${PROJECT_SOURCE_DIR}/tests/test_external_symbols.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() + if(NOT "test_intra" IN_LIST XFAIL) + add_test( NAME test_intra COMMAND ${PROJECT_SOURCE_DIR}/tests/test_intra.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() + if(NOT "test_invalid_input" IN_LIST XFAIL) + add_test( NAME test_invalid_input COMMAND ${PROJECT_SOURCE_DIR}/tests/test_invalid_input.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() + if(NOT "test_monochrome" IN_LIST XFAIL) + add_test( NAME test_monochrome COMMAND ${PROJECT_SOURCE_DIR}/tests/test_monochrome.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() + if(NOT "test_lmcs" IN_LIST XFAIL) + add_test( NAME test_lmcs COMMAND ${PROJECT_SOURCE_DIR}/tests/test_lmcs.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() + if(NOT "test_tools" IN_LIST XFAIL) + add_test( NAME test_tools COMMAND ${PROJECT_SOURCE_DIR}/tests/test_tools.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() + if(NOT "test_slices" IN_LIST XFAIL) + add_test( NAME test_slices COMMAND ${PROJECT_SOURCE_DIR}/tests/test_slices.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests) + endif() endif() \ No newline at end of file