Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 44c916b4 authored by Clemens Buchacher's avatar Clemens Buchacher Committed by Raffi Enficiaud
Browse files

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.
parent 23a45004
...@@ -55,11 +55,12 @@ endif() ...@@ -55,11 +55,12 @@ endif()
if(no_unittest_framework) 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() 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 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 # if the working directory is not specified then default
# to the output_directory because the log file will go there # to the output_directory because the log file will go there
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment