Add timeout exception when waiting for jobs
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Sat, 19 Mar 2016 22:02:02 +0000 (18:02 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 31 Mar 2016 17:53:25 +0000 (13:53 -0400)
commitfd5f786c909184371b5873a14def2c86d3248f43
tree8e9e1a68317c25b78e84854c0498628e4ed99a76
parent87492f16a8579d19a209827c386c391b677e9161
Add timeout exception when waiting for jobs

It can happen that jobs never finish and tests calling waitForJobs
will run forever (or time out if a Jenkins/Hudson job is set to
timeout). Normally it would be possible to set a timeout on individual
JUnit tests but this doesn't seem to play well with SWTBot (to be
investigated).

To reproduce the issue before this patch, add this line to the
beginning of SWTBotUtils.waitForJobs method:
new Job("Foo") {@Override protected IStatus run(IProgressMonitor monitor) {while(true){}}}.schedule();

This simulates a never finishing job. Then run OpenTraceStressTest.
The test should never time out.

With this patch, waitForJobs will timeout after 5 mins (300000ms) by
default. When it does timeout, it will print each job, its state and
stack trace.

To reproduce the timeout added with this patch, apply the line as
mentioned above, reduce MAX_JOBS_WAIT_TIME to a smaller value (5000ms)
then run OpenTraceStressTest.

Change-Id: I0cdbaa10c87b93aa2ac6c7f146f7a6e008983fbd
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/68850
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java
This page took 0.025639 seconds and 5 git commands to generate.