diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..7834d80d4f1d9b32bf9b1582dd8635e9798570be --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,20 @@ +variables: + GIT_SUBMODULE_STRATEGY: normal + TERM: linux + +before_script: + - git clone https://git.dynare.org/Dynare/m-unit-tests + +testsuite_matlab: + stage: test + script: + - make check-matlab + - ./success.sh + +testsuite_octave: + stage: test + variables: + OPENBLAS_NUM_THREADS: 1 + script: + - cp -r binaries/linux externals/x13 + - ./success.sh diff --git a/Makefile b/Makefile index 7c1a49eb8b7ea9f6353dcffde5cd330800794f24..9ecdb0b4e1a95e69306b4fabeab074e16ac1feb6 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,10 @@ all: check-octave check-matlab check-octave: @cd tests ;\ - $(OCTAVE) --no-init-file --silent --no-history runalltests.m + $(OCTAVE) --no-init-file --silent --no-history --eval "addpath ../m-unit-tests/src; runalltests" check-matlab: - @$(MATLAB) -nosplash -nodisplay -r "cd tests; runalltests; quit" + @$(MATLAB) -nosplash -nodisplay -r "addpath m-unit-tests/src; cd tests; runalltests; quit" + +check-clean: + rm -f tests/*_test_*.m tests/*.csv tests/*.xls tests/*.xlsx tests/*.mat tests/failed tests/datafile_for_test diff --git a/README.md b/README.md index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..12cf6609a939c305dee8ca284c0016c32a25246a 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +[](https://git.dynare.org/Dynare/dates/commits/master) diff --git a/success.sh b/success.sh index 125cc1bf2b587ed641928c2c815e0456fe2eb4e3..650a7d0179cacb4535cb81e691284843f989db93 100755 --- a/success.sh +++ b/success.sh @@ -1,5 +1,8 @@ -#!/bin/sh -if [ -f ./tests/failed ] -then - exit 1 +#!/bin/bash +if [[ -f ./tests/failed ]]; then + exit 1 +elif [[ -f ./tests/pass ]]; then + exit 0 +else + exit 1 fi diff --git a/tests/runalltests.m b/tests/runalltests.m index aff3685577c837eed31c55876849c25e26a5aa06..35194e231efbf1d5618bf60da27d07512e2e817b 100644 --- a/tests/runalltests.m +++ b/tests/runalltests.m @@ -1,25 +1,36 @@ +function runalltests() + +% Copyright (C) 2015-2018 Dynare Team +% +% This code 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 dseries submodule 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/>. + +dates_src_root = []; % Initialize path as an array to be updated + % when calling initialize_dseries_toolbox() script. + opath = path(); system('rm -f failed'); +system('rm -f pass'); -% Check that the m-unit-tests module is available. -install_unit_test_toolbox = false; - +% Initialize m-unit-test submodule try initialize_unit_tests_toolbox; catch - urlwrite('https://git.dynare.org/Dynare/m-unit-tests/-/archive/master/m-unit-tests-master.zip','master.zip'); - warning('off','MATLAB:MKDIR:DirectoryExists'); - mkdir('../externals'); - warning('on','MATLAB:MKDIR:DirectoryExists'); - unzip('master.zip','../externals'); - delete('master.zip'); - addpath([pwd() '/../externals/m-unit-tests-master/src']); - initialize_unit_tests_toolbox; - install_unit_test_toolbox = true; + error('Missing dependency: m-unit-tests module is not available.') end -% Initialize the dseries module +% Initialize the dates submodule try initialize_dates_toolbox; catch @@ -32,17 +43,16 @@ if isoctave more off; end -tmp = dates_src_root; -tmp = tmp(1:end-1); % Remove trailing slash. -report = run_unitary_tests_in_directory(tmp); +r = run_unitary_tests_in_directory(dates_src_root(1:end-1)); delete('*.log'); -if install_unit_test_toolbox - rmdir('../externals/m-unit-tests-master','s'); +if any(~[r{:,3}]) + system('touch failed'); +else + system('touch pass'); end + path(opath); -if any(~[report{:,3}]) - system('touch failed'); -end \ No newline at end of file +display_report(r); \ No newline at end of file