Skip to content
Permalink
Browse files

Fixes JENKINS-24832 : Failed maven builds using -T are showing up as …

…Aborted (#79)
  • Loading branch information
aheritier committed Sep 22, 2016
1 parent c10cfb4 commit 2e671da7a66fc24530d82daef5c7d226414e7978
@@ -221,19 +221,29 @@ public Result getResult() {

private Result computeResult() {
Result r = super.getResult();

if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("Current result is: " + r);
}
for (MavenBuild b : getModuleLastBuilds().values()) {
Result br = b.getResult();
if(r==null)
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("Module result is: " + br + " for " + b.getParent().getGroupId() + ":" +
b.getParent().getArtifactId());
}
if (r == null) {
r = br;
else
if(br==Result.NOT_BUILT)
} else if (br == Result.NOT_BUILT || br == Result.ABORTED) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("Result not updated: " + r);
}
continue; // UGLY: when computing combined status, ignore the modules that were not built
else
if(br!=null)
} else if (br != null) {
r = r.combine(br);
}
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("New result is: " + r);
}
}

return r;
}

@@ -37,6 +37,7 @@
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.ToolInstallations;

@@ -505,6 +506,21 @@ else if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod.incr:modul
assertEquals(expected, TestAM.archivings);
}

@Issue("JENKINS-24832")
@Test
public void testMultiModulesFailureWithParallelThreads() throws Exception {
ToolInstallations.configureMaven3();
MavenModuleSet project = j.createProject(MavenModuleSet.class, "mp");
project.setScm(new ExtractResourceSCM(getClass().getResource("maven-multimod-failure.zip")));
// Without the parallel option it is correctly failing
project.setGoals("test");
j.assertBuildStatus(Result.FAILURE, project.scheduleBuild2(0).get());
// With the parallel option it was previously reported as aborted
project.setGoals("test -T 2");
j.assertBuildStatus(Result.FAILURE, project.scheduleBuild2(0).get());
}


public static final class TestAMF extends ArtifactManagerFactory {
@Override public ArtifactManager managerFor(Run<?,?> build) {
return new TestAM(build);
Binary file not shown.

0 comments on commit 2e671da

Please sign in to comment.
You can’t perform that action at this time.