diff options
author | Marc-Andre Laperle | 2016-08-30 19:04:06 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-09-01 19:23:52 +0000 |
commit | c14f675a8e99aa3e50149da5560bf849944407d9 (patch) | |
tree | 742e35b39a987060982c66933214340070686c1c /core/org.eclipse.cdt.ui.tests/src/org | |
parent | 9c8bcb28c874581067b2e26f9e4321f19d7c2a86 (diff) | |
download | org.eclipse.cdt-c14f675a8e99aa3e50149da5560bf849944407d9.tar.gz org.eclipse.cdt-c14f675a8e99aa3e50149da5560bf849944407d9.tar.xz org.eclipse.cdt-c14f675a8e99aa3e50149da5560bf849944407d9.zip |
Add a timeout multipler for DisplayHelper
DisplayHelper is used to run the event loop until a condition is met
or until a maximum timeout is reached. This timeout varies between
hundreds of milliseconds to a few seconds. When the tests are running
on a machine that is known to be quite under load (Hudson), the
timeouts in the milliseconds are too optimistics as there can be a
lot of other things running at the same time on the machine.
This change adds a multipler (default 1) that can be controlled from
the maven command line, for example:
-Dorg.eclipse.cdt.ui.testplugin.DisplayHelper.TIMEOUT_MULTIPLIER=5
Change-Id: I9c1517ac2641768e8ae0f4508bf9a008931ef805
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests/src/org')
-rw-r--r-- | core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/testplugin/DisplayHelper.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/testplugin/DisplayHelper.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/testplugin/DisplayHelper.java index f3269660766..04e5373e56f 100644 --- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/testplugin/DisplayHelper.java +++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/testplugin/DisplayHelper.java @@ -33,6 +33,12 @@ import org.eclipse.swt.widgets.Display; * @since 4.0 */ public abstract class DisplayHelper { + private static final long TIMEOUT_MULTIPLIER; + static + { + TIMEOUT_MULTIPLIER = Integer.parseInt(System.getProperty("org.eclipse.cdt.ui.testplugin.DisplayHelper.TIMEOUT_MULTIPLIER", "1")); + } + /** * Creates a new instance. */ @@ -74,7 +80,7 @@ public abstract class DisplayHelper { // repeatedly sleep until condition becomes true or timeout elapses DisplayWaiter waiter= new DisplayWaiter(display); - DisplayWaiter.Timeout timeoutState= waiter.start(timeout); + DisplayWaiter.Timeout timeoutState= waiter.start(timeout * TIMEOUT_MULTIPLIER); boolean condition; try { do { @@ -210,7 +216,7 @@ public abstract class DisplayHelper { // repeatedly sleep until condition becomes true or timeout elapses DisplayWaiter waiter= new DisplayWaiter(display, true); long currentTimeMillis= System.currentTimeMillis(); - long finalTimeout= timeout + currentTimeMillis; + long finalTimeout= timeout * TIMEOUT_MULTIPLIER + currentTimeMillis; if (finalTimeout < currentTimeMillis) finalTimeout= Long.MAX_VALUE; boolean condition; |