From 340b2a1a47244cba064c17b69782236c0d7e16e5 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 17 Dec 2021 13:30:39 +0100 Subject: [PATCH] CMake: Fix exit code to be shown properly on test failure The result variable was expanded at configure time rather than at script execution time due to missing escaping. A tidbit of information, the result variable can contain not only an exit code, but a string as well. For example on arm macOS with a crashed test it contains 'SIGTRAP'. Curiously if the crashing executable is executed directly without CMake, 'Trace/BPT trap: 5' is shown instead, perhaps because of the shell. Amends 3ef6af024be43bc18352796df61542a241192583 Pick-to: 6.2 6.3 Change-Id: I50e57922abfc6eccde205c6252eebfda510bad41 Reviewed-by: Fabian Kosmale --- cmake/QtTestHelpers.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 5b73efdfeb0..58742537aa3 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -577,7 +577,7 @@ execute_process(COMMAND ${extra_runner} ${arg_COMMAND} ${post_run} if(NOT result EQUAL 0) string(JOIN \" \" full_command ${arg_COMMAND}) - message(FATAL_ERROR \"\${full_command} execution failed with exit code ${result}.\") + message(FATAL_ERROR \"\${full_command} execution failed with exit code \${result}.\") endif()" ) endfunction()