1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Bug 371198: Fixes for intermittent test failures.

This commit is contained in:
Marc Khouzam 2012-03-02 14:49:51 -05:00
parent b971029699
commit 39d3edc175
2 changed files with 19 additions and 7 deletions

View file

@ -347,10 +347,16 @@ public class MIRegistersTest extends BaseTestCase {
// thread is conditional depending on environment. Run to the printf
// before it (which is common), then do step operations over the
// non-common code (but same number of lines)
SyncUtil.runToLine(SRC_NAME, Integer.toString(MIRunControlTest.LINE_MAIN_PRINTF));
SyncUtil.step(StepType.STEP_OVER); // over the printf
SyncUtil.step(StepType.STEP_OVER); // over the create-thread call
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER, TestsPlugin.massageTimeout(2000)); // over the one second sleep
SyncUtil.runToLine(SRC_NAME, Integer.toString(MIRunControlTest.LINE_MAIN_PRINTF));
// Because the program is about to go multi-threaded, we have to select the thread
// we want to keep stepping. If we don't, we will ask GDB to step the entire process
// which is not what we want. We can fetch the thread from the stopped event
// but we should do that before the second thread is created, to be sure the stopped
// event is for the main thread.
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER); // over the printf
SyncUtil.step(stoppedEvent.getDMContext(), StepType.STEP_OVER); // over the create-thread call
stoppedEvent = SyncUtil.step(stoppedEvent.getDMContext(), StepType.STEP_OVER, TestsPlugin.massageTimeout(2000)); // over the one second sleep
// Get the thread IDs
final IContainerDMContext containerDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(), IContainerDMContext.class);

View file

@ -272,9 +272,15 @@ public class MIRunControlTest extends BaseTestCase {
// before it (which is common), then do step operations over the
// non-common code (but same number of lines)
SyncUtil.runToLine(fContainerDmc, SOURCE_NAME, Integer.toString(LINE_MAIN_PRINTF), true);
SyncUtil.step(StepType.STEP_OVER); // over the printf
SyncUtil.step(StepType.STEP_OVER); // over the create-thread call
SyncUtil.step(StepType.STEP_OVER, TestsPlugin.massageTimeout(2000)); // over the one second sleep
// Because the program is about to go multi-threaded, we have to select the thread
// we want to keep stepping. If we don't, we will ask GDB to step the entire process
// which is not what we want. We can fetch the thread from the stopped event
// but we should do that before the second thread is created, to be sure the stopped
// event is for the main thread.
MIStoppedEvent stoppedEvent = SyncUtil.step(StepType.STEP_OVER); // over the printf
SyncUtil.step(stoppedEvent.getDMContext(), StepType.STEP_OVER); // over the create-thread call
SyncUtil.step(stoppedEvent.getDMContext(), StepType.STEP_OVER, TestsPlugin.massageTimeout(2000)); // over the one second sleep
// Make sure thread started event was received
IStartedDMEvent startedEvent = startedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(1000));