Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug.tests; singleton:=true
Bundle-Version: 3.12.650.qualifier
Bundle-Version: 3.12.750.qualifier
Bundle-ClassPath: javadebugtests.jar
Bundle-Activator: org.eclipse.jdt.debug.testplugin.JavaTestPlugin
Bundle-Vendor: %providerName
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.debug.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug.tests</artifactId>
<version>3.12.650-SNAPSHOT</version>
<version>3.12.750-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testSuite>${project.artifactId}</testSuite>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.views.console.ProcessConsole;
import org.eclipse.jdt.debug.testplugin.JavaTestPlugin;
import org.eclipse.jface.text.reconciler.AbstractReconciler;
import org.eclipse.swt.widgets.Display;
import org.junit.Assert;

Expand Down Expand Up @@ -110,6 +112,8 @@ public static void runEventLoop() {
/**
* Utility for waiting until the execution of jobs of any family has finished or timeout is reached. If no jobs are running, the method waits
* given minimum wait time. While this method is waiting for jobs, UI events are processed.
* <p>
* <b>Note:</b> This method does not wait for jobs that belong to the families specified in {@link #getUsualJobFamiliesToIgnore()}.
*
* @param owner
* name of the caller which will be logged as prefix if the wait times out
Expand All @@ -120,7 +124,7 @@ public static void runEventLoop() {
* @return true if the method timed out, false if all the jobs terminated before the timeout
*/
public static boolean waitForJobs(String owner, long minTimeMs, long maxTimeMs) {
return waitForJobs(owner, minTimeMs, maxTimeMs, (Object[]) null);
return waitForJobs(owner, minTimeMs, maxTimeMs, getUsualJobFamiliesToIgnore());
}

/**
Expand All @@ -146,6 +150,15 @@ public static boolean waitForJobs(String owner, Object jobFamily, long minTimeMs
if (maxTimeMs < minTimeMs) {
throw new IllegalArgumentException("Max time is smaller as min time!");
}
// Not so nice workaround for https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/721
// After https://github.com/eclipse-platform/eclipse.platform.ui/pull/3025 every opened editor
// means there will be a reconciler job running, which is not what we do NOT want to wait for.
// AbstractReconciler.class is the family object we can check for.
if (excludedFamilies == null) {
excludedFamilies = new Object[] { AbstractReconciler.class };
} else if (excludedFamilies.length == 1 && excludedFamilies[0] == ProcessConsole.class) {
excludedFamilies = getUsualJobFamiliesToIgnore();
}
wakeUpSleepingJobs(jobFamily);
final long startNanos = System.nanoTime();
while (System.nanoTime() - startNanos < minTimeMs * 1_000_000L) {
Expand Down Expand Up @@ -185,6 +198,18 @@ public static boolean waitForJobs(String owner, Object jobFamily, long minTimeMs
return false;
}

/**
* Returns a list of job families that are usually ignored in tests.
* <p>
* This is used to avoid waiting for jobs that are not relevant to the test.
* </p>
*
* @return an array of job family classes to ignore
*/
public static Object[] getUsualJobFamiliesToIgnore() {
return new Object[] { ProcessConsole.class, AbstractReconciler.class };
}

private static void wakeUpSleepingJobs(Object family) {
List<Job> sleepingJobs = getSleepingJobs(family);
for (Job job : sleepingJobs) {
Expand Down
Loading