trunk: added testsuite for Octave, incorporated in build system (merge needed)

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2760 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2009-06-11 14:58:43 +00:00
parent e3043c4107
commit f74c6f30b2
6 changed files with 173 additions and 36 deletions

View File

@ -1,11 +1,16 @@
all:
make -C preprocessor
make -C doc
make -C preprocessor $@
make -C doc $@
.PHONY: all
check:
make -C tests $@
.PHONY: check
clean:
make -C preprocessor clean
make -C doc clean
make -C preprocessor $@
make -C doc $@
make -C tests $@
rm -f matlab/dynare_m matlab/dynare_m.exe
rm -f mex/2007a/* mex/2007b/* mex/octave/*.mex
rm -f windows/*.exe

42
configure vendored
View File

@ -637,6 +637,7 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
OCTAVE
XSLTPROC
DBLATEX
BIBTEX
@ -3955,7 +3956,45 @@ $as_echo "$as_me: WARNING: The creation of the HTML version will be very slow! Y
fi
fi
ac_config_files="$ac_config_files Makefile preprocessor/Makefile doc/Makefile doc/preprocessor/Makefile doc/macroprocessor/Makefile doc/userguide/Makefile matlab/dynare_version.m windows/dynare-version.nsi"
# Extract the first word of "octave", so it can be a program name with args.
set dummy octave; ac_word=$2
{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_OCTAVE+set}" = set; then
$as_echo_n "(cached) " >&6
else
if test -n "$OCTAVE"; then
ac_cv_prog_OCTAVE="$OCTAVE" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_OCTAVE="octave"
$as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
OCTAVE=$ac_cv_prog_OCTAVE
if test -n "$OCTAVE"; then
{ $as_echo "$as_me:$LINENO: result: $OCTAVE" >&5
$as_echo "$OCTAVE" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
ac_config_files="$ac_config_files Makefile preprocessor/Makefile doc/Makefile doc/preprocessor/Makefile doc/macroprocessor/Makefile doc/userguide/Makefile tests/Makefile matlab/dynare_version.m windows/dynare-version.nsi"
cat >confcache <<\_ACEOF
@ -4572,6 +4611,7 @@ do
"doc/preprocessor/Makefile") CONFIG_FILES="$CONFIG_FILES doc/preprocessor/Makefile" ;;
"doc/macroprocessor/Makefile") CONFIG_FILES="$CONFIG_FILES doc/macroprocessor/Makefile" ;;
"doc/userguide/Makefile") CONFIG_FILES="$CONFIG_FILES doc/userguide/Makefile" ;;
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
"matlab/dynare_version.m") CONFIG_FILES="$CONFIG_FILES matlab/dynare_version.m" ;;
"windows/dynare-version.nsi") CONFIG_FILES="$CONFIG_FILES windows/dynare-version.nsi" ;;

View File

@ -61,12 +61,15 @@ then
fi
fi
AC_CHECK_PROG([OCTAVE], [octave], [octave])
AC_CONFIG_FILES([Makefile
preprocessor/Makefile
doc/Makefile
doc/preprocessor/Makefile
doc/macroprocessor/Makefile
doc/userguide/Makefile
tests/Makefile
matlab/dynare_version.m
windows/dynare-version.nsi])

View File

@ -1,31 +0,0 @@
MODS=$(shell find -name '*.mod')
all:
clean:
# Model files
rm -f $(patsubst %.mod, %.m, $(MODS))
rm -f $(patsubst %.mod, %_static.m, $(MODS))
rm -f $(patsubst %.mod, %_dynamic.m, $(MODS))
# Results
rm -f $(patsubst %.mod, %_results.mat, $(MODS))
rm -f $(patsubst %.mod, %_mode.mat, $(MODS))
rm -f $(patsubst %.mod, %_mh_mode.mat, $(MODS))
rm -f $(patsubst %.mod, %_mean.mat, $(MODS))
rm -f $(patsubst %.mod, %_pindx.mat, $(MODS))
rm -f $(patsubst %.mod, %_params.mat, $(MODS))
rm -rf $(patsubst %.mod, %, $(MODS))
rm -f $(patsubst %.mod, %.log, $(MODS))
# Graphics
rm -f $(patsubst %.mod, %*.pdf, $(MODS))
rm -f $(patsubst %.mod, %*.eps, $(MODS))
rm -f $(patsubst %.mod, %*.fig, $(MODS))
# Remove files generated by csminwel.m
rm -f $(shell find -name g1.mat)
rm -f $(shell find -name g2.mat)
rm -f $(shell find -name g3.mat)
rm -f $(shell find -name H.dat)

82
tests/Makefile.in Normal file
View File

@ -0,0 +1,82 @@
OCTAVE = @OCTAVE@
DYNARE_ROOT = @abs_top_srcdir@/matlab
DYNARE_VERSION = @PACKAGE_VERSION@
# Under Octave we only test a subset of MOD files, because of missing features (models with unit roots, reading Excel files)
OCTAVE_MODS = \
ramst.mod \
ramst_a.mod \
example1.mod \
t_sgu_ex1.mod \
arima/mod1.mod \
arima/mod1a.mod \
arima/mod2.mod \
arima/mod2c.mod \
fs2000/fs2000.mod \
homotopy/ramst_homotopy.mod
MODS = $(OCTAVE_MODS) \
arima/mod1b.mod \
arima/mod1c.mod \
arima/mod2a.mod \
arima/mod2b.mod \
fs2000/fs2000a.mod \
bvar_a_la_sims/bvar_standalone.mod \
bvar_a_la_sims/bvar_and_dsge.mod
check: check-octave check-matlab
.PHONY: check
check-octave: $(OCTAVE_MODS)
ifdef OCTAVE
@set -e; \
for modfile in $(OCTAVE_MODS); do \
GNUTERM=dumb $(OCTAVE) --norc --silent --no-history run_test_octave.m $$modfile $(DYNARE_ROOT) $(DYNARE_VERSION); \
done
endif
.PHONY: check-octave
check-matlab: $(MODS)
# MATLAB stuff to be added here
.PHONY: check-matlab
clean:
# Files generated by the preprocessor
rm -f $(patsubst %.mod, %.m, $(MODS)) \
$(patsubst %.mod, %_static.m, $(MODS)) \
$(patsubst %.mod, %_dynamic.m, $(MODS))
# Results
rm -f $(patsubst %.mod, %_results.mat, $(MODS)) \
$(patsubst %.mod, %_mode.mat, $(MODS)) \
$(patsubst %.mod, %_mh_mode.mat, $(MODS)) \
$(patsubst %.mod, %_mean.mat, $(MODS)) \
$(patsubst %.mod, %_pindx.mat, $(MODS)) \
$(patsubst %.mod, %_params.mat, $(MODS)) \
$(patsubst %.mod, %.log, $(MODS))
rm -rf $(patsubst %.mod, %, $(MODS))
# Graphics
rm -f $(patsubst %.mod, %*.pdf, $(MODS)) \
$(patsubst %.mod, %*.eps, $(MODS)) \
$(patsubst %.mod, %*.fig, $(MODS))
# Files generated by csminwel.m
rm -f $(shell find -name g1.mat) \
$(shell find -name g2.mat) \
$(shell find -name g3.mat) \
$(shell find -name H.dat)
# Generated data files
rm -f arima/data1.m arima/data2.m
# Backup files
rm -f $(shell find -name '*~')
.PHONY: clean
# Recreate Makefile when necessary
Makefile: Makefile.in ../config.status
cd .. && ./config.status

38
tests/run_test_octave.m Normal file
View File

@ -0,0 +1,38 @@
## Copyright (C) 2009 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/>.
## 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
[directory, name, ext] = fileparts(argv(){1});
printf("TEST: %s...\n", name)
addpath(argv(){2})
if !strcmp(dynare_version(), argv(){3})
error("Incorrect version of Dynare is being tested")
endif
cd(directory)
dynare(name)
## Local variables:
## mode: Octave
## End: