Commit 7dbfaebf authored by Houtan Bastani's avatar Houtan Bastani
Browse files

test suite parallelization

parent fef18460
......@@ -28,6 +28,9 @@ missing
ylwrap
ar-lib
# Make Check Rules
*.trs
# Doc rules
*.pdf
*.aux
......
MODFILES = \
estimation/fs2000_mc4.mod \
estimation/fs2000_mc4_mf.mod \
estimation/fs2000_mc6.mod \
estimation/fs2000_mc6_mf.mod \
gsa/ls2003.mod \
ramst.mod \
ramst_a.mod \
example1.mod \
......@@ -96,7 +101,6 @@ MODFILES = \
external_function/example1_no_deriv_functions_provided.mod \
external_function/example1_no_deriv_functions_provided_dll.mod \
seeds.mod \
gsa/ls2003.mod \
identification/kim/kim2.mod \
identification/as2007/as2007.mod \
simul/example1.mod \
......@@ -142,21 +146,72 @@ MODFILES = \
deterministic_simulations/rbc_det4.mod \
deterministic_simulations/rbc_det5.mod \
fs2000/fs2000_sd.mod \
walsh.mod \
estimation/fs2000_mc4.mod \
estimation/fs2000_mc4_mf.mod \
estimation/fs2000_mc6.mod \
estimation/fs2000_mc6_mf.mod
walsh.mod
# Dependencies
example1_use_dll.m.trs: example1.m.trs
example1_use_dll.o.trs: example1.o.trs
k_order_perturbation/fs2000k_1_m.m.trs: k_order_perturbation/fs2000k2_m.m.trs
k_order_perturbation/fs2000k2_m.m.trs k_order_perturbation/fs2000k3_m.m.trs k_order_perturbation/fs2000k2_use_dll.m.trs k_order_perturbation/fs2000k3_use_dll.m.trs: k_order_perturbation/fs2000k2a.m.trs
k_order_perturbation/fs2000k_1_use_dll.m.trs: k_order_perturbation/fs2000k2_use_dll.m.trs
k_order_perturbation/fs2000k4.m.trs: k_order_perturbation/fs2000k++.m.trs
k_order_perturbation/fs2000k_1_m.o.trs: k_order_perturbation/fs2000k2_m.o.trs
k_order_perturbation/fs2000k2_m.o.trs k_order_perturbation/fs2000k3_m.o.trs k_order_perturbation/fs2000k2_use_dll.o.trs k_order_perturbation/fs2000k3_use_dll.o.trs: k_order_perturbation/fs2000k2a.o.trs
k_order_perturbation/fs2000k_1_use_dll.o.trs: k_order_perturbation/fs2000k2_use_dll.o.trs
k_order_perturbation/fs2000k4.o.trs: k_order_perturbation/fs2000k++.o.trs
kalman_filter_smoother/algo1.m.trs kalman_filter_smoother/algo3.m.trs kalman_filter_smoother/algo4a.m.trs kalman_filter_smoother/algo4b.m.trs kalman_filter_smoother/algoH1.m.trs kalman_filter_smoother/algoH3.m.trs kalman_filter_smoother/fs2000.m.trs kalman_filter_smoother/fs2000_1.m.trs kalman_filter_smoother/fs2000_2.m.trs kalman_filter_smoother/fs2000a.m.trs: kalman_filter_smoother/gen_data.m.trs
kalman_filter_smoother/algo1.o.trs kalman_filter_smoother/algo3.o.trs kalman_filter_smoother/algo4a.o.trs kalman_filter_smoother/algo4b.o.trs kalman_filter_smoother/algoH1.o.trs kalman_filter_smoother/algoH3.o.trs kalman_filter_smoother/fs2000.o.trs kalman_filter_smoother/fs2000_1.o.trs kalman_filter_smoother/fs2000_2.o.trs kalman_filter_smoother/fs2000a.o.trs: kalman_filter_smoother/gen_data.o.trs
kalman_filter_smoother/algo2.m.trs: kalman_filter_smoother/algo1.m.trs
kalman_filter_smoother/algo2.o.trs: kalman_filter_smoother/algo1.o.trs
kalman_filter_smoother/algoH2.m.trs: kalman_filter_smoother/algoH1.m.trs
kalman_filter_smoother/algoH2.o.trs: kalman_filter_smoother/algoH1.o.trs
kalman_filter_smoother/algo4.m.trs: kalman_filter_smoother/algo3.m.trs
kalman_filter_smoother/algo4.o.trs: kalman_filter_smoother/algo3.o.trs
optimal_policy/nk_ramsey_expectation_a.m.trs: optimal_policy/nk_ramsey_expectation.m.trs
optimal_policy/nk_ramsey_expectation_a.o.trs: optimal_policy/nk_ramsey_expectation.o.trs
second_order/ds2.m.trs: second_order/ds1.m.trs
second_order/ds2.o.trs: second_order/ds1.o.trs
AIM/fs2000_b1L1L_AIM.m.trs: AIM/fs2000_b1L1L.m.trs
AIM/fs2000x10L9_L_AIM.m.trs: AIM/fs2000x10L9_L.m.trs
AIM/fs2000x10_L9_L_AIM.m.trs: AIM/fs2000x10_L9_L.m.trs
AIM/ls2003_2L0L_AIM.m.trs: AIM/ls2003_2L0L.m.trs
AIM/ls2003_2L2L_AIM.m.trs: AIM/ls2003_2L2L.m.trs
AIM/fs2000_b1L1L_AIM.o.trs: AIM/fs2000_b1L1L.o.trs
AIM/fs2000x10L9_L_AIM.o.trs: AIM/fs2000x10L9_L.o.trs
AIM/fs2000x10_L9_L_AIM.o.trs: AIM/fs2000x10_L9_L.o.trs
AIM/ls2003_2L0L_AIM.o.trs: AIM/ls2003_2L0L.o.trs
AIM/ls2003_2L2L_AIM.o.trs: AIM/ls2003_2L2L.o.trs
# Matlab TRS Files
MTRSFILES = $(patsubst %.mod, %.m.trs, $(MODFILES))
MTRSFILES += run_block_byte_tests_matlab.m.trs
# Octave TRS Files
OTRSFILES = $(patsubst %.mod, %.o.trs, $(MODFILES))
OTRSFILES += run_block_byte_tests_octave.o.trs
EXTRA_DIST = \
read_trs_files.sh \
run_test_matlab.m \
run_test_octave.m \
$(MODFILES) \
run_block_byte_tests_matlab.m \
run_block_byte_tests_octave.m \
homotopy/common.mod \
block_bytecode/ls2003.mod \
fs2000_ssfile_aux.m \
printMakeCheckMatlabErrMsg.m \
printMakeCheckOctaveErrMsg.m \
ramst_initval_file_data.m \
run_test_matlab.m \
run_test_octave.m \
test.m \
AIM/data_ca1.m \
AIM/fs2000_b1L1L_AIM_steadystate.m \
......@@ -213,13 +268,44 @@ endif
check-local: $(TARGETS)
check-matlab:
DYNARE_VERSION="$(PACKAGE_VERSION)" MODFILES="$(MODFILES)" $(MATLAB)/bin/matlab -nodesktop -nosplash -r run_test_matlab
if HAVE_OCTAVE
./read_trs_files.sh "$(OTRSFILES)"
endif
if HAVE_CMD_LINE_MATLAB
./read_trs_files.sh "$(MTRSFILES)"
endif
@cat run_test_matlab_output.txt
@cat run_test_octave_output.txt
check-matlab: $(MTRSFILES)
@echo 'Matlab Tests Done'
check-octave: $(OTRSFILES)
@echo 'Octave Tests Done'
check-octave:
DYNARE_VERSION="$(PACKAGE_VERSION)" MODFILES="$(MODFILES)" $(OCTAVE) --no-init-file --silent --no-history run_test_octave.m
%.m.trs %.m.log: %.mod
DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -logfile $*.m.log -r run_test_matlab
%.m.trs %.m.log : %.m
DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" \
$(MATLAB)/bin/matlab -nosplash -nodisplay -logfile $*.m.log -r $*
%.o.trs %.o.log: %.mod
DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" FILESTEM="$*" \
$(OCTAVE) --no-init-file --silent --no-history run_test_octave.m > $*.o.log 2>&1
%.o.trs %.o.log : %.m
DYNARE_VERSION="$(PACKAGE_VERSION)" TOP_TEST_DIR="$(PWD)" \
$(OCTAVE) --no-init-file --silent --no-history $< > $*.o.log 2>&1
clean-local:
rm -f $(MTRSFILES) \
$(OTRSFILES) \
$(patsubst %.trs, %.log, $(MTRSFILES)) \
$(patsubst %.trs, %.log, $(OTRSFILES))
rm -f $(patsubst %.mod, %.m, $(MODFILES)) \
$(patsubst %.mod, %_static.*, $(MODFILES)) \
$(patsubst %.mod, %_objective_static.m, $(MODFILES)) \
......
#!/bin/bash
declare -i total=0;
declare -i failed=0;
declare -a failed_tests=("");
# Parse TRS Files
for file in $1 ; do
# Find number of tests run in trs file
((total += `grep number-tests $file | cut -d: -f3`))
# Find number of tests failed in trs file
numfailed=`grep number-failed-tests $file | cut -d: -f3`
if [ $numfailed -ne 0 ] ; then
((failed += $numfailed))
for failedfile in `grep list-of-failed-tests $file | cut -d: -f3` ; do
failed_tests=("${failed_tests[@]}" "$failedfile");
done
fi
done
((passed=$total-$failed));
# Determine if we are parsing Matlab or Octave trs files
if [ `grep -c '.m.trs' <<< $1` -eq 0 ]; then
prg='OCTAVE';
outfile='run_test_octave_output.txt'
else
prg='MATLAB';
outfile='run_test_matlab_output.txt'
fi
# Print Output
echo '================================' > $outfile
echo 'DYNARE MAKE CHECK '$prg' RESULTS' >> $outfile
echo '================================' >> $outfile
echo '| TOTAL: '$total >> $outfile
echo '| PASS: '$passed >> $outfile
echo '| FAIL: '$failed >> $outfile
if [ $failed -gt 0 ] ; then
echo '| LIST OF FAILED TESTS:' >> $outfile
for file in ${failed_tests[@]} ; do
if [ "$prg" == "MATLAB" ]; then
modfile=`sed 's/\.m\.trs/\.mod/g' <<< $file` >> $outfile
else
modfile=`sed 's/\.o\.trs/\.mod/g' <<< $file` >> $outfile
fi
echo '| * '$modfile >> $outfile
done
fi
echo >> $outfile
% Copyright (C) 2011-2012 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Implementation notes:
%
% 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
% Dynare does a 'clear -all'). Also note that we 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');
addpath(top_test_dir);
addpath([top_test_dir filesep '..' filesep 'matlab']);
% Test Dynare Version
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
error('Incorrect version of Dynare is being tested')
end
% Test block_bytecode/ls2003.mod with various combinations of
% block/bytecode/solve_algo/stack_solve_algo
failedBlock = {};
num_block_tests = 0;
cd([top_test_dir filesep 'block_bytecode']);
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
for blockFlag = 0:1
for bytecodeFlag = 0:1
default_solve_algo = 2;
default_stack_solve_algo = 0;
if ~blockFlag && ~bytecodeFlag
solve_algos = 1:4;
stack_solve_algos = [0 6];
elseif blockFlag && ~bytecodeFlag
solve_algos = [1:4 6:8];
stack_solve_algos = 0:4;
else
solve_algos = 1:8;
stack_solve_algos = 0:5;
end
if has_optimization_toolbox
solve_algos = [ solve_algos 0 ];
end
for i = 1:length(solve_algos)
num_block_tests = num_block_tests + 1;
if ~blockFlag && ~bytecodeFlag && (i == 1)
% This is the reference simulation path against which all
% other simulations will be tested
try
old_path = path;
save wsMat
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
load wsMat
path(old_path);
y_ref = oo_.endo_simul;
save('test.mat','y_ref');
catch exception
load wsMat
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
clear exception
end
else
try
old_path = path;
save wsMat
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
load wsMat
path(old_path);
% Test against the reference simulation path
load('test.mat','y_ref');
diff = oo_.endo_simul - y_ref;
if(abs(diff) > options_.dynatol.x)
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
exception = MException('ERROR: simulation path differs from the reference path');
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
clear exception
end
catch exception
load wsMat
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
clear exception
end
end
end
for i = 1:length(stack_solve_algos)
num_block_tests = num_block_tests + 1;
try
old_path = path;
save wsMat
run_ls2003(blockFlag, bytecodeFlag, default_solve_algo, stack_solve_algos(i))
load wsMat
path(old_path);
% Test against the reference simulation path
load('test.mat','y_ref');
diff = oo_.endo_simul - y_ref;
if(abs(diff) > options_.dynatol.x)
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
exception = MException('ERROR: simulation path difers from the reference path');
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
clear exception
end
catch exception
load wsMat
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
printMakeCheckMatlabErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], exception);
clear exception
end
end
end
end
delete('wsMat.mat')
cd(getenv('TOP_TEST_DIR'));
fid = fopen('run_block_byte_tests_matlab.m.trs', 'w+');
if size(failedBlock,2) > 0
fprintf(fid,':test-result: FAIL\n');
fprintf(fid,':number-tests: %d\n', num_block_tests);
fprintf(fid,':number-failed-tests: %d\n', size(failedBlock,2));
fprintf(fid,':list-of-failed-tests: %s\n', failedBlock{:});
fprintf(fid,':copy-in-global-log: yes\n');
fprintf(fid,':recheck: yes\n');
fprintf(fid,':test-global-result: FAIL\n');
else
fprintf(fid,':test-result: PASS\n');
fprintf(fid,':number-tests: %d\n', num_block_tests);
fprintf(fid,':number-failed-tests: 0\n');
fprintf(fid,':list-of-failed-tests: \n');
fprintf(fid,':copy-in-global-log: no\n');
fprintf(fid,':recheck: no\n');
fprintf(fid,':test-global-result: PASS\n');
end
fclose(fid);
exit;
## Copyright (C) 2009-2012 Dynare Team
##
## This file is part of Dynare.
##
## Dynare is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## Dynare is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Dynare. If not, see <http://www.gnu.org/licenses/>.
## Implementation notes:
##
## Before every call to Dynare, the contents of the workspace is saved in
## 'wsOct', and reloaded after Dynare has finished (this is necessary since
## Dynare does a 'clear -all').
top_test_dir = getenv('TOP_TEST_DIR');
addpath(top_test_dir);
addpath([top_test_dir filesep '..' filesep 'matlab']);
## Test Dynare Version
if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
error("Incorrect version of Dynare is being tested")
endif
## Ask gnuplot to create graphics in text mode
## Note that setenv() was introduced in Octave 3.0.2, for compatibility
## with MATLAB
putenv("GNUTERM", "dumb")
## Test block_bytecode/ls2003.mod with various combinations of
## block/bytecode/solve_algo/stack_solve_algo
failedBlock = {};
num_block_tests = 0;
cd([top_test_dir filesep 'block_bytecode']);
for blockFlag = 0:1
for bytecodeFlag = 0:1
## Recall that solve_algo=7 and stack_solve_algo=2 are not supported
## under Octave
default_solve_algo = 2;
default_stack_solve_algo = 0;
if !blockFlag && !bytecodeFlag
solve_algos = 0:4;
stack_solve_algos = [0 6];
elseif blockFlag && !bytecodeFlag
solve_algos = [0:4 6 8];
stack_solve_algos = [0 1 3 4];
else
solve_algos = [0:6 8];
stack_solve_algos = [0 1 3:5];
endif
sleep(1) # Workaround for strange race condition related to the _static.m file
for i = 1:length(solve_algos)
num_block_tests = num_block_tests + 1;
if !blockFlag && !bytecodeFlag && (i == 1)
## This is the reference simulation path against which all
## other simulations will be tested
try
old_path = path;
save wsOct
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
load wsOct
path(old_path);
y_ref = oo_.endo_simul;
save('test.mat','y_ref');
catch
load wsOct
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
end_try_catch
else
try
old_path = path;
save wsOct
run_ls2003(blockFlag, bytecodeFlag, solve_algos(i), default_stack_solve_algo)
load wsOct
path(old_path);
## Test against the reference simulation path
load('test.mat','y_ref');
diff = oo_.endo_simul - y_ref;
if(abs(diff) > options_.dynatol.x)
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
differr.message = ["ERROR: simulation path differs from the reference path" ];
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], differr);
endif
catch
load wsOct
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
end_try_catch
endif
endfor
for i = 1:length(stack_solve_algos)
num_block_tests = num_block_tests + 1;
try
old_path = path;
save wsOct
run_ls2003(blockFlag, bytecodeFlag, default_solve_algo, stack_solve_algos(i))
load wsOct
path(old_path);
## Test against the reference simulation path
load('test.mat','y_ref');
diff = oo_.endo_simul - y_ref;
if(abs(diff) > options_.dynatol.x)
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
differr.message = ["ERROR: simulation path differs from the reference path" ];
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], differr);
endif
catch
load wsOct
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'];
printMakeCheckOctaveErrMsg(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(bytecodeFlag) ',' num2str(solve_algos(i)) ',' num2str(default_stack_solve_algo) ')'], lasterror);
end_try_catch
endfor
endfor
endfor
delete('wsOct');
cd(getenv('TOP_TEST_DIR'));
fid = fopen('run_block_byte_tests_octave.o.trs', 'w+');
if size(failedBlock,2) > 0
fprintf(fid,':test-result: FAIL\n');
fprintf(fid,':number-tests: %d\n', num_block_tests);
fprintf(fid,':number-failed-tests: %d\n', size(failedBlock,2));
fprintf(fid,':list-of-failed-tests: %s\n', failedBlock{:});
fprintf(fid,':copy-in-global-log: yes\n');
fprintf(fid,':recheck: yes\n');
fprintf(fid,':test-global-result: FAIL\n');
else
fprintf(fid,':test-result: PASS\n');
fprintf(fid,':number-tests: %d\n', num_block_tests);
fprintf(fid,':number-failed-tests: 0\n');
fprintf(fid,':list-of-failed-tests: \n');
fprintf(fid,':copy-in-global-log: no\n');
fprintf(fid,':recheck: no\n');
fprintf(fid,':test-global-result: PASS\n');
end
fclose(fid);
## Local variables:
## mode: Octave
## End:
......@@ -15,17 +15,9 @@
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Implementation notes:
%
% 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
% Dynare does a 'clear -all'). Also note that we 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 = pwd;
top_test_dir = getenv('TOP_TEST_DIR');
addpath(top_test_dir);
addpath([top_test_dir '/../matlab']);
addpath([top_test_dir filesep '..' filesep 'matlab']);
% Test Dynare Version
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
......@@ -33,171 +25,44 @@ if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
end
% Test MOD files listed in Makefile.am
name=getenv('MODFILES');
num_modfiles = 0;
failedBase = {};
[modfile, name] = strtok(getenv('FILESTEM'));
[directory, testfile, ext] = fileparts([top_test_dir '/' modfile]);
cd(directory);
while ~isempty(name)
[modfile, name] = strtok(name);
num_modfiles = num_modfiles + 1;
[directory, testfile, ext] = fileparts([top_test_dir '/' modfile]);
cd(directory);
disp('');
disp(['*** TESTING: ' modfile ' ***']);
try
old_path = path;
save wsMat
dynare([testfile ext],'console')
clear -all
load wsMat
path(old_path);
catch exception
clear -all
load wsMat
path(old_path);
failedBase{size(failedBase,2)+1} = modfile;
printMakeCheckMatlabErrMsg(modfile, exception);
clear exception
end
close all
delete('wsMat.mat')
cd(top_test_dir);
disp('');
disp(['*** TESTING: ' modfile ' ***']);
try
dynare([testfile ext], 'console')
testFailed = false;
catch exception
printMakeCheckMatlabErrMsg(strtok(getenv('FILESTEM')), exception);
testFailed = true;
end
% Test block_bytecode/ls2003.mod with various combinations of
% block/bytecode/solve_algo/stack_solve_algo
failedBlock = {};
num_block_tests = 0;
cd([top_test_dir '/block_bytecode']);
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
for blockFlag = 0:1
for bytecodeFlag = 0:1
default_solve_algo = 2;
default_stack_solve_algo = 0;
if ~blockFlag && ~bytecodeFlag
solve_algos = 1:4;
stack_solve_algos = [0 6];
elseif blockFlag && ~bytecodeFlag
solve_algos = [1:4 6:8];
stack_solve_algos = 0:4;
else
solve_algos = 1:8;
stack_solve_algos = 0:5;
end
if has_optimization_toolbox
solve_algos = [ solve_algos 0 ];
end
for i = 1:length(solve_algos)
num_block_tests = num_block_tests + 1;
if ~blockFlag && ~bytecodeFlag && (i == 1)
% This is the reference simulation path against which all
% other simulations will be tested
try