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.
|
||||
*/
|
||||
protected class SessionEventListener {
|
||||
private DsfSession fSession;
|
||||
|
||||
SessionEventListener(DsfSession session) {
|
||||
fSession = session;
|
||||
Assert.assertNotNull(session);
|
||||
}
|
||||
|
||||
@DsfServiceEventHandler
|
||||
public void eventDispatched(IDMEvent<?> event) {
|
||||
if (event instanceof MIStoppedEvent) {
|
||||
|
@ -99,12 +106,11 @@ public class BaseTestCase {
|
|||
fTargetSuspendedSem.notify();
|
||||
}
|
||||
|
||||
// no further need for this listener
|
||||
fLaunch.getSession().removeServiceEventListener(this);
|
||||
// no further need for this listener. Note fLaunch could be null if the test ran into a failure
|
||||
fSession.removeServiceEventListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
private final SessionEventListener fSessionEventListener = new SessionEventListener();
|
||||
|
||||
@BeforeClass
|
||||
public static void baseBeforeClassMethod() {
|
||||
|
@ -152,7 +158,7 @@ public class BaseTestCase {
|
|||
// occur. We want to find out when the break on main() occurs.
|
||||
SessionStartedListener sessionStartedListener = new SessionStartedListener() {
|
||||
public void sessionStarted(DsfSession session) {
|
||||
session.addServiceEventListener(fSessionEventListener, null);
|
||||
session.addServiceEventListener(new SessionEventListener(session), null);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue