Testsuite: run_block_byte_tests_{matlab,octave}.m were not actually checking the results
parent
65e18fe883
commit
e49cada341
|
@ -19,9 +19,13 @@
|
||||||
%
|
%
|
||||||
% Before every call to Dynare, the contents of the workspace is saved in
|
% Before every call to Dynare, the contents of the workspace is saved in
|
||||||
% 'wsMat.mat', and reloaded after Dynare has finished (this is necessary since
|
% 'wsMat.mat', and reloaded after Dynare has finished (this is necessary since
|
||||||
% Dynare does a 'clear -all'). Also note that we take care of clearing the
|
% Dynare does a 'clear -all').
|
||||||
% 'exception' variable in all 'catch' block, because otherwise the next 'load
|
% Note that we take care of clearing oo_ before saving the workspace,
|
||||||
% wsMat' within a 'catch' block will overwrite the last exception.
|
% otherwise the newly created oo_ will be scratched upon loading,
|
||||||
|
% thus making the path comparison bogus.
|
||||||
|
% We also take care of clearing the 'exception' variable in all 'catch'
|
||||||
|
% block, because otherwise the next 'load wsMat' within a 'catch' block will
|
||||||
|
% overwrite the last exception.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
top_test_dir = getenv('TOP_TEST_DIR');
|
||||||
addpath([top_test_dir filesep 'utils']);
|
addpath([top_test_dir filesep 'utils']);
|
||||||
|
@ -80,6 +84,7 @@ for blockFlag = 0:1
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
old_path = path;
|
old_path = path;
|
||||||
|
clear oo_ % Ensure that oo_.endo_simul won’t be overwritten when loading wsMat
|
||||||
save wsMat
|
save wsMat
|
||||||
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
||||||
load wsMat
|
load wsMat
|
||||||
|
@ -87,9 +92,9 @@ for blockFlag = 0:1
|
||||||
% Test against the reference simulation path
|
% Test against the reference simulation path
|
||||||
load('test.mat','y_ref');
|
load('test.mat','y_ref');
|
||||||
diff = oo_.endo_simul - y_ref;
|
diff = oo_.endo_simul - y_ref;
|
||||||
if abs(diff) > options_.dynatol.x
|
if max(max(abs(diff))) > options_.dynatol.x
|
||||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||||
exception = MException('ERROR: simulation path differs from the reference path');
|
exception = MException('Dynare:simerr', 'ERROR: simulation path differs from the reference path');
|
||||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
|
||||||
clear exception
|
clear exception
|
||||||
end
|
end
|
||||||
|
@ -106,6 +111,7 @@ for blockFlag = 0:1
|
||||||
num_block_tests = num_block_tests + 1;
|
num_block_tests = num_block_tests + 1;
|
||||||
try
|
try
|
||||||
old_path = path;
|
old_path = path;
|
||||||
|
clear oo_ % Ensure that oo_.endo_simul won’t be overwritten when loading wsMat
|
||||||
save wsMat
|
save wsMat
|
||||||
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
|
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
|
||||||
load wsMat
|
load wsMat
|
||||||
|
@ -113,9 +119,9 @@ for blockFlag = 0:1
|
||||||
% Test against the reference simulation path
|
% Test against the reference simulation path
|
||||||
load('test.mat','y_ref');
|
load('test.mat','y_ref');
|
||||||
diff = oo_.endo_simul - y_ref;
|
diff = oo_.endo_simul - y_ref;
|
||||||
if abs(diff) > options_.dynatol.x
|
if max(max(abs(diff))) > options_.dynatol.x
|
||||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||||
exception = MException('ERROR: simulation path difers from the reference path');
|
exception = MException('Dynare:simerr', 'ERROR: simulation path difers from the reference path');
|
||||||
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
|
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
|
||||||
clear exception
|
clear exception
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
## Before every call to Dynare, the contents of the workspace is saved in
|
## Before every call to Dynare, the contents of the workspace is saved in
|
||||||
## 'wsOct', and reloaded after Dynare has finished (this is necessary since
|
## 'wsOct', and reloaded after Dynare has finished (this is necessary since
|
||||||
## Dynare does a 'clear -all').
|
## Dynare does a 'clear -all').
|
||||||
|
## Note that we take care of clearing oo_ before saving the workspace,
|
||||||
|
## otherwise the newly created oo_ will be scratched upon loading,
|
||||||
|
## thus making the path comparison bogus.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
top_test_dir = getenv('TOP_TEST_DIR');
|
||||||
addpath([top_test_dir filesep 'utils']);
|
addpath([top_test_dir filesep 'utils']);
|
||||||
|
@ -53,7 +56,7 @@ for blockFlag = 0:1
|
||||||
|
|
||||||
# Workaround for strange race condition related to the static/dynamic
|
# Workaround for strange race condition related to the static/dynamic
|
||||||
# files (especially when we switch to/from use_dll)
|
# files (especially when we switch to/from use_dll)
|
||||||
rmdir('+ls2003_tmp', 's')
|
rmdir('+ls2003_tmp', 's');
|
||||||
pause(1)
|
pause(1)
|
||||||
|
|
||||||
for i = 1:length(solve_algos)
|
for i = 1:length(solve_algos)
|
||||||
|
@ -78,6 +81,7 @@ for blockFlag = 0:1
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
old_path = path;
|
old_path = path;
|
||||||
|
clear oo_ # Ensure that oo_.endo_simul won’t be overwritten when loading wsOct
|
||||||
save wsOct
|
save wsOct
|
||||||
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
run_ls2003(blockFlag, storageFlag, solve_algos(i), default_stack_solve_algo)
|
||||||
load wsOct
|
load wsOct
|
||||||
|
@ -85,7 +89,7 @@ for blockFlag = 0:1
|
||||||
## Test against the reference simulation path
|
## Test against the reference simulation path
|
||||||
load('test.mat','y_ref');
|
load('test.mat','y_ref');
|
||||||
diff = oo_.endo_simul - y_ref;
|
diff = oo_.endo_simul - y_ref;
|
||||||
if abs(diff) > options_.dynatol.x
|
if max(max(abs(diff))) > options_.dynatol.x
|
||||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
|
||||||
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
||||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], differr);
|
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], differr);
|
||||||
|
@ -102,6 +106,7 @@ for blockFlag = 0:1
|
||||||
num_block_tests = num_block_tests + 1;
|
num_block_tests = num_block_tests + 1;
|
||||||
try
|
try
|
||||||
old_path = path;
|
old_path = path;
|
||||||
|
clear oo_ # Ensure that oo_.endo_simul won’t be overwritten when loading wsOct
|
||||||
save wsOct
|
save wsOct
|
||||||
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
|
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
|
||||||
load wsOct
|
load wsOct
|
||||||
|
@ -109,7 +114,7 @@ for blockFlag = 0:1
|
||||||
## Test against the reference simulation path
|
## Test against the reference simulation path
|
||||||
load('test.mat','y_ref');
|
load('test.mat','y_ref');
|
||||||
diff = oo_.endo_simul - y_ref;
|
diff = oo_.endo_simul - y_ref;
|
||||||
if abs(diff) > options_.dynatol.x
|
if max(max(abs(diff))) > options_.dynatol.x
|
||||||
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
|
||||||
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
differr.message = ["ERROR: simulation path differs from the reference path" ];
|
||||||
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], differr);
|
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], differr);
|
||||||
|
|
Loading…
Reference in New Issue