runalltests.m 1.9 KB
Newer Older
Stéphane Adjemian's avatar
Stéphane Adjemian committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
% Copyright (C) 2015-2017 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/>.

16
17
opath = path();

18
19
system('rm -f failed');

20
% Check that the m-unit-tests module is available.
21
22
23

install_unit_test_toolbox = false;

24
25
26
27
try
    initialize_unit_tests_toolbox;
catch
    urlwrite('https://github.com/DynareTeam/m-unit-tests/archive/master.zip','master.zip');
28
29
30
31
32
33
    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']);
34
    initialize_unit_tests_toolbox;
35
    install_unit_test_toolbox = true;
36
37
end

38
39
40
% Get path to the current script
unit_tests_root = strrep(which('runalltests'),'runalltests.m','');

41
42
43
44
% Initialize the dseries module
try
    initialize_dseries_toolbox;
catch
Stéphane Adjemian's avatar
Stéphane Adjemian committed
45
    addpath([unit_tests_root '../src']);
46
47
48
    initialize_dseries_toolbox;
end

49
50
warning off

Stéphane Adjemian's avatar
Stéphane Adjemian committed
51
52
if isoctave()
    pkg install -forge io
53
    more off;
54
    addpath([unit_tests_root 'fake']);
55
56
end

Stéphane Adjemian's avatar
Stéphane Adjemian committed
57
58
tmp = dseries_src_root;
tmp = tmp(1:end-1); % Remove trailing slash.
59
report = run_unitary_tests_in_directory(tmp);
60
61

delete('*.log');
62
63
64
65

if install_unit_test_toolbox
    rmdir('../externals/m-unit-tests-master','s');
end
66
67
68

if any(~[report{:,3}])
    system('touch failed');
69
70
71
end

warning on
72
path(opath);