testAll.m 804 Bytes
Newer Older
Laurent Heirendt's avatar
Laurent Heirendt committed
1
% include the root folder and all subfolders.
Laurent Heirendt's avatar
Laurent Heirendt committed
2
addpath(genpath(pwd));
Laurent Heirendt's avatar
Laurent Heirendt committed
3

Laurent Heirendt's avatar
Laurent Heirendt committed
4
5
6
% define a success exit code
exit_code = 0;

Laurent Heirendt's avatar
Laurent Heirendt committed
7
8
9
10
11
try

    % save the userpath
    originalUserPath = path;

Laurent Heirendt's avatar
Laurent Heirendt committed
12
    result = runtests('./test/', 'Recursively', true, 'BaseFolder', '*suite*');
Laurent Heirendt's avatar
Laurent Heirendt committed
13
14
15
16
17
18
19

    sumFailed = 0;
    sumIncomplete = 0;

    % print out a summary table
    table(result)

Laurent Heirendt's avatar
Laurent Heirendt committed
20
    for i = 1:size(result,2)
Laurent Heirendt's avatar
Laurent Heirendt committed
21
22
        sumFailed = sumFailed + result(i).Failed
        sumIncomplete = sumIncomplete + result(i).Incomplete
Laurent Heirendt's avatar
Laurent Heirendt committed
23
24
    end

Laurent Heirendt's avatar
Laurent Heirendt committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
    % restore the original path
    restoredefaultpath;
    addpath(originalUserPath);

    if sumFailed > 0 || sumIncomplete > 0
        exit_code = 1;
    end

    % ensure that we ALWAYS call exit
    if ~isempty(strfind(getenv('HOME'), 'jenkins'))
        exit(exit_code);
    end
catch
    exit(1);
end