forked from petercorke/robotics-toolbox-matlab
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRunAllTests.m
76 lines (58 loc) · 2 KB
/
RunAllTests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% run the tests for Travis CI
%
% Travis file system looks like this:
% ./ ** RTB is unpacked at this level, not its own folder
% ./unit_test ** WORKING folder
% ./lib/common
% ./lib/spatial-math
%% set up the test runner
import matlab.unittest.plugins.CodeCoveragePlugin
import matlab.unittest.plugins.codecoverage.CoberturaFormat
import matlab.unittest.TestRunner
suite = testsuite('IncludeSubfolders', false);
runner = TestRunner.withTextOutput;
% add a coverage report
reportFile = fullfile('..', 'coverage.xml');
reportFormat = CoberturaFormat(reportFile);
plugin = CodeCoveragePlugin.forFolder('..', 'Producing',reportFormat);
runner.addPlugin(plugin);
%% compile some codecoverage
%% setup the path
fprintf('---------------------------------- Setup path ------------------------------------\n')
fprintf('-->> current working folder is %s\n', pwd)
% for other toolboxes
addpath ../lib/common
addpath ../lib/spatial-math
% for RTB
addpath ..
addpath ../models
addpath ../data
addpath ../simulink
%path
%system('mount');
originalDir = pwd; % this is the working dir, unit_test folder
% build the Java classes
fprintf('---------------------------------- Build Java classes ------------------------------------\n')
cd ../java
system('make')
javaaddpath DHFactor.jar
% build the MEX file
fprintf('---------------------------------- Build MEX files ------------------------------------\n')
cd ../mex
make
check
cd(originalDir)
addpath ../mex
%% Run all unit tests in my repository
fprintf('---------------------------------- Run the unit tests ------------------------------------\n')
results = runner.run(suite);
% Assert no tests failed
assert(all(~[results.Failed]));
%% Build the toolbox distribution file
fprintf('---------------------------------- Build the MLTBX file ------------------------------------\n')
cd ..
% add more folders to the path to ensure they go in the MLTBX file
addpath demos
addpath examples
addpath Apps
matlab.addons.toolbox.packageToolbox('PackageToolbox.prj', 'RTB.mltbx')