Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2020-02-22 10:02:43 +0000
committerEd Merks2020-02-22 10:02:43 +0000
commite106d1748390fa8eceea9d6115444fe9a95da58a (patch)
treef113b208b522248e3151e9fea0c7a06b692a898d
parentdddebda0501e8d77238cba45559172be2e830ef9 (diff)
downloadrt.equinox.p2-e106d1748390fa8eceea9d6115444fe9a95da58a.tar.gz
rt.equinox.p2-e106d1748390fa8eceea9d6115444fe9a95da58a.tar.xz
rt.equinox.p2-e106d1748390fa8eceea9d6115444fe9a95da58a.zip
Bug 545045 - Cancellation.testCancellation fails on Windows
This test only runs on Windows but I think it should be able to run on any platform so I've enabled that to see if this is the case. Hopefully this will run in the Gerrit verification job, but then it might fail unless it's really using the verification application's changes built in that Gerrit job. We'll see. The failure I'm pretty sure the failure is caused by the fact that the saving the profile preference is done by a job with a delayed schedule and that the verification application terminates before the save actually happens, so I've added join. I'm pretty sure of this because if I remote debug the launched verification application set breakpoints such that the preferences are really saved, the test runs without failure. But it's hard to test this without committing because it appears the verification application comes from the zip file being tested, not from the workspace version that I've changed. Change-Id: Ic30c06cb4c44ac75842c863d6f7a0360d2137555 Signed-off-by: Ed Merks <ed.merks@gmail.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java3
3 files changed, 12 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
index ae59911f9..790dc0e9f 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.equinox.p2.operations;bundle-version="2.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
+ org.eclipse.equinox.internal.p2.engine,
org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration,
org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.query;version="[2.0.0,3.0.0)"
diff --git a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
index f3586b31b..ef952b904 100644
--- a/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
+++ b/bundles/org.eclipse.equinox.p2.tests.verifier/src/org/eclipse/equinox/internal/p2/tests/verifier/VerifierApplication.java
@@ -20,10 +20,12 @@ import java.net.URI;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.engine.ProfilePreferences;
import org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration.MigrationWizard;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
@@ -350,6 +352,15 @@ public class VerifierApplication implements IApplication {
MigrationWizard wizardPage = new MigrationWizard(profile, Collections.emptyList(), new URI[0], false);
int cancelAnswer = Integer.parseInt(properties.getProperty("checkMigration.cancelAnswer"));
wizardPage.rememberCancellationDecision(cancelAnswer);
+ // The preferences are saved by:
+ // org.eclipse.equinox.internal.p2.engine.ProfilePreferences.SaveJob
+ // This job is scheduled with a delay: saveJob.schedule(SAVE_SCHEDULE_DELAY).
+ // We'd best wait for that job to complete before existing.
+ try {
+ Job.getJobManager().join(ProfilePreferences.PROFILE_SAVE_JOB_FAMILY, null);
+ } catch (InterruptedException e) {
+ throw new RuntimeException();
+ }
}
private IStatus checkSystemProperties() {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java
index fcd7b5735..db8867449 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/Cancellation.java
@@ -17,7 +17,6 @@ package org.eclipse.equinox.p2.tests.sharedinstall;
import java.util.Properties;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.p2.tests.reconciler.dropins.ReconcilerTestSuite;
public class Cancellation extends AbstractSharedInstallTest {
@@ -34,8 +33,6 @@ public class Cancellation extends AbstractSharedInstallTest {
}
public void testCancellation() {
- if (!Platform.getOS().equals(Platform.OS_WIN32))
- return;
assertInitialized();
setupReadOnlyInstall();
System.out.println(readOnlyBase);

Back to the top