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

Commit 1a284ff

Browse files
abhargav-mwSangavi Jayagopi
andauthored
2.1.3 snapshot qualification temp path (#131)
* Temp path issue (#128) * Fix Java temp path discrepancy * Fix Java temp path discrepancy * Fix Java temp dir discrepancy * Fix test for temp dir discrepancy * Fix Java temp path discrepancy * Fix Java temp dir path discrepancy * Fix temp path issue_Incorporate reviews * Fix temp path discrepancy_use computer channel * Change code coverage tool to JaCoCo (#129) * Unit Test failure induced to check Azure Build * Removing induces test failure * Removed induced test failure Co-authored-by: Sangavi Jayagopi <[email protected]>
1 parent 51c30fa commit 1a284ff

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ steps:
2525
mavenOptions: '-Xmx3072m -Dmaven.javadoc.skip=true'
2626
publishJUnitResults: true
2727
testResultsFiles: '**/surefire-reports/TEST-*.xml'
28-
codeCoverageToolOption: 'cobertura'
28+
codeCoverageToolOption: 'JaCoCo'
2929
goals: 'verify'
3030
displayName: 'Build $(imageName)'
3131

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,21 @@ default FilePath getFilePathForUniqueFolder(Launcher launcher, String uniqueName
7676
* https://javadoc.jenkins-ci.org/jenkins/tasks/SimpleBuildStep.html */
7777

7878
String tmpDir = getNodeSpecificTmpFolderPath(workspace);
79-
return new FilePath(launcher.getChannel(), tmpDir+"/"+uniqueName);
79+
80+
return new FilePath(launcher.getChannel(), tmpDir + "/" + uniqueName);
8081
}
8182

8283
default String getNodeSpecificTmpFolderPath(FilePath workspace) throws IOException, InterruptedException {
8384
Computer cmp = workspace.toComputer();
8485
if (cmp == null) {
8586
throw new IOException(Message.getValue("build.workspace.computer.not.found"));
8687
}
87-
String tmpDir = (String) cmp.getSystemProperties().get("java.io.tmpdir");
88-
return tmpDir;
88+
89+
String tmpDirPath = (String) cmp.getSystemProperties().get("java.io.tmpdir");
90+
91+
// Invoke FilePath.normalize for clean file path on any channel.
92+
FilePath tmpDir = new FilePath(cmp.getChannel(), tmpDirPath);
93+
return tmpDir.getRemote();
8994
}
9095

9196
default String getUniqueNameForRunnerFile() {

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void verifyBuildFailureWhenMatlabCommandFails() throws Exception {
187187
*/
188188

189189
@Test
190-
public void verifyBuildFailureWhenMatlabCommandPasses() throws Exception {
190+
public void verifyBuildPassesWhenMatlabCommandPasses() throws Exception {
191191
this.buildWrapper.setMatlabRootFolder(getMatlabroot("R2018b"));
192192
project.getBuildWrappersList().add(this.buildWrapper);
193193
RunMatlabCommandBuilderTester tester =
@@ -196,6 +196,7 @@ public void verifyBuildFailureWhenMatlabCommandPasses() throws Exception {
196196
project.getBuildersList().add(tester);
197197
FreeStyleBuild build = project.scheduleBuild2(0).get();
198198
jenkins.assertBuildStatus(Result.SUCCESS, build);
199+
199200
}
200201

201202
/*
@@ -249,6 +250,9 @@ public void verifyCommandSupportsEnvVar() throws Exception {
249250

250251
/*
251252
* Test to verify if appropriate MATALB runner file is copied in workspace.
253+
*
254+
* NOTE: This test assumes there is no MATLAB installed and is not on System Path.
255+
*
252256
*/
253257
@Test
254258
public void verifyMATLABrunnerFileGenerated() throws Exception {
@@ -262,6 +266,9 @@ public void verifyMATLABrunnerFileGenerated() throws Exception {
262266

263267
/*
264268
* Test to verify if Matrix build fails when MATLAB is not available.
269+
*
270+
* NOTE: This test assumes there is no MATLAB installed and is not on System Path.
271+
*
265272
*/
266273
@Test
267274
public void verifyMatrixBuildFails() throws Exception {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ public void veriyEmptyParameters() throws Exception {
334334

335335
/*
336336
* Test to verify if appropriate MATALB runner file is copied in workspace.
337+
*
338+
* NOTE: This test assumes there is no MATLAB installed and is not on System Path.
339+
*
337340
*/
338341
@Test
339342
public void verifyMATLABrunnerFileGeneratedForAutomaticOption() throws Exception {
@@ -346,6 +349,9 @@ public void verifyMATLABrunnerFileGeneratedForAutomaticOption() throws Exception
346349

347350
/*
348351
* Test to verify if Matrix build fails when MATLAB is not available.
352+
*
353+
* NOTE: This test assumes there is no MATLAB installed and is not on System Path.
354+
*
349355
*/
350356
@Test
351357
public void verifyMatrixBuildFails() throws Exception {

0 commit comments

Comments
 (0)