DESCRIPTION

TMF: Added a method in UI tests to delay main thread until trace is opened

In o.e.l.tmf.ui.tests, the main thread often need to be put to sleep while a
trace element is being opened. The sleep time was put to 500 ms because that's
what showed best results. But sometimes, unit tests fail because it takes a bit
more than that. Instead of putting longer delays, we loop a certain number of
times until the trace is opened or after a certain timeout.

Change-Id: I662d951115eacbb3fa5b17cfe534a8e5c2a85eb4
Signed-off-by: Aryana Jones xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2013-12-19 03:28:20.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2013-12-19 03:54:44.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/4787/

-------------------------------------
author: Brenden Conley
date: 2013-12-19 04:39:55.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/4787/ : SUCCESS

-------------------------------------
author: Ivy Mitchell
date: 2013-12-19 16:18:36.000000000

Patch Set 3:

(1 comment)

commented, I like working on your code.

Line:213, lttng/org.eclipse.linuxtools.tmf.ui.tests/shared/org/eclipse/linuxtools/tmf/ui/tests/shared/ProjectModelTestData.java -> how about
final long deadline = system.nanotime() + DELAY_COUNTER+DEFAULT_DELAY*1000000;
while( traceElement.getTrace() == null ){
  delayThread(DEFAULT_DELAY);
  if( System.nanotime() > deadline) {
   throw new TimeoutException("Timeout while waiting for " + TmfTraceElement.toString());
 }

-------------------------------------
author: Annalise Jimenez
date: 2013-12-20 03:22:01.000000000

Patch Set 3:

(1 comment)

Did I not publish this review. There's a draft left...

Line:213, lttng/org.eclipse.linuxtools.tmf.ui.tests/shared/org/eclipse/linuxtools/tmf/ui/tests/shared/ProjectModelTestData.java -> Why not? Then again why? Is there any advantage to this except using a system time as deadline instead of counter times?

-------------------------------------
author: Ricky Reeves
date: 2013-12-20 11:32:48.000000000

Patch Set 3: Verified+1 Code-Review+1 IP-Clean+1

However, it's up to you if you want to change the implementation to what Matthews suggested.

-------------------------------------
author: Ivy Mitchell
date: 2013-12-20 14:52:43.000000000

Patch Set 3:

(1 comment)

replied

Line:213, lttng/org.eclipse.linuxtools.tmf.ui.tests/shared/org/eclipse/linuxtools/tmf/ui/tests/shared/ProjectModelTestData.java -> if the process gets interrupted, this will make the timeout more accurate.

Sleep often is a good indication for the OS to go and say: well you don't need a CPU, I'll give it to something else, like CUPS.  So let's say there are 5 delay blocks
                         Timeout time
                         V 
[d1] [d2] [d3] ................... [d4] [d5]

vs
[d1] [d2] [d3] ................... [d4] 

It's still bad, just not as bad. :)

-------------------------------------
