summaryrefslogtreecommitdiffstats
path: root/Modules/MatlabTestsRedirect.cmake
diff options
context:
space:
mode:
authorClemens Buchacher <clemens.buchacher@iis.fraunhofer.de>2017-02-24 15:05:05 (GMT)
committerRaffi Enficiaud <raffi.enficiaud@free.fr>2018-04-09 19:42:18 (GMT)
commit44c916b4c831f1e81d3cc686ddb030e363b7e90b (patch)
tree50fdffe1a52d54b32a3aea748d283ccd5073830a /Modules/MatlabTestsRedirect.cmake
parent23a450044d4d5b3cb314085daf8c42e657b4e132 (diff)
downloadCMake-44c916b4c831f1e81d3cc686ddb030e363b7e90b.zip
CMake-44c916b4c831f1e81d3cc686ddb030e363b7e90b.tar.gz
CMake-44c916b4c831f1e81d3cc686ddb030e363b7e90b.tar.bz2
FindMatlab: always handle uncaught exception
If runtests('$unittest_file') throws an exception it is ignored. It is easy to produce such an exception by passing a nonexistent file as UNITTEST_FILE. We already handle exceptions if the option NO_UNITTEST_FRAMEWORK is set. Use the same method to handle exceptions thrown by runtests or by a custom_Matlab_test_command. Fixes #16660.
Diffstat (limited to 'Modules/MatlabTestsRedirect.cmake')
-rw-r--r--Modules/MatlabTestsRedirect.cmake5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake
index 64d580d..fc36fc3 100644
--- a/Modules/MatlabTestsRedirect.cmake
+++ b/Modules/MatlabTestsRedirect.cmake
@@ -55,11 +55,12 @@ endif()
if(no_unittest_framework)
- set(unittest_to_run "try, ${unittest_file_to_run_name}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)")
+ set(unittest_to_run "${unittest_file_to_run_name}")
endif()
+set(command_to_run "try, ${unittest_to_run}, catch err, disp('An exception has been thrown during the execution'), disp(err), disp(err.stack), exit(1), end, exit(0)")
set(Matlab_SCRIPT_TO_RUN
- "addpath(${concat_string}); ${cmd_to_run_before_test}; ${unittest_to_run}"
+ "addpath(${concat_string}); ${cmd_to_run_before_test}; ${command_to_run}"
)
# if the working directory is not specified then default
# to the output_directory because the log file will go there