Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gdat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab is being updated to the latest version (v17.9.2). No downtime is expected.
Show more breadcrumbs
SPC
gdat
Commits
56eb97bd
Commit
56eb97bd
authored
3 years ago
by
Federico Felici
Committed by
Olivier Sauter
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve project path definition
parent
7d4e8e55
No related branches found
Branches containing commit
No related tags found
1 merge request
!110
Add test coverage and update test scripts
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/run_gdat_tests.m
+6
-4
6 additions, 4 deletions
matlab/run_gdat_tests.m
with
6 additions
and
4 deletions
matlab/run_gdat_tests.m
+
6
−
4
View file @
56eb97bd
function
[
passed
,
results
]
=
run_
tbx
_tests
(
test_case
,
coverage_report
)
function
[
passed
,
results
]
=
run_
gdat
_tests
(
test_case
,
coverage_report
)
% Test runner for generic toolbox tests
% Test runner for generic toolbox tests
if
nargin
==
0
||
isempty
(
test_case
)
if
nargin
==
0
||
isempty
(
test_case
)
...
@@ -30,6 +30,8 @@ end
...
@@ -30,6 +30,8 @@ end
% add path of toolbox to make sure it is in the path
% add path of toolbox to make sure it is in the path
tbxpath
=
fileparts
(
mfilename
(
'fullpath'
));
tbxpath
=
fileparts
(
mfilename
(
'fullpath'
));
addpath
(
tbxpath
);
% add default path
addpath
(
tbxpath
);
% add default path
projectpath
=
getenv
(
'CI_PROJECT_DIR'
);
if
isempty
(
projectpath
),
projectpath
=
tbxpath
;
end
% add additional paths present in a local setpaths_* file
% add additional paths present in a local setpaths_* file
setpathsfile
=
dir
(
fullfile
(
tbxpath
,
'setpaths_*'
));
setpathsfile
=
dir
(
fullfile
(
tbxpath
,
'setpaths_*'
));
...
@@ -84,7 +86,7 @@ fprintf('Start test case: %s\n%s\n\n',test_case,datestr(now));
...
@@ -84,7 +86,7 @@ fprintf('Start test case: %s\n%s\n\n',test_case,datestr(now));
runner
=
matlab
.
unittest
.
TestRunner
.
withTextOutput
;
runner
=
matlab
.
unittest
.
TestRunner
.
withTextOutput
;
if
needXML
if
needXML
% Add some JUnit XML file with tests results
% Add some JUnit XML file with tests results
xmlFile
=
fullfile
(
getenv
(
'CI_PROJECT_DIR'
)
,
sprintf
(
'test_%s_%s.xml'
,
test_case
,
version
(
'-release'
)));
xmlFile
=
fullfile
(
projectpath
,
sprintf
(
'test_%s_%s.xml'
,
test_case
,
version
(
'-release'
)));
fprintf
(
'\tGenerating JUnit XML report at %s\n'
,
xmlFile
);
fprintf
(
'\tGenerating JUnit XML report at %s\n'
,
xmlFile
);
p
=
XMLPlugin
.
producingJUnitFormat
(
xmlFile
);
p
=
XMLPlugin
.
producingJUnitFormat
(
xmlFile
);
runner
.
addPlugin
(
p
)
runner
.
addPlugin
(
p
)
...
@@ -94,11 +96,11 @@ if needCOV
...
@@ -94,11 +96,11 @@ if needCOV
switch
lower
(
test_case
)
switch
lower
(
test_case
)
case
'coverage'
case
'coverage'
% Produce HTML report
% Produce HTML report
reportFolder
=
sprintf
(
'test_%s_cov'
,
version
(
'-release'
));
reportFolder
=
fullfile
(
projectpath
,
sprintf
(
'test_%s_cov'
,
version
(
'-release'
))
)
;
reportFormat
=
matlab
.
unittest
.
plugins
.
codecoverage
.
CoverageReport
(
reportFolder
);
reportFormat
=
matlab
.
unittest
.
plugins
.
codecoverage
.
CoverageReport
(
reportFolder
);
otherwise
otherwise
% Produce XML file in Cobertura format (for Gitlab MR viz.)
% Produce XML file in Cobertura format (for Gitlab MR viz.)
xmlFile
=
fullfile
(
getenv
(
'CI_PROJECT_DIR'
)
,
sprintf
(
'test_%s_%s_cov.xml'
,
test_case
,
version
(
'-release'
)));
xmlFile
=
fullfile
(
projectpath
,
sprintf
(
'test_%s_%s_cov.xml'
,
test_case
,
version
(
'-release'
)));
reportFormat
=
matlab
.
unittest
.
plugins
.
codecoverage
.
CoberturaFormat
(
xmlFile
);
reportFormat
=
matlab
.
unittest
.
plugins
.
codecoverage
.
CoberturaFormat
(
xmlFile
);
end
end
p
=
matlab
.
unittest
.
plugins
.
CodeCoveragePlugin
.
forFolder
(
fileparts
(
mfilename
(
'fullpath'
)),
...
p
=
matlab
.
unittest
.
plugins
.
CodeCoveragePlugin
.
forFolder
(
fileparts
(
mfilename
(
'fullpath'
)),
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment