tycho/tycho-maven-surefire.patch

152 lines
9.0 KiB
Diff

From e907892903141709326414a573d8703a5dccef47 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Tue, 12 Jun 2012 10:12:53 -0400
Subject: [PATCH 3/4] Upstream builds against maven-surefire 2.10 but in
rawhide we have 2.12.
Change-Id: I69ceee1cb2abe86bc6ca080ddde6676bf995347a
---
.../surefire/junitcore/OsgiEnabledJUnitCoreProvider.java | 2 +-
.../META-INF/MANIFEST.MF | 3 ++-
.../org.eclipse.tycho.surefire.osgibooter/pom.xml | 7 +++++++
.../tycho/surefire/osgibooter/OsgiSurefireBooter.java | 15 ++++++++-------
.../surefire/osgibooter/TychoClasspathConfiguration.java | 5 +++++
.../main/java/org/eclipse/tycho/surefire/TestMojo.java | 4 ++--
6 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.junit47/src/org/apache/maven/surefire/junitcore/OsgiEnabledJUnitCoreProvider.java b/tycho-surefire/org.eclipse.tycho.surefire.junit47/src/org/apache/maven/surefire/junitcore/OsgiEnabledJUnitCoreProvider.java
index eaa8dc4..ea3a628 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.junit47/src/org/apache/maven/surefire/junitcore/OsgiEnabledJUnitCoreProvider.java
+++ b/tycho-surefire/org.eclipse.tycho.surefire.junit47/src/org/apache/maven/surefire/junitcore/OsgiEnabledJUnitCoreProvider.java
@@ -115,7 +115,7 @@ public class OsgiEnabledJUnitCoreProvider
org.junit.runner.notification.RunListener jUnit4RunListener = new OsgiEnabledJUnitCoreRunListener( listener, testSetMap );
customRunListeners.add( 0, jUnit4RunListener );
- JUnitCoreWrapper.execute( testsToRun, jUnitCoreParameters, customRunListeners );
+ JUnitCoreWrapper.execute( testsToRun, jUnitCoreParameters, customRunListeners, null );
return reporterFactory.close();
}
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
index 1bdb8cb..d510010 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Eclipse-AutoStart: true
Bundle-ClassPath: .,
jars/surefire-booter-2.10.jar,
jars/surefire-api-2.10.jar,
- jars/plexus-utils-3.0.jar
+ jars/plexus-utils-3.0.jar,
+ jars/maven-surefire-common-2.10.jar
Bundle-Version: 0.16.0.qualifier
Bundle-Name: Tycho Surefire OSGi Booter Eclipse Application (Incubation)
Bundle-ManifestVersion: 2
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
index 87f1f23..b6040a5 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/pom.xml
@@ -56,6 +56,13 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>${plexusUtilsVersion}</version>
+
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>maven-surefire-common</artifactId>
+ <version>${surefire-version}</version>
+
</artifactItem>
</artifactItems>
</configuration>
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
index 791221b..dcd1244 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/OsgiSurefireBooter.java
@@ -27,13 +27,14 @@ import java.util.Set;
import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.ProviderConfiguration;
import org.apache.maven.surefire.booter.StartupConfiguration;
-import org.apache.maven.surefire.booter.StartupReportConfiguration;
-import org.apache.maven.surefire.booter.SurefireStarter;
+import org.apache.maven.plugin.surefire.StartupReportConfiguration;
+import org.apache.maven.plugin.surefire.InPluginVMSurefireStarter;
import org.apache.maven.surefire.report.ReporterConfiguration;
import org.apache.maven.surefire.suite.RunResult;
import org.apache.maven.surefire.testset.DirectoryScannerParameters;
import org.apache.maven.surefire.testset.TestRequest;
import org.apache.maven.surefire.util.RunOrder;
+import org.apache.maven.surefire.testset.RunOrderParameters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -64,22 +65,22 @@ public class OsgiSurefireBooter {
boolean printSummary = true;
boolean disableXmlReport = false;
ClassLoader testClassLoader = getBundleClassLoader(plugin);
- ClassLoader surefireClassLoader = SurefireStarter.class.getClassLoader();
+ ClassLoader surefireClassLoader = InPluginVMSurefireStarter.class.getClassLoader();
TychoClasspathConfiguration classPathConfig = new TychoClasspathConfiguration(testClassLoader,
surefireClassLoader);
StartupConfiguration startupConfiguration = new StartupConfiguration(provider, classPathConfig,
new ClassLoaderConfiguration(useSystemClassloader, useManifestOnlyJar), forkMode, inForkedVM);
DirectoryScannerParameters dirScannerParams = new DirectoryScannerParameters(testClassesDir, includes,
- excludes, failIfNoTests, RunOrder.FILESYSTEM);
+ excludes, null, failIfNoTests, RunOrder.FILESYSTEM.name());
ReporterConfiguration reporterConfig = new ReporterConfiguration(reportsDir, trimStacktrace);
TestRequest testRequest = new TestRequest(null, testClassesDir, null);
- ProviderConfiguration providerConfiguration = new ProviderConfiguration(dirScannerParams, failIfNoTests,
+ ProviderConfiguration providerConfiguration = new ProviderConfiguration(dirScannerParams, RunOrderParameters.DEFAULT(), failIfNoTests,
reporterConfig, null, testRequest, extractProviderProperties(testProps), null);
StartupReportConfiguration startupReportConfig = new StartupReportConfiguration(useFile, printSummary,
StartupReportConfiguration.PLAIN_REPORT_FORMAT, redirectTestOutputToFile, disableXmlReport, reportsDir,
- trimStacktrace);
- SurefireStarter surefireStarter = new SurefireStarter(startupConfiguration, providerConfiguration,
+ trimStacktrace, null, "TESTHASH", false);
+ InPluginVMSurefireStarter surefireStarter = new InPluginVMSurefireStarter(startupConfiguration, providerConfiguration,
startupReportConfig);
RunResult result = surefireStarter.runSuitesInProcess();
diff --git a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/TychoClasspathConfiguration.java b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/TychoClasspathConfiguration.java
index c94d3ea..6c732a5 100644
--- a/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/TychoClasspathConfiguration.java
+++ b/tycho-surefire/org.eclipse.tycho.surefire.osgibooter/src/main/java/org/eclipse/tycho/surefire/osgibooter/TychoClasspathConfiguration.java
@@ -30,6 +30,11 @@ public class TychoClasspathConfiguration extends ClasspathConfiguration {
}
@Override
+ public ClassLoader createInprocSurefireClassLoader(ClassLoader parent) throws SurefireExecutionException {
+ return surefireClassLoader;
+ }
+
+ @Override
public ClassLoader createTestClassLoader() throws SurefireExecutionException {
return testClassLoader;
}
diff --git a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
index 77288dd..9cc2e49 100644
--- a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
+++ b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/TestMojo.java
@@ -670,7 +670,7 @@ public class TestMojo extends AbstractMojo {
case 0:
getLog().info("All tests passed!");
break;
- case RunResult.NO_TESTS:
+ case 254:
String message = "No tests found.";
if (failIfNoTests) {
throw new MojoFailureException(message);
@@ -678,7 +678,7 @@ public class TestMojo extends AbstractMojo {
getLog().warn(message);
}
break;
- case RunResult.FAILURE:
+ case 255:
String errorMessage = "There are test failures.\n\nPlease refer to " + reportsDirectory
+ " for the individual test results.";
if (testFailureIgnore) {
--
1.7.11.2