mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 21:15:23 +02:00
Bug 314174: Eliminate the 1s wait at start of each DSF-GDB test. (Avoid possible NPE when a test fails)
This commit is contained in:
parent
69444100a5
commit
18f37c3ccf
1 changed files with 11 additions and 5 deletions
|
@ -81,6 +81,13 @@ public class BaseTestCase {
|
||||||
* beyond that point.
|
* beyond that point.
|
||||||
*/
|
*/
|
||||||
protected class SessionEventListener {
|
protected class SessionEventListener {
|
||||||
|
private DsfSession fSession;
|
||||||
|
|
||||||
|
SessionEventListener(DsfSession session) {
|
||||||
|
fSession = session;
|
||||||
|
Assert.assertNotNull(session);
|
||||||
|
}
|
||||||
|
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IDMEvent<?> event) {
|
public void eventDispatched(IDMEvent<?> event) {
|
||||||
if (event instanceof MIStoppedEvent) {
|
if (event instanceof MIStoppedEvent) {
|
||||||
|
@ -99,13 +106,12 @@ public class BaseTestCase {
|
||||||
fTargetSuspendedSem.notify();
|
fTargetSuspendedSem.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// no further need for this listener
|
// no further need for this listener. Note fLaunch could be null if the test ran into a failure
|
||||||
fLaunch.getSession().removeServiceEventListener(this);
|
fSession.removeServiceEventListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private final SessionEventListener fSessionEventListener = new SessionEventListener();
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void baseBeforeClassMethod() {
|
public static void baseBeforeClassMethod() {
|
||||||
// Setup information for the launcher
|
// Setup information for the launcher
|
||||||
|
@ -152,7 +158,7 @@ public class BaseTestCase {
|
||||||
// occur. We want to find out when the break on main() occurs.
|
// occur. We want to find out when the break on main() occurs.
|
||||||
SessionStartedListener sessionStartedListener = new SessionStartedListener() {
|
SessionStartedListener sessionStartedListener = new SessionStartedListener() {
|
||||||
public void sessionStarted(DsfSession session) {
|
public void sessionStarted(DsfSession session) {
|
||||||
session.addServiceEventListener(fSessionEventListener, null);
|
session.addServiceEventListener(new SessionEventListener(session), null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue