Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 79ee371

Browse files
authored
Merge pull request #45 from mathworks/1.0.4-Qualification
Fix for g2136203 and cobertura model coverage
2 parents 9d6054e + 9a8725c commit 79ee371

File tree

8 files changed

+31
-19
lines changed

8 files changed

+31
-19
lines changed

src/main/java/com/mathworks/ci/MatlabBuilder.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ private String[] getRunnerSwitch() {
585585
String matlabFunctionName =
586586
FilenameUtils.removeExtension(Message.getValue(MatlabBuilderConstants.MATLAB_RUNNER_TARGET_FILE));
587587
runCommand = "try,exit(" + matlabFunctionName + "("
588-
+ getInputArguments() + ","
588+
+ getInputArguments()
589589
+ ")),catch e,disp(getReport(e,'extended')),exit(1),end";
590590
} else {
591591
runCommand = "try,eval(\"" + getCustomMatlabCommand().replaceAll("\"","\"\"")
@@ -617,14 +617,12 @@ private String getNodeSpecificFileSeperator(Launcher launcher) {
617617

618618
// Concatenate the input arguments
619619
private String getInputArguments() {
620-
MatlabBuilderConstants constants = new MatlabBuilderConstants();
621-
622-
String pdfReport = constants.PDF_REPORT + "," + getTestRunTypeList().getBooleanByName("taPDFReportChkBx");
623-
String tapResults = constants.TAP_RESULTS + "," + getTestRunTypeList().getBooleanByName("tatapChkBx");
624-
String junitResults = constants.JUNIT_RESULTS + "," + getTestRunTypeList().getBooleanByName("taJunitChkBx");
625-
String stmResults = constants.STM_RESULTS + "," + getTestRunTypeList().getBooleanByName("taSTMResultsChkBx");
626-
String coberturaCodeCoverage = constants.COBERTURA_CODE_COVERAGE + "," + getTestRunTypeList().getBooleanByName("taCoberturaChkBx");
627-
String coberturaModelCoverage = constants.COBERTURA_MODEL_COVERAGE + "," + getTestRunTypeList().getBooleanByName("taModelCoverageChkBx");
620+
String pdfReport = MatlabBuilderConstants.PDF_REPORT + "," + getTestRunTypeList().getBooleanByName("taPDFReportChkBx");
621+
String tapResults = MatlabBuilderConstants.TAP_RESULTS + "," + getTestRunTypeList().getBooleanByName("tatapChkBx");
622+
String junitResults = MatlabBuilderConstants.JUNIT_RESULTS + "," + getTestRunTypeList().getBooleanByName("taJunitChkBx");
623+
String stmResults = MatlabBuilderConstants.STM_RESULTS + "," + getTestRunTypeList().getBooleanByName("taSTMResultsChkBx");
624+
String coberturaCodeCoverage = MatlabBuilderConstants.COBERTURA_CODE_COVERAGE + "," + getTestRunTypeList().getBooleanByName("taCoberturaChkBx");
625+
String coberturaModelCoverage = MatlabBuilderConstants.COBERTURA_MODEL_COVERAGE + "," + getTestRunTypeList().getBooleanByName("taModelCoverageChkBx");
628626

629627
String inputArgsToMatlabFcn = pdfReport + "," + tapResults + "," + junitResults + ","
630628
+ stmResults + "," + coberturaCodeCoverage + "," + coberturaModelCoverage;

src/main/java/com/mathworks/ci/MatlabBuilderConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class MatlabBuilderConstants {
77
static final double BASE_MATLAB_VERSION_RUNTESTS_SUPPORT = 8.1;
88
static final double BASE_MATLAB_VERSION_BATCH_SUPPORT = 9.5;
99
static final double BASE_MATLAB_VERSION_COBERTURA_SUPPORT = 9.3;
10-
static final double BASE_MATLAB_VERSION_MODELCOVERAGE_SUPPORT = 9.4;
10+
static final double BASE_MATLAB_VERSION_MODELCOVERAGE_SUPPORT = 9.5;
1111
static final double BASE_MATLAB_VERSION_EXPORTSTMRESULTS_SUPPORT = 9.6;
1212

1313
static final String MATLAB_RUNNER_TARGET_FILE = "Builder.matlab.runner.target.file.name";
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div>
22
<br>Generate a Cobertura model coverage report, <b>coberturamodelcoverage.xml</b>, and save it in the <b>matlabTestArtifacts</b> folder of the Jenkins workspace.
33
This report includes coverage results for Simulink&#174; models that are tested using Simulink Test&#8482;.<br>
4-
<br>Note: This feature requires a <b>Simulink Coverage&#8482;</b> license and is supported only in MATLAB R2018a or a newer release.<br>
4+
<br>Note: This feature requires a <b>Simulink Coverage&#8482;</b> license and is supported only in MATLAB R2018b or a newer release.<br>
55
<br>
66
</div>

src/main/resources/com/mathworks/ci/MatlabBuilder/runMatlabTests.m

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@
8484
end
8585
end
8686

87-
% Produce Cobertura model coverage report (Not supported below R2018a)
87+
% Produce Cobertura model coverage report (Not supported below R2018b)
8888
if produceModelCoverage
89-
if ~exist('sltest.plugins.ModelCoveragePlugin', 'class')
89+
if ~exist('sltest.plugins.ModelCoveragePlugin', 'class') || ~coberturaModelCoverageSupported
9090
warning('MATLAB:testArtifact:cannotGenerateModelCoverageReport', ...
91-
'Unable to generate Cobertura model coverage report. To generate the report, use a Simulink Coverage license with MATLAB R2018a or a newer release.');
91+
'Unable to generate Cobertura model coverage report. To generate the report, use a Simulink Coverage license with MATLAB R2018b or a newer release.');
9292
else
93-
import sltest.plugins.ModelCoveragePlugin;
93+
import('sltest.plugins.ModelCoveragePlugin');
9494

9595
mkdirIfNeeded(resultsDir);
9696
coverageFile = fullfile(resultsDir, 'coberturamodelcoverage.xml');
@@ -117,7 +117,7 @@
117117
issuePDFReportUnsupportedWarning;
118118
else
119119
mkdirIfNeeded(resultsDir);
120-
import matlab.unittest.plugins.TestReportPlugin;
120+
import('matlab.unittest.plugins.TestReportPlugin');
121121
runner.addPlugin(TestReportPlugin.producingPDF(getPDFFilePath(resultsDir)));
122122

123123
if ~stmResultsPluginAddedToRunner && stmResultsPluginPresent
@@ -171,6 +171,11 @@ function mkdirIfNeeded(dir)
171171
function tf = stmResultsPluginPresent
172172
tf = logical(exist('sltest.plugins.TestManagerResultsPlugin', 'class'));
173173

174+
function tf = coberturaModelCoverageSupported
175+
BASE_VERSION_MODELCOVERAGE_SUPPORT = '9.5'; % R2018b
176+
177+
tf = ~verLessThan('matlab',BASE_VERSION_MODELCOVERAGE_SUPPORT);
178+
174179
function tf = exportSTMResultsSupported
175180
BASE_VERSION_EXPORTSTMRESULTS_SUPPORT = '9.6'; % R2019a
176181

src/main/resources/config.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ Builder.matlab.test.support.error = To run tests with the Jenkins plugin, use MA
1010
builder.matlab.automatictestoption.display.name = Automatic
1111
builder.matlab.customcommandoption.display.name = Custom
1212
Releaseinfo.matlab.version.not.found.error = Error finding MATLAB release for given MATLAB root. Verify MATLAB root path.
13-
Builder.matlab.modelcoverage.support.warning = To generate a Cobertura model coverage report, use MATLAB R2018a or a newer release.
13+
Builder.matlab.modelcoverage.support.warning = To generate a Cobertura model coverage report, use MATLAB R2018b or a newer release.
1414
Builder.matlab.exportstmresults.support.warning = To export Simulink Test Manager results, use MATLAB R2019a or a newer release.
1515

src/test/java/com/mathworks/ci/MatlabBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ public void verifyCoberturaWarning() throws Exception {
427427
@Test
428428
public void verifyModelCoverageWarning() throws Exception {
429429
project.getBuildersList().add(this.matlabBuilder);
430-
this.matlabBuilder.setMatlabRoot(getMatlabroot("R2017a"));
430+
this.matlabBuilder.setMatlabRoot(getMatlabroot("R2018a"));
431431
HtmlPage page = jenkins.createWebClient().goTo("job/test0/configure");
432432
HtmlCheckBoxInput modelCoverageChkBx = page.getElementByName("taModelCoverageChkBx");
433433
modelCoverageChkBx.setChecked(true);

src/test/resources/testconfig.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Verify.build.ignore.test.failure = Build Ignored test failure
66
Builder.matlab.cobertura.support.warning = To generate a Cobertura code coverage report, use MATLAB R2017b or a newer release.
77
Builder.invalid.matlab.root.warning = Unable to find MATLAB from the specified location on this system(but perhaps it exists on some agents)
88
Builder.matlab.root.empty.error = Full path to the MATLAB root folder is required.
9-
Builder.matlab.modelcoverage.support.warning = To generate a Cobertura model coverage report, use MATLAB R2018a or a newer release.
9+
Builder.matlab.modelcoverage.support.warning = To generate a Cobertura model coverage report, use MATLAB R2018b or a newer release.
1010
Builder.matlab.exportstmresults.support.warning = To export Simulink Test Manager results, use MATLAB R2019a or a newer release.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Version information for MathWorks R2018a Release -->
3+
<MathWorks_version_info>
4+
<version>9.4.0.813654</version>
5+
<release>R2018a</release>
6+
<description></description>
7+
<date>Feb 23 2018</date>
8+
<checksum>4291774302</checksum>
9+
</MathWorks_version_info>

0 commit comments

Comments
 (0)