Fixup catch_discover_tests

Fixed its use of removed `--list-test-names-only` switch, and also
updated the return code check to reflect changes in v3.

Closes #1933
This commit is contained in:
Martin Hořeňovský 2020-05-19 20:20:16 +02:00
parent 54882dbb11
commit 964303706a
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -29,16 +29,11 @@ if(NOT EXISTS "${TEST_EXECUTABLE}")
) )
endif() endif()
execute_process( execute_process(
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-tests --verbosity quiet
OUTPUT_VARIABLE output OUTPUT_VARIABLE output
RESULT_VARIABLE result RESULT_VARIABLE result
) )
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising if(NOT ${result} EQUAL 0)
if(${result} EQUAL 0)
message(WARNING
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
)
elseif(${result} LESS 0)
message(FATAL_ERROR message(FATAL_ERROR
"Error running test executable '${TEST_EXECUTABLE}':\n" "Error running test executable '${TEST_EXECUTABLE}':\n"
" Result: ${result}\n" " Result: ${result}\n"