Meson build system: testsuite now fully implemented
By the way, switch the CI to use the Meson testsuite, because some test files have been modified and no longer work with the old build system.kalman-mex
parent
01ae836a99
commit
e549bbba7a
|
@ -25,17 +25,24 @@ stages:
|
||||||
- sign
|
- sign
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
build_binaries:
|
build_matlab:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- autoreconf -si
|
- meson setup -Dbuild_for=matlab -Dmatlab_path=/opt/MATLAB/$MATLAB_VERSION -Dbuildtype=release build-matlab
|
||||||
- ./configure --with-matlab=/opt/MATLAB/$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
|
- meson compile -v -C build-matlab
|
||||||
- make -j $(nproc) LN_S="cp -p"
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- preprocessor/dynare-preprocessor
|
- build-matlab/
|
||||||
- mex/octave/
|
expire_in: 3 days
|
||||||
- mex/matlab/
|
|
||||||
|
build_octave:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- meson setup -Dbuild_for=octave -Dbuildtype=release build-octave
|
||||||
|
- meson compile -v -C build-octave
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- build-octave/
|
||||||
expire_in: 3 days
|
expire_in: 3 days
|
||||||
|
|
||||||
build_doc:
|
build_doc:
|
||||||
|
@ -109,32 +116,26 @@ pkg_macOS:
|
||||||
expire_in: 3 days
|
expire_in: 3 days
|
||||||
needs: [ "build_doc" ]
|
needs: [ "build_doc" ]
|
||||||
|
|
||||||
.test_matlab_template:
|
test_matlab:
|
||||||
stage: test
|
stage: test
|
||||||
|
script:
|
||||||
|
- meson test -C build-matlab --no-rebuild --num-processes $(($(nproc) * 3 / 4))
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- tests/**/*.m.log
|
- build-matlab/meson-logs/testlog.txt
|
||||||
- tests/**/*.m.trs
|
|
||||||
- tests/**/*.jnl
|
|
||||||
- tests/run_test_matlab_output.txt
|
|
||||||
when: always
|
when: always
|
||||||
needs: [ "build_binaries" ]
|
needs: [ "build_matlab" ]
|
||||||
|
|
||||||
test_matlab:
|
|
||||||
extends: .test_matlab_template
|
|
||||||
script:
|
|
||||||
- autoreconf -si
|
|
||||||
- ./configure --disable-octave --with-matlab=/opt/MATLAB/$MATLAB_VERSION
|
|
||||||
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
|
||||||
|
|
||||||
test_old_matlab:
|
test_old_matlab:
|
||||||
extends: .test_matlab_template
|
stage: test
|
||||||
script:
|
script:
|
||||||
- autoreconf -si
|
- meson setup -Dbuild_for=matlab -Dmatlab_path=/opt/MATLAB/$OLD_MATLAB_VERSION -Dbuildtype=release build-old-matlab
|
||||||
- ./configure --disable-octave --with-matlab=/opt/MATLAB/$OLD_MATLAB_VERSION
|
- meson compile -v -C build-old-matlab
|
||||||
- make -C mex/build/matlab clean
|
- meson test -C build-old-matlab --num-processes $(($(nproc) * 3 / 4))
|
||||||
- make -j $(nproc) -C mex/build/matlab
|
artifacts:
|
||||||
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
paths:
|
||||||
|
- build-old-matlab/meson-logs/testlog.txt
|
||||||
|
when: always
|
||||||
when: manual
|
when: manual
|
||||||
|
|
||||||
test_octave:
|
test_octave:
|
||||||
|
@ -142,17 +143,12 @@ test_octave:
|
||||||
variables:
|
variables:
|
||||||
OPENBLAS_NUM_THREADS: 1
|
OPENBLAS_NUM_THREADS: 1
|
||||||
script:
|
script:
|
||||||
- autoreconf -si
|
- meson test -C build-octave --no-rebuild
|
||||||
- ./configure --disable-matlab
|
|
||||||
- make -j $(nproc) -C tests check-octave
|
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- tests/**/*.o.log
|
- build-octave/meson-logs/testlog.txt
|
||||||
- tests/**/*.o.trs
|
|
||||||
- tests/**/*.jnl
|
|
||||||
- tests/run_test_octave_output.txt
|
|
||||||
when: always
|
when: always
|
||||||
needs: [ "build_binaries" ]
|
needs: [ "build_octave" ]
|
||||||
when: manual
|
when: manual
|
||||||
|
|
||||||
# For the sign and deploy jobs, we don’t use the “needs” keyword, since we
|
# For the sign and deploy jobs, we don’t use the “needs” keyword, since we
|
||||||
|
|
65
meson.build
65
meson.build
|
@ -1,5 +1,4 @@
|
||||||
# TODO:
|
# TODO:
|
||||||
# - Add tests that are individually listed in {M,O}_TRS_FILES of tests/Makefile.am
|
|
||||||
# - Install files in right location
|
# - Install files in right location
|
||||||
# - configuration option to disable preprocessor build, and use it in {windows,macOS}/build.sh
|
# - configuration option to disable preprocessor build, and use it in {windows,macOS}/build.sh
|
||||||
# - add -Wold-style-cast C++ flag except when building flex-generated files
|
# - add -Wold-style-cast C++ flag except when building flex-generated files
|
||||||
|
@ -1677,9 +1676,71 @@ mod_and_m_tests = [
|
||||||
{ 'test' : [ 'var-expectations/1-with-time-shift-b/example1.mod' ],
|
{ 'test' : [ 'var-expectations/1-with-time-shift-b/example1.mod' ],
|
||||||
'should_fail' : true },
|
'should_fail' : true },
|
||||||
{ 'test' : [ 'estimation/univariate/nls/staticmodelx.mod' ],
|
{ 'test' : [ 'estimation/univariate/nls/staticmodelx.mod' ],
|
||||||
'should_fail' : true }
|
'should_fail' : true },
|
||||||
|
|
||||||
|
# Misc tests with .m files
|
||||||
|
{ 'test' : [ 'run_all_unit_tests.m' ] },
|
||||||
|
{ 'test' : [ 'histval_initval_file_unit_tests.m' ],
|
||||||
|
'extra' : [ 'histval_initval_file/my_assert.m' ] },
|
||||||
|
{ 'test' : [ 'run_kronecker_tests.m' ],
|
||||||
|
'extra' : [ 'kronecker/test_kron.m',
|
||||||
|
'kronecker/nash_matrices.mat' ] },
|
||||||
|
{ 'test' : [ 'nonlinearsolvers.m' ],
|
||||||
|
'extra' : [ 'solver-test-functions/brown.m',
|
||||||
|
'solver-test-functions/broydenbanded.m',
|
||||||
|
'solver-test-functions/broydentridiagonal.m',
|
||||||
|
'solver-test-functions/chebyquad.m',
|
||||||
|
'solver-test-functions/discreteboundaryvalue.m',
|
||||||
|
'solver-test-functions/discreteintegralequation.m',
|
||||||
|
'solver-test-functions/helicalvalley.m',
|
||||||
|
'solver-test-functions/powell1.m',
|
||||||
|
'solver-test-functions/powell2.m',
|
||||||
|
'solver-test-functions/rosenbrock.m',
|
||||||
|
'solver-test-functions/trigonometric.m',
|
||||||
|
'solver-test-functions/variablydimensioned.m',
|
||||||
|
'solver-test-functions/watson.m',
|
||||||
|
'solver-test-functions/wood.m',] },
|
||||||
|
{ 'test' : [ 'cyclereduction.m' ] },
|
||||||
|
{ 'test' : [ 'logarithmicreduction.m' ] },
|
||||||
|
{ 'test' : [ 'riccatiupdate.m' ] },
|
||||||
|
{ 'test' : [ 'contribs.m' ],
|
||||||
|
'extra' : [ 'sandbox.mod',
|
||||||
|
'simulateddata.m' ] }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if get_option('build_for') == 'matlab'
|
||||||
|
mod_and_m_tests += [ { 'test' : [ 'run_block_byte_tests_matlab.m' ],
|
||||||
|
'extra' : [ 'block_bytecode/run_ls2003.m',
|
||||||
|
'block_bytecode/ls2003.mod' ] },
|
||||||
|
{ 'test' : [ 'run_reporting_test_matlab.m' ],
|
||||||
|
'extra' : [ 'reporting/AnnualTable.m',
|
||||||
|
'reporting/CommResidTablePage.m',
|
||||||
|
'reporting/CountryGraphPage.m',
|
||||||
|
'reporting/CountryTablePage.m',
|
||||||
|
'reporting/db_a.csv',
|
||||||
|
'reporting/db_q.csv',
|
||||||
|
'reporting/dc_a.csv',
|
||||||
|
'reporting/dc_q.csv',
|
||||||
|
'reporting/ResidTablePage.m',
|
||||||
|
'reporting/runDynareReport.m' ] } ]
|
||||||
|
else
|
||||||
|
mod_and_m_tests += [ { 'test' : [ 'run_block_byte_tests_octave.m' ],
|
||||||
|
'extra' : [ 'block_bytecode/run_ls2003.m',
|
||||||
|
'block_bytecode/ls2003.mod' ] },
|
||||||
|
{ 'test' : [ 'run_reporting_test_octave.m' ],
|
||||||
|
'extra' : [ 'reporting/AnnualTable.m',
|
||||||
|
'reporting/CommResidTablePage.m',
|
||||||
|
'reporting/CountryGraphPage.m',
|
||||||
|
'reporting/CountryTablePage.m',
|
||||||
|
'reporting/db_a.csv',
|
||||||
|
'reporting/db_q.csv',
|
||||||
|
'reporting/dc_a.csv',
|
||||||
|
'reporting/dc_q.csv',
|
||||||
|
'reporting/ResidTablePage.m',
|
||||||
|
'reporting/runDynareReport.m' ] } ]
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
base_test_driver_args = [ get_option('build_for') ]
|
base_test_driver_args = [ get_option('build_for') ]
|
||||||
if get_option('build_for') == 'matlab'
|
if get_option('build_for') == 'matlab'
|
||||||
base_test_driver_args += [ matlab_exe.full_path(), matlab_version, matlab_arch ]
|
base_test_driver_args += [ matlab_exe.full_path(), matlab_version, matlab_arch ]
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# Executes one or several .mod or .m files in a separate directory, for the testsuite
|
# Executes one or several .mod or .m files in a separate directory, for the testsuite
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
if (($# < 7 )); then
|
if (($# < 7 )); then
|
||||||
echo "Usage: $0 build_for matlab_octave_exe matlab_octave_version matlab_arch source_root build_root test_file(s) [-- extra_file(s)]" 2>&1
|
echo "Usage: $0 build_for matlab_octave_exe matlab_octave_version matlab_arch source_root build_root test_file(s) [-- extra_file(s)]" 2>&1
|
||||||
|
@ -40,7 +41,11 @@ cleanup ()
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
for f in "${test_files[@]}" "${extra_files[@]}"; do
|
for f in "${test_files[@]}" "${extra_files[@]}"; do
|
||||||
subdir=${f%/*}
|
# NB: for computing the subdir, we do not use ${f%/*}, because the latter does not
|
||||||
|
# work with files which are not in a subdir (i.e. no slash in the filename).
|
||||||
|
# We rather use pattern substitution (and we use an extended pattern of the
|
||||||
|
# form *(pattern-list), hence the extglob option above).
|
||||||
|
subdir=${f/%*([^\/])/}
|
||||||
mkdir -p "${tmpdir}/${subdir}"
|
mkdir -p "${tmpdir}/${subdir}"
|
||||||
cp "${source_root}/tests/${f}" "${tmpdir}/${f}"
|
cp "${source_root}/tests/${f}" "${tmpdir}/${f}"
|
||||||
done
|
done
|
||||||
|
@ -69,7 +74,8 @@ export source_root
|
||||||
|
|
||||||
for test_file in "${test_files[@]}"; do
|
for test_file in "${test_files[@]}"; do
|
||||||
test_basename=${test_file##*/}
|
test_basename=${test_file##*/}
|
||||||
test_subdir=${test_file%/*}
|
# See the remark above for computing the subdir
|
||||||
|
test_subdir=${test_file/%*([^\/])/}
|
||||||
if [[ $test_file =~ \.mod$ ]]; then
|
if [[ $test_file =~ \.mod$ ]]; then
|
||||||
export mod_file=$test_basename
|
export mod_file=$test_basename
|
||||||
if [[ $build_for == matlab ]]; then
|
if [[ $build_for == matlab ]]; then
|
||||||
|
|
|
@ -1,28 +1,15 @@
|
||||||
debug = false;
|
debug = false;
|
||||||
|
|
||||||
if debug
|
source_dir = getenv('source_root');
|
||||||
[top_test_dir, ~, ~] = fileparts(mfilename('fullpath'));
|
addpath([source_dir filesep 'matlab']);
|
||||||
else
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
|
||||||
end
|
|
||||||
|
|
||||||
addpath(sprintf('%s/matlab', top_test_dir(1:end-6)))
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
% Test Dynare Version
|
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dynare_config;
|
dynare_config;
|
||||||
|
|
||||||
NumberOfTests = 0;
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
if ~debug
|
||||||
skipline()
|
skipline()
|
||||||
disp('*** TESTING: nonlinearsolvers.m ***');
|
disp('*** TESTING: contribs.m ***');
|
||||||
end
|
end
|
||||||
|
|
||||||
%
|
%
|
||||||
|
@ -31,8 +18,6 @@ end
|
||||||
|
|
||||||
t0 = clock;
|
t0 = clock;
|
||||||
|
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
dataset = dseries('simulateddata.m');
|
dataset = dseries('simulateddata.m');
|
||||||
|
|
||||||
|
@ -51,32 +36,9 @@ end
|
||||||
|
|
||||||
t1 = clock;
|
t1 = clock;
|
||||||
|
|
||||||
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', etime(t1, t0));
|
||||||
|
|
||||||
if ~debug
|
quit(testFailed > 0)
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
|
||||||
else
|
|
||||||
dprintf('FAILED tests: %i', testFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isoctave
|
|
||||||
fid = fopen('contribs.o.trs', 'w+');
|
|
||||||
else
|
|
||||||
fid = fopen('contribs.m.trs', 'w+');
|
|
||||||
end
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: nonlinearsolvers.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':number-tests: %i\n', NumberOfTests);
|
|
||||||
fprintf(fid,':number-failed-tests: %i\n', testFailed);
|
|
||||||
fprintf(fid,':elapsed-time: %f\n', etime(t1, t0));
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
exit;
|
|
||||||
end
|
|
||||||
%
|
%
|
||||||
% END OF TEST
|
% END OF TEST
|
||||||
%
|
%
|
||||||
|
|
|
@ -1,23 +1,10 @@
|
||||||
debug = false;
|
debug = false;
|
||||||
|
|
||||||
if debug
|
source_dir = getenv('source_root');
|
||||||
[top_test_dir, ~, ~] = fileparts(mfilename('fullpath'));
|
addpath([source_dir filesep 'matlab']);
|
||||||
else
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
|
||||||
end
|
|
||||||
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
% Test Dynare Version
|
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dynare_config;
|
dynare_config;
|
||||||
|
|
||||||
NumberOfTests = 0;
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
if ~debug
|
||||||
|
@ -25,17 +12,11 @@ if ~debug
|
||||||
disp('*** TESTING: cyclereduction.m ***');
|
disp('*** TESTING: cyclereduction.m ***');
|
||||||
end
|
end
|
||||||
|
|
||||||
matlab_cr_path = [top_test_dir filesep '..' filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'cycle_reduction'];
|
matlab_cr_path = [source_dir filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'cycle_reduction'];
|
||||||
addpath(matlab_cr_path);
|
addpath(matlab_cr_path);
|
||||||
cycle_reduction_matlab = @cycle_reduction;
|
cycle_reduction_matlab = @cycle_reduction;
|
||||||
rmpath(matlab_cr_path);
|
rmpath(matlab_cr_path);
|
||||||
|
|
||||||
if isoctave
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'mex' filesep 'octave']);
|
|
||||||
else
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'mex' filesep 'matlab']);
|
|
||||||
end
|
|
||||||
|
|
||||||
t0 = clock;
|
t0 = clock;
|
||||||
|
|
||||||
% Set the dimension of the problem to be solved.
|
% Set the dimension of the problem to be solved.
|
||||||
|
@ -49,7 +30,6 @@ X1 = zeros(n,n);
|
||||||
X2 = zeros(n,n);
|
X2 = zeros(n,n);
|
||||||
|
|
||||||
% 1. Solve the equation with the Matlab cycle reduction algorithm
|
% 1. Solve the equation with the Matlab cycle reduction algorithm
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
tElapsed1 = 0.;
|
tElapsed1 = 0.;
|
||||||
try
|
try
|
||||||
tic; [X1,info] = cycle_reduction_matlab(C,B,A,cvg_tol,[0.]); tElapsed1 = toc;
|
tic; [X1,info] = cycle_reduction_matlab(C,B,A,cvg_tol,[0.]); tElapsed1 = toc;
|
||||||
|
@ -69,7 +49,6 @@ catch
|
||||||
end
|
end
|
||||||
|
|
||||||
% 2. Solve the equation with the Fortran cycle reduction algorithm
|
% 2. Solve the equation with the Fortran cycle reduction algorithm
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
tElapsed2 = 0.;
|
tElapsed2 = 0.;
|
||||||
try
|
try
|
||||||
tic; [X2,info] = cycle_reduction(C,B,A,cvg_tol,[0.]); tElapsed2 = toc;
|
tic; [X2,info] = cycle_reduction(C,B,A,cvg_tol,[0.]); tElapsed2 = toc;
|
||||||
|
@ -89,7 +68,6 @@ catch
|
||||||
end
|
end
|
||||||
|
|
||||||
% 3. Compare solutions of the Fortran and Matlab routines
|
% 3. Compare solutions of the Fortran and Matlab routines
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
if (norm(X1 - X2, 1) > cvg_tol)
|
if (norm(X1 - X2, 1) > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
if debug
|
||||||
|
@ -112,29 +90,6 @@ end
|
||||||
|
|
||||||
t1 = clock;
|
t1 = clock;
|
||||||
|
|
||||||
if ~debug
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', etime(t1, t0));
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
|
||||||
else
|
|
||||||
dprintf('FAILED tests: %i', testFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isoctave
|
|
||||||
fid = fopen('cyclereduction.o.trs', 'w+');
|
|
||||||
else
|
|
||||||
fid = fopen('cyclereduction.m.trs', 'w+');
|
|
||||||
end
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: cyclereduction.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':number-tests: %i\n', NumberOfTests);
|
|
||||||
fprintf(fid,':number-failed-tests: %i\n', testFailed);
|
|
||||||
fprintf(fid,':elapsed-time: %f\n', etime(t1, t0));
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
exit;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
quit(testFailed > 0)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab/']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
dynare_config;
|
dynare_config;
|
||||||
|
|
||||||
cd('histval_initval_file');
|
cd histval_initval_file
|
||||||
num_tests = 0;
|
|
||||||
failed_tests = {};
|
failed_tests = {};
|
||||||
|
|
||||||
ds = dseries(randn(10,4));
|
ds = dseries(randn(10,4));
|
||||||
|
@ -26,7 +26,6 @@ options.series = 'ds';
|
||||||
ds1 = histvalf_initvalf(caller, M, options);
|
ds1 = histvalf_initvalf(caller, M, options);
|
||||||
|
|
||||||
failed_tests = my_assert(failed_tests, all(all(ds1 == ds)), 'basic test');
|
failed_tests = my_assert(failed_tests, all(all(ds1 == ds)), 'basic test');
|
||||||
num_tests = num_tests + 1;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds1';
|
options.series = 'ds1';
|
||||||
|
@ -34,7 +33,6 @@ options.first_obs = 2;
|
||||||
ds1 = histvalf_initvalf(caller, M, options);
|
ds1 = histvalf_initvalf(caller, M, options);
|
||||||
failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
||||||
'init test 1');
|
'init test 1');
|
||||||
num_tests = num_tests + 1;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -45,7 +43,6 @@ failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
||||||
'first_obs last_obs test 1');
|
'first_obs last_obs test 1');
|
||||||
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
||||||
'first_obs last_obs test 2');
|
'first_obs last_obs test 2');
|
||||||
num_tests = num_tests + 2;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -55,7 +52,6 @@ failed_tests = my_assert(failed_tests, ds1.init == dates('1Y'), ...
|
||||||
'last_obs test 1');
|
'last_obs test 1');
|
||||||
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
||||||
'last_obs test 2');
|
'last_obs test 2');
|
||||||
num_tests = num_tests + 2;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -67,7 +63,6 @@ failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
||||||
'first_obs, last_obs, nobs test 1');
|
'first_obs, last_obs, nobs test 1');
|
||||||
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
||||||
'first_obs, last_obs, nobs test 2');
|
'first_obs, last_obs, nobs test 2');
|
||||||
num_tests = num_tests + 2;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -78,7 +73,6 @@ failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
||||||
'last_obs, nobs test 1');
|
'last_obs, nobs test 1');
|
||||||
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
||||||
'last_obs, nobs test 2');
|
'last_obs, nobs test 2');
|
||||||
num_tests = num_tests + 2;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -96,7 +90,6 @@ catch me
|
||||||
failed_tests = cat(1, failed_tests, 'Wrong nobs error message' );
|
failed_tests = cat(1, failed_tests, 'Wrong nobs error message' );
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
num_tests = num_tests + 1;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -111,7 +104,6 @@ catch me
|
||||||
'Wrong first period error message');
|
'Wrong first period error message');
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
num_tests = num_tests + 1;
|
|
||||||
|
|
||||||
options = struct();
|
options = struct();
|
||||||
options.series = 'ds';
|
options.series = 'ds';
|
||||||
|
@ -127,7 +119,6 @@ catch me
|
||||||
'Wrong last period error message');
|
'Wrong last period error message');
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
num_tests = num_tests + 1;
|
|
||||||
|
|
||||||
fh = fopen('data.m', 'w');
|
fh = fopen('data.m', 'w');
|
||||||
init__ = 'INIT__ = ''1Y'';';
|
init__ = 'INIT__ = ''1Y'';';
|
||||||
|
@ -195,7 +186,6 @@ if ~isoctave && ((ispc && ~matlab_ver_less_than('8.2')) || (~ispc && ~matlab_ver
|
||||||
'*.xlsx file first_obs test');
|
'*.xlsx file first_obs test');
|
||||||
failed_tests = my_assert(failed_tests, series.nobs == 10, ...
|
failed_tests = my_assert(failed_tests, series.nobs == 10, ...
|
||||||
'*.xlsx file nobs test');
|
'*.xlsx file nobs test');
|
||||||
num_tests = num_tests + 2;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% The table() function is not implemented in Octave
|
% The table() function is not implemented in Octave
|
||||||
|
@ -209,26 +199,10 @@ if ~isoctave && (ispc && ~matlab_ver_less_than('8.2'))
|
||||||
'*.xls file first_obs test');
|
'*.xls file first_obs test');
|
||||||
failed_tests = my_assert(failed_tests, series.nobs == 10, ...
|
failed_tests = my_assert(failed_tests, series.nobs == 10, ...
|
||||||
'*.xls file nobs test');
|
'*.xls file nobs test');
|
||||||
num_tests = num_tests + 2;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
if length(failed_tests) > 0
|
||||||
if isoctave
|
fprintf('\n*** Failed tests: %s\n', failed_tests{:})
|
||||||
ext = '.o.trs';
|
|
||||||
else
|
|
||||||
ext = '.m.trs';
|
|
||||||
end
|
end
|
||||||
fid = fopen([ 'histval_initval_file_unit_tests' ext ], 'w+');
|
|
||||||
num_failed_tests = length(failed_tests);
|
quit(length(failed_tests) > 0)
|
||||||
if num_failed_tests > 0
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':number-tests: %d\n', num_tests);
|
|
||||||
fprintf(fid,':number-failed-tests: %d\n', num_failed_tests);
|
|
||||||
fprintf(fid,':list-of-failed-tests: %s\n', failed_tests{:});
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: %d\n', num_tests);
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
end
|
|
||||||
fclose(fid);
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -1,23 +1,10 @@
|
||||||
debug = false;
|
debug = false;
|
||||||
|
|
||||||
if debug
|
source_dir = getenv('source_root');
|
||||||
[top_test_dir, ~, ~] = fileparts(mfilename('fullpath'));
|
addpath([source_dir filesep 'matlab']);
|
||||||
else
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
|
||||||
end
|
|
||||||
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
% Test Dynare Version
|
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dynare_config;
|
dynare_config;
|
||||||
|
|
||||||
NumberOfTests = 0;
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
if ~debug
|
||||||
|
@ -25,17 +12,11 @@ if ~debug
|
||||||
disp('*** TESTING: logarithmicreduction.m ***');
|
disp('*** TESTING: logarithmicreduction.m ***');
|
||||||
end
|
end
|
||||||
|
|
||||||
matlab_cr_path = [top_test_dir filesep '..' filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'logarithmic_reduction'];
|
matlab_cr_path = [source_dir filesep 'matlab' filesep 'missing' filesep 'mex' filesep 'logarithmic_reduction'];
|
||||||
addpath(matlab_cr_path);
|
addpath(matlab_cr_path);
|
||||||
logarithmic_reduction_matlab = @logarithmic_reduction;
|
logarithmic_reduction_matlab = @logarithmic_reduction;
|
||||||
rmpath(matlab_cr_path);
|
rmpath(matlab_cr_path);
|
||||||
|
|
||||||
if isoctave
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'mex' filesep 'octave']);
|
|
||||||
else
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'mex' filesep 'matlab']);
|
|
||||||
end
|
|
||||||
|
|
||||||
t0 = clock;
|
t0 = clock;
|
||||||
|
|
||||||
% Set the dimension of the problem to be solved.
|
% Set the dimension of the problem to be solved.
|
||||||
|
@ -49,7 +30,6 @@ X1 = zeros(n,n);
|
||||||
X2 = zeros(n,n);
|
X2 = zeros(n,n);
|
||||||
|
|
||||||
% 1. Solve the equation with the Matlab logarithmic reduction algorithm
|
% 1. Solve the equation with the Matlab logarithmic reduction algorithm
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
tElapsed1 = 0.;
|
tElapsed1 = 0.;
|
||||||
try
|
try
|
||||||
tic; [X1,info] = logarithmic_reduction_matlab(A,B,C,cvg_tol,300,[0.]); tElapsed1 = toc;
|
tic; [X1,info] = logarithmic_reduction_matlab(A,B,C,cvg_tol,300,[0.]); tElapsed1 = toc;
|
||||||
|
@ -69,7 +49,6 @@ catch
|
||||||
end
|
end
|
||||||
|
|
||||||
% 2. Solve the equation with the Fortran logarithmic reduction algorithm
|
% 2. Solve the equation with the Fortran logarithmic reduction algorithm
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
tElapsed2 = 0.;
|
tElapsed2 = 0.;
|
||||||
try
|
try
|
||||||
tic; [X2,info] = logarithmic_reduction(A,B,C,cvg_tol,300,[0.]); tElapsed2 = toc;
|
tic; [X2,info] = logarithmic_reduction(A,B,C,cvg_tol,300,[0.]); tElapsed2 = toc;
|
||||||
|
@ -89,7 +68,6 @@ catch
|
||||||
end
|
end
|
||||||
|
|
||||||
% 3. Compare solutions of the Fortran and Matlab routines
|
% 3. Compare solutions of the Fortran and Matlab routines
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
if (norm(X1 - X2, 1) > cvg_tol)
|
if (norm(X1 - X2, 1) > cvg_tol)
|
||||||
testFailed = testFailed+1;
|
testFailed = testFailed+1;
|
||||||
if debug
|
if debug
|
||||||
|
@ -112,29 +90,6 @@ end
|
||||||
|
|
||||||
t1 = clock;
|
t1 = clock;
|
||||||
|
|
||||||
if ~debug
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', etime(t1, t0));
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
|
||||||
else
|
|
||||||
dprintf('FAILED tests: %i', testFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isoctave
|
|
||||||
fid = fopen('logarithmicreduction.o.trs', 'w+');
|
|
||||||
else
|
|
||||||
fid = fopen('logarithmicreduction.m.trs', 'w+');
|
|
||||||
end
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: logarithmicreduction.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':number-tests: %i\n', NumberOfTests);
|
|
||||||
fprintf(fid,':number-failed-tests: %i\n', testFailed);
|
|
||||||
fprintf(fid,':elapsed-time: %f\n', etime(t1, t0));
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
exit;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
quit(testFailed > 0)
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
debug = false;
|
debug = false;
|
||||||
|
|
||||||
if debug
|
source_dir = getenv('source_root');
|
||||||
[top_test_dir, ~, ~] = fileparts(mfilename('fullpath'));
|
addpath([source_dir filesep 'matlab']);
|
||||||
else
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
|
||||||
end
|
|
||||||
|
|
||||||
addpath(sprintf('%s/matlab', top_test_dir(1:end-6)))
|
|
||||||
addpath(sprintf('%s/tests/solver-test-functions', top_test_dir(1:end-6)))
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
% Test Dynare Version
|
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dynare_config;
|
dynare_config;
|
||||||
|
|
||||||
NumberOfTests = 0;
|
cd solver-test-functions
|
||||||
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
if ~debug
|
||||||
|
@ -56,7 +44,6 @@ objfun = { @rosenbrock,
|
||||||
t0 = clock;
|
t0 = clock;
|
||||||
|
|
||||||
for i=1:length(objfun)
|
for i=1:length(objfun)
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
switch func2str(objfun{i})
|
switch func2str(objfun{i})
|
||||||
case 'helicalvalley'
|
case 'helicalvalley'
|
||||||
% FIXME block_trust_region is diverging if x(1)<0.
|
% FIXME block_trust_region is diverging if x(1)<0.
|
||||||
|
@ -110,7 +97,6 @@ t1 = clock; etime(t1, t0)
|
||||||
%
|
%
|
||||||
|
|
||||||
for i=1:length(objfun)
|
for i=1:length(objfun)
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
switch func2str(objfun{i})
|
switch func2str(objfun{i})
|
||||||
case 'chebyquad'
|
case 'chebyquad'
|
||||||
% Fails with a system of 10 equations.
|
% Fails with a system of 10 equations.
|
||||||
|
@ -151,31 +137,8 @@ for i=1:length(objfun)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
t2 = clock; etime(t2, t1)
|
t2 = clock;
|
||||||
|
|
||||||
if ~debug
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', etime(t2, t0));
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
|
||||||
else
|
|
||||||
dprintf('FAILED tests: %i', testFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isoctave
|
|
||||||
fid = fopen('nonlinearsolvers.o.trs', 'w+');
|
|
||||||
else
|
|
||||||
fid = fopen('nonlinearsolvers.m.trs', 'w+');
|
|
||||||
end
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: nonlinearsolvers.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':number-tests: %i\n', NumberOfTests);
|
|
||||||
fprintf(fid,':number-failed-tests: %i\n', testFailed);
|
|
||||||
fprintf(fid,':elapsed-time: %f\n', etime(t2, t0));
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
exit;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
quit(testFailed > 0)
|
||||||
|
|
|
@ -1,23 +1,10 @@
|
||||||
debug = true;
|
debug = true;
|
||||||
|
|
||||||
if debug
|
source_dir = getenv('source_root');
|
||||||
[top_test_dir, ~, ~] = fileparts(mfilename('fullpath'));
|
addpath([source_dir filesep 'matlab']);
|
||||||
else
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
|
||||||
end
|
|
||||||
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
% Test Dynare Version
|
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dynare_config;
|
dynare_config;
|
||||||
|
|
||||||
NumberOfTests = 0;
|
|
||||||
testFailed = 0;
|
testFailed = 0;
|
||||||
|
|
||||||
if ~debug
|
if ~debug
|
||||||
|
@ -25,12 +12,6 @@ if ~debug
|
||||||
disp('*** TESTING: riccatiupdate.m ***');
|
disp('*** TESTING: riccatiupdate.m ***');
|
||||||
end
|
end
|
||||||
|
|
||||||
if isoctave
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'mex' filesep 'octave']);
|
|
||||||
else
|
|
||||||
addpath([top_test_dir filesep '..' filesep 'mex' filesep 'matlab']);
|
|
||||||
end
|
|
||||||
|
|
||||||
t0 = clock;
|
t0 = clock;
|
||||||
|
|
||||||
% Set the number of experiments for time measurement
|
% Set the number of experiments for time measurement
|
||||||
|
@ -64,7 +45,6 @@ tElapsed1 = toc;
|
||||||
disp(['Elapsed time for the Matlab Riccati update is: ' num2str(tElapsed1) ' (N=' int2str(N) ').'])
|
disp(['Elapsed time for the Matlab Riccati update is: ' num2str(tElapsed1) ' (N=' int2str(N) ').'])
|
||||||
|
|
||||||
% 2. Update the state varance-covariance matrix with the mex routine
|
% 2. Update the state varance-covariance matrix with the mex routine
|
||||||
NumberOfTests = NumberOfTests+1;
|
|
||||||
tElapsed2 = 0.;
|
tElapsed2 = 0.;
|
||||||
Ptmp_fortran = P;
|
Ptmp_fortran = P;
|
||||||
try
|
try
|
||||||
|
@ -112,29 +92,6 @@ end
|
||||||
|
|
||||||
t1 = clock;
|
t1 = clock;
|
||||||
|
|
||||||
if ~debug
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', etime(t1, t0));
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
|
||||||
else
|
|
||||||
dprintf('FAILED tests: %i', testFailed)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isoctave
|
|
||||||
fid = fopen('riccatiupdate.o.trs', 'w+');
|
|
||||||
else
|
|
||||||
fid = fopen('riccatiupdate.m.trs', 'w+');
|
|
||||||
end
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: riccatiupdate.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':number-tests: %i\n', NumberOfTests);
|
|
||||||
fprintf(fid,':number-failed-tests: %i\n', testFailed);
|
|
||||||
fprintf(fid,':elapsed-time: %f\n', etime(t1, t0));
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
if ~debug
|
|
||||||
exit;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
quit(testFailed > 0)
|
||||||
|
|
|
@ -15,28 +15,25 @@
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep 'utils']);
|
addpath([source_dir filesep 'tests' filesep 'utils']);
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
matlab_dir = [source_dir filesep 'matlab'];
|
||||||
|
addpath(matlab_dir);
|
||||||
|
|
||||||
dynare_config();
|
dynare_config();
|
||||||
|
|
||||||
if isoctave
|
if isoctave
|
||||||
load_octave_packages
|
load_octave_packages
|
||||||
end
|
end
|
||||||
|
|
||||||
% Test Dynare Version
|
mlist = get_directory_description(matlab_dir);
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
|
|
||||||
mlist = get_directory_description('../matlab');
|
|
||||||
|
|
||||||
% Under Octave, do not run tests under matlab/missing/stats/
|
% Under Octave, do not run tests under matlab/missing/stats/
|
||||||
% Also skip load_m_data_file_legacy.m: it fails in the first test, but
|
% Also skip load_m_data_file_legacy.m: it fails in the first test, but
|
||||||
% this is impossible to reproduce outside the runners.
|
% this is impossible to reproduce outside the runners.
|
||||||
if isoctave
|
if isoctave
|
||||||
mlist = mlist(find(~strncmp('../matlab/missing/stats/', mlist, 24)));
|
mlist = mlist(find(~strncmp([matlab_dir filesep 'missing/stats/'], mlist, 24)));
|
||||||
mlist = mlist(find(~strcmp('../matlab/load_m_file_data_legacy.m', mlist)));
|
mlist = mlist(find(~strcmp([matlab_dir filesep 'load_m_file_data_legacy.m'], mlist)));
|
||||||
end
|
end
|
||||||
|
|
||||||
% Set random seed, for reproducibility
|
% Set random seed, for reproducibility
|
||||||
|
@ -49,14 +46,11 @@ end
|
||||||
|
|
||||||
failedtests = {};
|
failedtests = {};
|
||||||
|
|
||||||
counter = 0;
|
|
||||||
|
|
||||||
for i = 1:length(mlist)
|
for i = 1:length(mlist)
|
||||||
f = [top_test_dir filesep mlist{i} ];
|
f = mlist{i};
|
||||||
if is_unit_test_available(f)
|
if is_unit_test_available(f)
|
||||||
[check, info] = mtest(f);
|
[check, info] = mtest(f);
|
||||||
for j = 1:size(info, 1)
|
for j = 1:size(info, 1)
|
||||||
counter = counter + 1;
|
|
||||||
if ~info{j,3}
|
if ~info{j,3}
|
||||||
failedtests{length(failedtests)+1} = [ mlist{i} '#' num2str(info{j,2}) ];
|
failedtests{length(failedtests)+1} = [ mlist{i} '#' num2str(info{j,2}) ];
|
||||||
end
|
end
|
||||||
|
@ -64,24 +58,8 @@ for i = 1:length(mlist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
|
||||||
if isoctave
|
|
||||||
fid = fopen('run_all_unit_tests.o.trs', 'w+');
|
|
||||||
else
|
|
||||||
fid = fopen('run_all_unit_tests.m.trs', 'w+');
|
|
||||||
end
|
|
||||||
if length(failedtests) > 0
|
if length(failedtests) > 0
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
fprintf('\n*** Failed tests: %s\n', failedtests{:})
|
||||||
fprintf(fid,':number-tests: %d\n', counter);
|
|
||||||
fprintf(fid,':number-failed-tests: %d\n', length(failedtests));
|
|
||||||
fprintf(fid,':list-of-failed-tests: %s\n', failedtests{:});
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: %d\n', counter);
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':elapsed-time: %f\n',0.0);
|
|
||||||
fclose(fid);
|
|
||||||
if ~isoctave
|
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
quit(length(failedtests) > 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
% Copyright © 2011-2022 Dynare Team
|
% Copyright © 2011-2023 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -27,20 +27,14 @@
|
||||||
% block, because otherwise the next 'load wsMat' within a 'catch' block will
|
% block, because otherwise the next 'load wsMat' within a 'catch' block will
|
||||||
% overwrite the last exception.
|
% overwrite the last exception.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep 'utils']);
|
addpath([source_dir filesep 'tests' filesep 'utils']);
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
addpath([source_dir 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
|
% Test block_bytecode/ls2003.mod with various combinations of
|
||||||
% block/bytecode/solve_algo/stack_solve_algo
|
% block/bytecode/solve_algo/stack_solve_algo
|
||||||
failedBlock = {};
|
failedBlock = {};
|
||||||
num_block_tests = 0;
|
cd block_bytecode
|
||||||
cd([top_test_dir filesep 'block_bytecode']);
|
|
||||||
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
|
has_optimization_toolbox = user_has_matlab_license('optimization_toolbox');
|
||||||
tic;
|
tic;
|
||||||
for blockFlag = 0:1
|
for blockFlag = 0:1
|
||||||
|
@ -62,7 +56,6 @@ for blockFlag = 0:1
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1:length(solve_algos)
|
for i = 1:length(solve_algos)
|
||||||
num_block_tests = num_block_tests + 1;
|
|
||||||
if ~blockFlag && storageFlag == 0 && (i == 1)
|
if ~blockFlag && storageFlag == 0 && (i == 1)
|
||||||
% This is the reference simulation path against which all
|
% This is the reference simulation path against which all
|
||||||
% other simulations will be tested
|
% other simulations will be tested
|
||||||
|
@ -108,7 +101,6 @@ for blockFlag = 0:1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i = 1:length(stack_solve_algos)
|
for i = 1:length(stack_solve_algos)
|
||||||
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
|
clear oo_ % Ensure that oo_.endo_simul won’t be overwritten when loading wsMat
|
||||||
|
@ -135,20 +127,13 @@ for blockFlag = 0:1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
ecput = toc;
|
|
||||||
delete('wsMat.mat')
|
delete('wsMat.mat')
|
||||||
cd(top_test_dir);
|
|
||||||
fid = fopen('run_block_byte_tests_matlab.m.trs', 'w+');
|
|
||||||
if size(failedBlock,2) > 0
|
if size(failedBlock,2) > 0
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
fprintf('\n*** Failed tests: %s\n', failedBlock{:})
|
||||||
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{:});
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: %d\n', num_block_tests);
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
end
|
end
|
||||||
fprintf(fid,':elapsed-time: %f\n', ecput);
|
|
||||||
fclose(fid);
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', toc);
|
||||||
exit;
|
|
||||||
|
quit(size(failedBlock,2) > 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
## Copyright © 2009-2022 Dynare Team
|
## Copyright © 2009-2023 Dynare Team
|
||||||
##
|
##
|
||||||
## This file is part of Dynare.
|
## This file is part of Dynare.
|
||||||
##
|
##
|
||||||
|
@ -24,20 +24,14 @@
|
||||||
## otherwise the newly created oo_ will be scratched upon loading,
|
## otherwise the newly created oo_ will be scratched upon loading,
|
||||||
## thus making the path comparison bogus.
|
## thus making the path comparison bogus.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep 'utils']);
|
addpath([source_dir filesep 'tests' filesep 'utils']);
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
## Test Dynare Version
|
|
||||||
if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
|
|
||||||
error("Incorrect version of Dynare is being tested")
|
|
||||||
endif
|
|
||||||
|
|
||||||
## Test block_bytecode/ls2003.mod with various combinations of
|
## Test block_bytecode/ls2003.mod with various combinations of
|
||||||
## block/bytecode/solve_algo/stack_solve_algo
|
## block/bytecode/solve_algo/stack_solve_algo
|
||||||
failedBlock = {};
|
failedBlock = {};
|
||||||
num_block_tests = 0;
|
cd block_bytecode
|
||||||
cd([top_test_dir filesep 'block_bytecode']);
|
|
||||||
tic;
|
tic;
|
||||||
for blockFlag = 0:1
|
for blockFlag = 0:1
|
||||||
for storageFlag = 0:2 % 0=M-file, 1=use_dll, 2=bytecode
|
for storageFlag = 0:2 % 0=M-file, 1=use_dll, 2=bytecode
|
||||||
|
@ -62,7 +56,6 @@ for blockFlag = 0:1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for i = 1:length(solve_algos)
|
for i = 1:length(solve_algos)
|
||||||
num_block_tests = num_block_tests + 1;
|
|
||||||
if !blockFlag && storageFlag == 0 && (i == 1)
|
if !blockFlag && storageFlag == 0 && (i == 1)
|
||||||
## This is the reference simulation path against which all
|
## This is the reference simulation path against which all
|
||||||
## other simulations will be tested
|
## other simulations will be tested
|
||||||
|
@ -105,7 +98,6 @@ for blockFlag = 0:1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
for i = 1:length(stack_solve_algos)
|
for i = 1:length(stack_solve_algos)
|
||||||
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
|
clear oo_ # Ensure that oo_.endo_simul won’t be overwritten when loading wsOct
|
||||||
|
@ -130,22 +122,17 @@ for blockFlag = 0:1
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
ecput = toc;
|
|
||||||
delete('wsOct');
|
delete('wsOct');
|
||||||
cd(top_test_dir);
|
|
||||||
fid = fopen('run_block_byte_tests_octave.o.trs', 'w+');
|
|
||||||
if size(failedBlock,2) > 0
|
if size(failedBlock,2) > 0
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
fprintf('\n*** Failed tests: %s\n', failedBlock{:})
|
||||||
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{:});
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: %d\n', num_block_tests);
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
end
|
end
|
||||||
fprintf(fid,':elapsed-time: %f\n', ecput);
|
|
||||||
fclose(fid);
|
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', toc);
|
||||||
|
|
||||||
|
quit(size(failedBlock,2) > 0)
|
||||||
|
|
||||||
## Local variables:
|
## Local variables:
|
||||||
## mode: Octave
|
## mode: Octave
|
||||||
## End:
|
## End:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
% Copyright © 2021 Dynare Team
|
% Copyright © 2021-2023 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -15,8 +15,9 @@
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
dynare_config
|
dynare_config
|
||||||
|
|
||||||
cd kronecker
|
cd kronecker
|
||||||
|
@ -32,25 +33,12 @@ disp('')
|
||||||
disp('**** Testing A_times_B_kronecker_C MEX...')
|
disp('**** Testing A_times_B_kronecker_C MEX...')
|
||||||
info(3) = test_kron(3, num_procs);
|
info(3) = test_kron(3, num_procs);
|
||||||
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
if isoctave
|
|
||||||
ext = '.o.trs';
|
|
||||||
else
|
|
||||||
ext = '.m.trs';
|
|
||||||
end
|
|
||||||
fid = fopen([ 'run_kronecker_tests' ext ], 'w+');
|
|
||||||
num_failed_tests = sum(~info);
|
num_failed_tests = sum(~info);
|
||||||
tests = { 'sparse1', 'sparse2', 'dense' };
|
tests = { 'sparse1', 'sparse2', 'dense' };
|
||||||
failed_tests = tests(find(~info));
|
failed_tests = tests(find(~info));
|
||||||
|
|
||||||
if num_failed_tests > 0
|
if num_failed_tests > 0
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
fprintf('\n*** Failed tests: %s\n', failed_tests{:})
|
||||||
fprintf(fid,':number-tests: 3\n');
|
|
||||||
fprintf(fid,':number-failed-tests: %d\n', num_failed_tests);
|
|
||||||
fprintf(fid,':list-of-failed-tests: %s\n', failed_tests{:});
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: 3\n');
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
end
|
end
|
||||||
fclose(fid);
|
|
||||||
|
quit(num_failed_tests > 0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
% Copyright © 2013-2022 Dynare Team
|
% Copyright © 2013-2023 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -15,21 +15,16 @@
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
% Test Dynare Version
|
|
||||||
if ~strcmp(dynare_version(), getenv('DYNARE_VERSION'))
|
|
||||||
error('Incorrect version of Dynare is being tested')
|
|
||||||
end
|
|
||||||
|
|
||||||
% To add default directories, empty dseries objects
|
% To add default directories, empty dseries objects
|
||||||
dynare_config
|
dynare_config;
|
||||||
|
|
||||||
disp('');
|
disp('');
|
||||||
disp(['*** TESTING: run_reporting_test_matlab.m ***']);
|
disp(['*** TESTING: run_reporting_test_matlab.m ***']);
|
||||||
try
|
try
|
||||||
cd([top_test_dir filesep 'reporting']);
|
cd reporting
|
||||||
db_a = dseries('db_a.csv');
|
db_a = dseries('db_a.csv');
|
||||||
db_q = dseries('db_q.csv');
|
db_q = dseries('db_q.csv');
|
||||||
dc_a = dseries('dc_a.csv');
|
dc_a = dseries('dc_a.csv');
|
||||||
|
@ -40,18 +35,4 @@ catch
|
||||||
testFailed = true;
|
testFailed = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
quit(testFailed)
|
||||||
fid = fopen('run_reporting_test_matlab.m.trs', 'w+');
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':number-tests: 1\n');
|
|
||||||
fprintf(fid,':number-failed-tests: 1\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: run_reporting_test_matlab.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: 1\n');
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':elapsed-time: %f\n',0.0);
|
|
||||||
fclose(fid);
|
|
||||||
exit;
|
|
||||||
|
|
|
@ -15,23 +15,18 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
## along with Dynare. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
top_test_dir = getenv('TOP_TEST_DIR');
|
source_dir = getenv('source_root');
|
||||||
addpath([top_test_dir filesep 'utils']);
|
addpath([source_dir filesep 'tests' filesep 'utils']);
|
||||||
addpath([top_test_dir filesep '..' filesep 'matlab']);
|
addpath([source_dir filesep 'matlab']);
|
||||||
|
|
||||||
load_octave_packages
|
load_octave_packages
|
||||||
|
|
||||||
## Test Dynare Version
|
|
||||||
if !strcmp(dynare_version(), getenv("DYNARE_VERSION"))
|
|
||||||
error("Incorrect version of Dynare is being tested")
|
|
||||||
endif
|
|
||||||
|
|
||||||
## To add default directories, empty dseries objects
|
## To add default directories, empty dseries objects
|
||||||
dynare_config();
|
dynare_config();
|
||||||
|
|
||||||
printf("\n*** TESTING: run_reporting_test_octave.m ***\n");
|
printf("\n*** TESTING: run_reporting_test_octave.m ***\n");
|
||||||
try
|
try
|
||||||
cd([top_test_dir filesep 'reporting']);
|
cd reporting
|
||||||
db_a = dseries('db_a.csv');
|
db_a = dseries('db_a.csv');
|
||||||
db_q = dseries('db_q.csv');
|
db_q = dseries('db_q.csv');
|
||||||
dc_a = dseries('dc_a.csv');
|
dc_a = dseries('dc_a.csv');
|
||||||
|
@ -42,21 +37,7 @@ catch
|
||||||
testFailed = true;
|
testFailed = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
cd(getenv('TOP_TEST_DIR'));
|
quit(testFailed)
|
||||||
fid = fopen('run_reporting_test_octave.o.trs', 'w+');
|
|
||||||
if testFailed
|
|
||||||
fprintf(fid,':test-result: FAIL\n');
|
|
||||||
fprintf(fid,':number-tests: 1\n');
|
|
||||||
fprintf(fid,':number-failed-tests: 1\n');
|
|
||||||
fprintf(fid,':list-of-failed-tests: run_reporting_test_octave.m\n');
|
|
||||||
else
|
|
||||||
fprintf(fid,':test-result: PASS\n');
|
|
||||||
fprintf(fid,':number-tests: 1\n');
|
|
||||||
fprintf(fid,':number-failed-tests: 0\n');
|
|
||||||
fprintf(fid,':list-of-passed-tests: run_reporting_test_octave.m\n');
|
|
||||||
end
|
|
||||||
fprintf(fid,':elapsed-time: %f\n',0.0);
|
|
||||||
fclose(fid);
|
|
||||||
|
|
||||||
## Local variables:
|
## Local variables:
|
||||||
## mode: Octave
|
## mode: Octave
|
||||||
|
|
Loading…
Reference in New Issue