diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:32:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 03:32:49 +0000 |
commit | 8053187731ae8e3eb368d8360989cf5fd6eed9f7 (patch) | |
tree | 32bada84ff5d7460cdf3934fcbdbe770d6afe4cd /cmake/rnp_tests_discover.cmake | |
parent | Initial commit. (diff) | |
download | rnp-8053187731ae8e3eb368d8360989cf5fd6eed9f7.tar.xz rnp-8053187731ae8e3eb368d8360989cf5fd6eed9f7.zip |
Adding upstream version 0.17.0.upstream/0.17.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/rnp_tests_discover.cmake')
-rw-r--r-- | cmake/rnp_tests_discover.cmake | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cmake/rnp_tests_discover.cmake b/cmake/rnp_tests_discover.cmake new file mode 100644 index 0000000..9f05293 --- /dev/null +++ b/cmake/rnp_tests_discover.cmake @@ -0,0 +1,40 @@ +set(script) + +function(add_command NAME) + set(_args "") + foreach(_arg ${ARGN}) + set(_args "${_args} [==[${_arg}]==]") + endforeach() + set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE) +endfunction() + +if(NOT EXISTS "${TEST_EXECUTABLE}") + message(FATAL_ERROR "Executable does not exist: ${TEST_EXECUTABE}") +endif() +execute_process( + COMMAND "${TEST_EXECUTABLE}" list-tests + WORKING_DIRECTORY "${TEST_WORKING_DIR}" + OUTPUT_VARIABLE output + RESULT_VARIABLE result +) +if(NOT ${result} EQUAL 0) + message(FATAL_ERROR "Error running executable: ${TEST_EXECUTABE}") +endif() + +string(REPLACE "\n" ";" output "${output}") + +foreach(line ${output}) + set(test "${line}") + add_command(add_test + "rnp_tests-${test}" + "${TEST_EXECUTABLE}" + "${test}" + ) + add_command(set_tests_properties + "rnp_tests-${test}" + PROPERTIES ${TEST_PROPERTIES} + ) +endforeach() + +file(WRITE "${CTEST_FILE}" "${script}") + |