build system: change testing system

time-shift
Houtan Bastani 2011-03-28 18:46:53 +02:00
parent 5f04ed9db7
commit 4e9f5e023a
3 changed files with 188 additions and 128 deletions

View File

@ -1,121 +1,12 @@
.NOTPARALLEL: check-local
DYNARE_ROOT = $(abs_top_srcdir)/matlab
MODS = \
ramst.mod \
ramst_a.mod \
example1.mod \
example2.mod \
example1_use_dll.mod \
example1_with_tags.mod\
t_sgu_ex1.mod \
osr_example.mod \
optimal_policy/ramsey.mod \
optimal_policy/mult_elimination_test.mod \
discretionary_policy/dennis_1.mod \
ramst_initval_file.mod \
ramst_normcdf_and_friends.mod \
example1_varexo_det.mod \
predetermined_variables.mod \
fs2000_nonstationary.mod \
fs2000_ssfile.mod \
comments.mod \
histval_sto.mod \
histval_det.mod \
expectation.mod \
steady_state_operator/standard.mod \
steady_state_operator/use_dll.mod \
steady_state_operator/block.mod \
steady_state_operator/bytecode_test.mod \
block_bytecode/ireland.mod \
block_bytecode/ramst_normcdf_and_friends.mod \
k_order_perturbation/fs2000k2a.mod \
k_order_perturbation/fs2000k2_use_dll.mod \
k_order_perturbation/fs2000k_1_use_dll.mod \
k_order_perturbation/fs2000k3_use_dll.mod \
k_order_perturbation/fs2000k2_m.mod \
k_order_perturbation/fs2000k_1_m.mod \
k_order_perturbation/fs2000k3_m.mod \
partial_information/PItest3aHc0PCLsimModPiYrVarobsAll.mod \
partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR.mod \
arima/mod1.mod \
arima/mod1a.mod \
arima/mod1b.mod \
arima/mod1c.mod \
arima/mod2.mod \
arima/mod2a.mod \
arima/mod2b.mod \
arima/mod2c.mod \
fs2000/fs2000.mod \
fs2000/fs2000a.mod \
fs2000/fs2000c.mod \
homotopy/homotopy1_test.mod \
homotopy/homotopy2_test.mod \
homotopy/homotopy3_test.mod \
bvar_a_la_sims/bvar_standalone.mod \
bvar_a_la_sims/bvar_and_dsge.mod \
AIM/fs2000x10L9_L.mod \
AIM/fs2000x10L9_L_AIM.mod \
AIM/fs2000x10_L9_L.mod \
AIM/fs2000x10_L9_L_AIM.mod \
AIM/fs2000_b1L1L.mod \
AIM/fs2000_b1L1L_AIM.mod \
AIM/ls2003_2L0L.mod \
AIM/ls2003_2L0L_AIM.mod \
AIM/ls2003_2L2L.mod \
AIM/ls2003_2L2L_AIM.mod \
conditional_variance_decomposition/example1.mod \
dsge-var/simul_hybrid.mod \
dsge-var/dsgevar_forward_calibrated_lambda.mod \
dsge-var/dsgevar_forward_estimated_lambda.mod \
external_function/example1_1st_and_2nd_deriv_functions_provided.mod \
external_function/example1_1st_and_2nd_deriv_functions_provided_dll.mod \
external_function/example1_1st_deriv_function_provided.mod \
external_function/example1_1st_deriv_function_provided_dll.mod \
external_function/example1_no_deriv_functions_provided.mod \
external_function/example1_no_deriv_functions_provided_dll.mod \
seeds.mod \
simul/example1.mod
TESTS_ENVIRONMENT = \
$(OCTAVE) --norc --silent --no-history --path $(DYNARE_ROOT) --eval dynver=\"$(PACKAGE_VERSION)\"
EXTRA_DIST = $(MODS) \
run_test_octave.m \
block_bytecode/run_block_bytecode_tests.m \
block_bytecode/run_ls2003.m \
block_bytecode/ls2003.mod \
fs2000/fsdat_simul.m \
fs2000/fs2000a_steadystate.m \
identification/kim/kim2_steadystate.m \
identification/as2007/as2007_steadystate.m \
AIM/fs2000_b1L1L_steadystate.m \
AIM/fs2000_b1L1L_AIM_steadystate.m \
test.m \
objectives \
ramst_initval_file_data.m \
homotopy/common.mod \
bvar_a_la_sims/bvar_sample.m \
fs2000_ssfile_aux.m
TARGETS = check-matlab
if HAVE_OCTAVE
TARGETS += check-octave check-block-bytecode
endif
check-local: $(TARGETS)
check-octave: $(MODS)
@set -e; \
for modfile in $(MODS); do \
$(OCTAVE) --norc --silent --no-history run_test_octave.m $$modfile $(DYNARE_ROOT) $(PACKAGE_VERSION); \
done
.PHONY: check-octave
check-block-bytecode:
cd block_bytecode && $(OCTAVE) --norc --silent --no-history run_block_bytecode_tests.m $(DYNARE_ROOT) $(PACKAGE_VERSION)
.PHONY: check-block-bytecode
check-matlab: $(MODS)
# MATLAB stuff to be added here
.PHONY: check-matlab
TESTS = \
run_test_octave.m
clean-local:
rm -f $(patsubst %.mod, %.m, $(MODS)) \

View File

@ -21,7 +21,7 @@ function run_ls2003(block, bytecode, solve_algo, stack_solve_algo)
assert(fid > 0);
fprintf(fid, "@#define block = %d\n@#define bytecode = %d\n@#define solve_algo = %d\n@#define stack_solve_algo = %d\n@#include \"ls2003.mod\"\n", block, bytecode, solve_algo, stack_solve_algo)
fclose(fid);
dynare("ls2003_tmp.mod")
dynare("ls2003_tmp.mod","noclearall")
endfunction
## Local variables:

View File

@ -1,4 +1,4 @@
## Copyright (C) 2009 Dynare Team
## Copyright (C) 2009-2011 Dynare Team
##
## This file is part of Dynare.
##
@ -15,28 +15,197 @@
## You should have received a copy of the GNU General Public License
## along with Dynare. If not, see <http://www.gnu.org/licenses/>.
## First argument is MOD file (possibly with a path prefix)
## Second argument is path to Dynare installation to be checked
## Third argument is Dynare version to be checked
## Test Dynare Version
if !strcmp(dynare_version(), dynver)
error("Incorrect version of Dynare is being tested")
endif
## List of files to be tested
name = { ...
'ramst.mod' ...
'ramst_a.mod' ...
'example1.mod' ...
'example2.mod' ...
'example1_use_dll.mod' ...
'example1_with_tags.mod' ...
't_sgu_ex1.mod' ...
'osr_example.mod' ...
'optimal_policy/ramsey.mod' ...
'optimal_policy/mult_elimination_test.mod' ...
'discretionary_policy/dennis_1.mod' ...
'ramst_initval_file.mod' ...
'ramst_normcdf_and_friends.mod' ...
'example1_varexo_det.mod' ...
'predetermined_variables.mod' ...
'fs2000_nonstationary.mod' ...
'fs2000_ssfile.mod' ...
'comments.mod' ...
'histval_sto.mod' ...
'histval_det.mod' ...
'expectation.mod' ...
'steady_state_operator/standard.mod' ...
'steady_state_operator/use_dll.mod' ...
'steady_state_operator/block.mod' ...
'steady_state_operator/bytecode_test.mod' ...
'block_bytecode/ireland.mod' ...
'block_bytecode/ramst_normcdf_and_friends.mod' ...
'k_order_perturbation/fs2000k2a.mod' ...
'k_order_perturbation/fs2000k2_use_dll.mod' ...
'k_order_perturbation/fs2000k_1_use_dll.mod' ...
'k_order_perturbation/fs2000k3_use_dll.mod' ...
'k_order_perturbation/fs2000k2_m.mod' ...
'k_order_perturbation/fs2000k_1_m.mod' ...
'k_order_perturbation/fs2000k3_m.mod' ...
'partial_information/PItest3aHc0PCLsimModPiYrVarobsAll.mod' ...
'partial_information/PItest3aHc0PCLsimModPiYrVarobsCNR.mod' ...
'arima/mod1.mod' ...
'arima/mod1a.mod' ...
'arima/mod1b.mod' ...
'arima/mod1c.mod' ...
'arima/mod2.mod' ...
'arima/mod2a.mod' ...
'arima/mod2b.mod' ...
'arima/mod2c.mod' ...
'fs2000/fs2000.mod' ...
'fs2000/fs2000a.mod' ...
'fs2000/fs2000c.mod' ...
'homotopy/homotopy1_test.mod' ...
'homotopy/homotopy2_test.mod' ...
'homotopy/homotopy3_test.mod' ...
'bvar_a_la_sims/bvar_standalone.mod' ...
'bvar_a_la_sims/bvar_and_dsge.mod' ...
'AIM/fs2000x10L9_L.mod' ...
'AIM/fs2000x10L9_L_AIM.mod' ...
'AIM/fs2000x10_L9_L.mod' ...
'AIM/fs2000x10_L9_L_AIM.mod' ...
'AIM/fs2000_b1L1L.mod' ...
'AIM/fs2000_b1L1L_AIM.mod' ...
'AIM/ls2003_2L0L.mod' ...
'AIM/ls2003_2L0L_AIM.mod' ...
'AIM/ls2003_2L2L.mod' ...
'AIM/ls2003_2L2L_AIM.mod' ...
'conditional_variance_decomposition/example1.mod' ...
'dsge-var/simul_hybrid.mod' ...
'dsge-var/dsgevar_forward_calibrated_lambda.mod' ...
'dsge-var/dsgevar_forward_estimated_lambda.mod' ...
'external_function/example1_1st_and_2nd_deriv_functions_provided.mod' ...
'external_function/example1_1st_and_2nd_deriv_functions_provided_dll.mod' ...
'external_function/example1_1st_deriv_function_provided.mod' ...
'external_function/example1_1st_deriv_function_provided_dll.mod' ...
'external_function/example1_no_deriv_functions_provided.mod' ...
'external_function/example1_no_deriv_functions_provided_dll.mod' ...
'seeds.mod' ...
'simul/example1.mod' ...
};
## 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")
[directory, name, ext] = fileparts(argv(){1});
## BASE TESTS
failed = {};
printf("TEST: %s...\n", name)
top_test_dir = [pwd '/'];
addpath(argv(){2})
for i=1:size(name,2)
save('makecheck.mat', 'name', 'failed', 'i', 'top_test_dir');
clear -all;
load 'makecheck.mat';
if !strcmp(dynare_version(), argv(){3})
error("Incorrect version of Dynare is being tested")
endif
try
[directory, testfile, ext] = fileparts([top_test_dir name{i}]);
cd(directory);
printf("*** TESTING: %s ***\n", name{i});
dynare([testfile ext], 'noclearall')
catch
failed{size(failed,2)+1} = name{i};
end_try_catch
end
cd(directory)
save('makecheck.mat', 'name', 'failed', 'top_test_dir');
clear -all;
load 'makecheck.mat';
dynare(name)
## BLOCK TEST
cd([top_test_dir 'block_bytecode/']);
num_block_tests = 0;
for block = 0:1
for bytecode = 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 !block && !bytecode
solve_algos = 0:4;
stack_solve_algos = 0;
elseif block && !bytecode
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
for i = 1:length(solve_algos)
save ws
if !block && !bytecode && (i == 1)
try
num_block_tests = num_block_tests + 1;
run_ls2003(block, bytecode, solve_algos(i), default_stack_solve_algo)
y_ref = oo_.endo_simul;
save('test.mat','y_ref');
catch
failed{size(failed,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(block) num2str(bytecode) num2str(solve_algos(i)) num2str(default_stack_solve_algo) ')'];
end_try_catch
else
try
num_block_tests = num_block_tests + 1;
run_ls2003(block, bytecode, solve_algos(i), default_stack_solve_algo)
load('test.mat','y_ref');
diff = oo_.endo_simul - y_ref;
if (abs(diff) <= options_.dynatol)
failed{size(failed,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(block) num2str(bytecode) num2str(solve_algos(i)) num2str(default_stack_solve_algo) ')'];
end
catch
failed{size(failed,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(block) num2str(bytecode) num2str(solve_algos(i)) num2str(default_stack_solve_algo) ')'];
end_try_catch
endif
load ws
endfor
for i = 1:length(stack_solve_algos)
save ws
try
num_block_tests = num_block_tests + 1;
run_ls2003(block, bytecode, default_solve_algo, stack_solve_algos(i))
catch
failed{size(failed,2)+1} = ['block_bytecode/run_ls2003.m(' num2str(block) num2str(bytecode) num2str(solve_algos(i)) num2str(default_stack_solve_algo) ')'];
end_try_catch
load ws
endfor
endfor
endfor
save('makecheck.mat', 'name', 'failed', 'top_test_dir', 'num_block_tests');
clear -all;
load 'makecheck.mat';
delete 'makecheck.mat';
total_tests = size(name,2)+num_block_tests;
printf("\n\n\n");
printf("***************************************\n");
printf("* DYNARE TEST RESULTS *\n");
printf("***************************************\n");
printf(" %d tests PASSED out of %d tests run\n", total_tests-size(failed,2), total_tests);
printf("***************************************\n");
if size(failed,2) > 0
printf("List of %d tests FAILED:\n", size(failed,2));
for i=1:size(failed,2)
printf(" * %s\n",failed{i});
end
printf("***************************************\n\n");
error("Make Check FAILED");
end
## Local variables:
## mode: Octave