diff --git a/Makefile b/Makefile index 4bdd337dd2c1d62e036146a281e239ea7d855855..7fabee88e949d76dfae4936e301c58849e71873c 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,20 @@ -# Makefile for creating the source tarball +DYNARE_VERSION=4.0.4 -DYNAREBASE=dynare-4.0.4 +DYNAREBASE=dynare-$(DYNARE_VERSION) + +all: +.PHONY: all + +check: + make -C tests $@ DYNARE_VERSION=$(DYNARE_VERSION) +.PHONY: check srctarball: make -C preprocessor clean make -C doc clean + make -C tests clean rm -f matlab/dynare_m matlab/dynare_m.exe rm -f mex/2007a/* mex/2007b/* mex/octave/*.mex rm -f windows/*.exe tar cvzf ../$(DYNAREBASE).tar.gz --transform 's,^\./,$(DYNAREBASE)/,' --exclude=debian --exclude='*~' --exclude-vcs . +.PHONY: srctarball diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9b2be4970828dd83b1bec8ff01d64b4e8ec55ff6 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,76 @@ +OCTAVE = octave + +DYNARE_ROOT = `pwd`/../matlab + +# 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 diff --git a/tests/run_test_octave.m b/tests/run_test_octave.m new file mode 100644 index 0000000000000000000000000000000000000000..9c81c692adea2346cfc3f08359ba983dce5f0f36 --- /dev/null +++ b/tests/run_test_octave.m @@ -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: