| 1 |
function [status] = execute_plot_stage(defaultStatus, ipp) |
| 2 |
% plot a test figure |
| 3 |
testsuite = ipp.Results.testsuite; |
| 4 |
testNumber = defaultStatus.index; |
| 5 |
|
| 6 |
% open a window |
| 7 |
fig_handle = figure('visible',ipp.Results.figureVisible); |
| 8 |
errorHasOccurred = false; |
| 9 |
|
| 10 |
% plot the figure |
| 11 |
try |
| 12 |
status = testsuite(testNumber); |
| 13 |
|
| 14 |
catch %#ok |
| 15 |
e = lasterror('reset'); %#ok |
| 16 |
|
| 17 |
status.description = '\textcolor{red}{Error during plot generation.}'; |
| 18 |
[status.plotStage, errorHasOccurred] = errorHandler(e); |
| 19 |
|
| 20 |
% Automaticall mark the test as unreliable |
| 21 |
% |
| 22 |
% Since metadata is not set in this case, also stat.unreliable is |
| 23 |
% not returned. So ideally, we should |
| 24 |
% FIXME: implement #484 to get access to the meta data |
| 25 |
% but we can work around this issue by forcefully setting that value. |
| 26 |
% The rationale for setting this to true: |
| 27 |
% - the plot part is not the main task of M2T |
| 28 |
% (so breaking a single test is less severe in this case), |
| 29 |
% - if the plotting fails, the test is not really reliable anyway, |
| 30 |
% - this allows to get full green on Travis. |
| 31 |
status.unreliable = true; |
| 32 |
|
| 33 |
end |
| 34 |
|
| 35 |
status = fillStruct(status, defaultStatus); |
| 36 |
if isempty(status.function) |
| 37 |
allFuncs = testsuite(0); |
| 38 |
status.function = func2str(allFuncs{testNumber}); |
| 39 |
end |
| 40 |
status.plotStage.fig_handle = fig_handle; |
| 41 |
|
| 42 |
if status.skip || errorHasOccurred |
| 43 |
close(fig_handle); |
| 44 |
end |
| 45 |
end |