diff options
Diffstat (limited to 'libcr/CMakeLists.txt')
-rw-r--r-- | libcr/CMakeLists.txt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libcr/CMakeLists.txt b/libcr/CMakeLists.txt index fbc7618..7f18e17 100644 --- a/libcr/CMakeLists.txt +++ b/libcr/CMakeLists.txt @@ -14,3 +14,30 @@ target_link_libraries(libcr INTERFACE target_compile_options(libcr INTERFACE -fno-split-stack ) + +set(cfg_matrix + "CONFIG_COROUTINE_MEASURE_STACK;[0;1]" + "CONFIG_COROUTINE_PROTECT_STACK;[0;1]" + "CONFIG_COROUTINE_DEBUG;[0;1]" + "CONFIG_COROUTINE_VALGRIND;[0;1]" +) +function(add_libcr_matrix_test n defs) + add_executable("test_matrix${n}" "tests/test_matrix.c") + target_link_libraries("test_matrix${n}" "libcr") + target_include_directories("test_matrix${n}" PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_matrix) + target_compile_definitions("test_matrix${n}" PUBLIC "${defs}") + if ("CONFIG_COROUTINE_VALGRIND=1" IN_LIST defs) + add_test( + NAME "libcr/test_matrix${n}" + COMMAND valgrind --error-exitcode=2 "./test_matrix${n}" + ) + else() + add_test( + NAME "libcr/test_matrix${n}" + COMMAND "./test_matrix${n}" + ) + endif() +endfunction() +if (ENABLE_TESTS) + apply_matrix(add_libcr_matrix_test "${cfg_matrix}") +endif() |