diff --git a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/AbstractEclipseTestMojo.java b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/AbstractEclipseTestMojo.java
index a9947e645e..93274ac480 100644
--- a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/AbstractEclipseTestMojo.java
+++ b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/AbstractEclipseTestMojo.java
@@ -304,6 +304,12 @@ public abstract class AbstractEclipseTestMojo extends AbstractTestMojo {
@Parameter
private BundleStartLevel defaultStartLevel;
+ /**
+ * If {@link #testRuntime} is p2Installed
installs all configured environments
+ */
+ @Parameter
+ private boolean installAllEnvironments;
+
/**
* Flaky tests will re-run until they pass or the number of reruns has been exhausted. See
* surefire documentation for details.
@@ -641,9 +647,24 @@ private EquinoxInstallation createProvisionedInstallation() throws MojoExecution
installationBuilder.setWorkingDir(workingDir);
installationBuilder.setDestination(work);
List list = getTestTargetEnvironments();
- TargetEnvironment env = list.get(0);
- getLog().info("Provisioning with environment " + env + "...");
- return installationBuilder.install(env);
+ TargetEnvironment testEnvironment = list.get(0);
+ if (installAllEnvironments) {
+ TargetPlatformConfiguration configuration = projectManager.getTargetPlatformConfiguration(project);
+ List targetEnvironments = configuration.getEnvironments();
+ EquinoxInstallation installation = null;
+ for (TargetEnvironment targetEnvironment : targetEnvironments) {
+ getLog().info("Provisioning with environment " + targetEnvironment + "...");
+ installationBuilder.setProfileName(targetEnvironment.toString());
+ EquinoxInstallation current = installationBuilder.install(targetEnvironment);
+ if (targetEnvironment == testEnvironment) {
+ installation = current;
+ }
+ }
+ return installation;
+ } else {
+ getLog().info("Provisioning with environment " + testEnvironment + "...");
+ return installationBuilder.install(testEnvironment);
+ }
} catch (Exception ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
diff --git a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/provisioning/ProvisionedInstallationBuilder.java b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/provisioning/ProvisionedInstallationBuilder.java
index 20b5b902aa..5d79a3bda3 100644
--- a/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/provisioning/ProvisionedInstallationBuilder.java
+++ b/tycho-surefire/tycho-surefire-plugin/src/main/java/org/eclipse/tycho/surefire/provisioning/ProvisionedInstallationBuilder.java
@@ -139,14 +139,29 @@ private void executeDirector(TargetEnvironment env) throws MojoFailureException
}
private File getFinalDestination(TargetEnvironment env) {
- if (PlatformPropertiesUtils.OS_MACOSX.equals(env.getOs())) {
- if (!effectiveDestination.getName().endsWith(".app")) {
- return new File(effectiveDestination, "Eclipse.app/Contents/Eclipse/");
- }
+ if (PlatformPropertiesUtils.OS_MACOSX.equals(env.getOs()) && !hasRequiredMacLayout(effectiveDestination)) {
+ return new File(effectiveDestination, "Eclipse.app/Contents/Eclipse/");
}
return effectiveDestination;
}
+ private static boolean hasRequiredMacLayout(File folder) {
+ //TODO if we do not have this exact layout then director fails with:
+ //The framework persistent data location (/work/MacOS/configuration) is not the same as the framework configuration location /work/Contents/Eclipse/configuration)
+ //maybe we can simply configure the "persistent data location" to point to the expected one?
+ //or the "configuration location" must be configured and look like /work/Contents//configuration ?
+ //the actual values seem even depend on if this is an empty folder where one installs or an existing one
+ //e.g. if one installs multiple env Equinox finds the launcher and then set the location different...
+ if ("Eclipse".equals(folder.getName())) {
+ File folder2 = folder.getParentFile();
+ if (folder2 != null && "Contents".equals(folder2.getName())) {
+ File parent = folder2.getParentFile();
+ return parent != null && parent.getName().endsWith(".app");
+ }
+ }
+ return false;
+ }
+
private void validate() {
assertNotNull(workingDir, "workingDir");
assertNotNull(effectiveDestination, "destination");