Testsuite: add workaround for crash of MATLAB R2014a with TeX option

The TeX option crashes MATLAB R2014a run with "-nodisplay" option
(as is done from the testsuite). We disable the TeX option in that case.

Since we can’t directly test whether "-nodisplay" has been passed, we test for
the "TOP_TEST_DIR" environment variable, which is set by the testsuite.

Note that it was not tested whether the crash happens with more recent MATLAB
versions, so when OLD_MATLAB_VERSION is increased, one should make a test
before removing this workaround.
time-shift
Sébastien Villemot 2021-01-19 14:52:27 +01:00
parent 654da6ecb8
commit f946baf6c5
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
4 changed files with 61 additions and 4 deletions

View File

@ -12,7 +12,7 @@ function oo_recursive_=dynare_estimation(var_list,dname)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2003-2020 Dynare Team
% Copyright (C) 2003-2021 Dynare Team
%
% This file is part of Dynare.
%
@ -43,6 +43,19 @@ if ~isempty(strmatch('dsge_prior_weight',M_.param_names))
options_.dsge_var = 1;
end
% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
% (as is done from the testsuite).
% Since we cant directly test whether "-nodisplay" has been passed,
% we test for the "TOP_TEST_DIR" environment variable, which is set
% by the testsuite.
% Note that it was not tested whether the crash happens with more
% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
% one should make a test before removing this workaround.
if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
options_.TeX = false;
end
var_list = check_list_of_variables(options_, M_, var_list);
options_.varlist = var_list;

View File

@ -46,7 +46,7 @@ function [pdraws, STO_REDUCEDFORM, STO_MOMENTS, STO_DYNAMIC, STO_si_dDYNAMIC, ST
% * skipline
% * vnorm
% =========================================================================
% Copyright (C) 2010-2020 Dynare Team
% Copyright (C) 2010-2021 Dynare Team
%
% This file is part of Dynare.
%
@ -66,6 +66,19 @@ function [pdraws, STO_REDUCEDFORM, STO_MOMENTS, STO_DYNAMIC, STO_si_dDYNAMIC, ST
global M_ options_ oo_ bayestopt_ estim_params_
% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
% (as is done from the testsuite).
% Since we cant directly test whether "-nodisplay" has been passed,
% we test for the "TOP_TEST_DIR" environment variable, which is set
% by the testsuite.
% Note that it was not tested whether the crash happens with more
% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
% one should make a test before removing this workaround.
if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
options_.TeX = false;
end
store_options_ = options_; % store options to restore them at the end
fname = M_.fname; %model name
dname = M_.dname; %model name
@ -949,4 +962,4 @@ end
fprintf('\n==== Identification analysis completed ====\n\n')
options_ = store_options_; %restore options set
options_ = store_options_; %restore options set

View File

@ -94,6 +94,24 @@ function [oo_, options_mom_, M_] = method_of_moments(bayestopt_, options_, oo_,
% - [ ] improve check for duplicate moments by using the cellfun and unique functions
% - [ ] dirname option to save output to different directory not yet implemented
% - [ ] add analytic_jacobian option for mode_compute 4 and 101
% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
% (as is done from the testsuite).
% Since we cant directly test whether "-nodisplay" has been passed,
% we test for the "TOP_TEST_DIR" environment variable, which is set
% by the testsuite.
% Note that it was not tested whether the crash happens with more
% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
% one should make a test before removing this workaround.
if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
options_.TeX = false;
end
if isfield(options_mom_, 'TeX') && options_mom_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
options_mom_.TeX = false;
end
% -------------------------------------------------------------------------
% Step 0: Check if required structures and options exist
% -------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
function [info, oo_, options_, M_] = stoch_simul(M_, options_, oo_, var_list)
% Copyright (C) 2001-2020 Dynare Team
% Copyright (C) 2001-2021 Dynare Team
%
% This file is part of Dynare.
%
@ -22,6 +22,19 @@ if isequal(options_.order,0)
error('stoch_simul:: The order of the Taylor approximation cannot be 0!')
end
% The TeX option crashes MATLAB R2014a run with "-nodisplay" option
% (as is done from the testsuite).
% Since we cant directly test whether "-nodisplay" has been passed,
% we test for the "TOP_TEST_DIR" environment variable, which is set
% by the testsuite.
% Note that it was not tested whether the crash happens with more
% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased,
% one should make a test before removing this workaround.
if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('TOP_TEST_DIR'))
warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay')
options_.TeX = false;
end
if M_.exo_nbr==0
error('stoch_simul:: does not support having no varexo in the model. As a workaround you could define a dummy exogenous variable.')
end