Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Cortell2010-05-27 22:11:53 +0000
committerJohn Cortell2010-05-27 22:11:53 +0000
commit17f248d07286d04e947a2d7280e0fc8dab246120 (patch)
tree5692efccd67f286dbe0e0179bd7bd00fe5bcc49f /dsf-gdb
parent4972e6477540418213359f9214aac4a83728ac08 (diff)
downloadorg.eclipse.cdt-17f248d07286d04e947a2d7280e0fc8dab246120.tar.gz
org.eclipse.cdt-17f248d07286d04e947a2d7280e0fc8dab246120.tar.xz
org.eclipse.cdt-17f248d07286d04e947a2d7280e0fc8dab246120.zip
Bug 314174: Eliminate the 1s wait at start of each DSF-GDB test.
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java63
1 files changed, 33 insertions, 30 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
index 01387dc9d46..197da1629f9 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
@@ -73,6 +73,38 @@ public class BaseTestCase {
}
public synchronized MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; }
+
+ /**
+ * We listen for the target to stop at the main breakpoint. This listener is
+ * installed when the session is created and we uninstall ourselves when we
+ * get to the breakpoint state, as we have no further need to monitor events
+ * beyond that point.
+ */
+ protected class SessionEventListener {
+ @DsfServiceEventHandler
+ public void eventDispatched(IDMEvent<?> event) {
+ if (event instanceof MIStoppedEvent) {
+ // We get this low-level event first. Record the MI event; various
+ // tests use it for context
+ synchronized(this) {
+ fInitialStoppedEvent = (MIStoppedEvent)event;
+ }
+ }
+ else if (event instanceof ISuspendedDMEvent) {
+ // We get this higher level event shortly thereafter. We don't want
+ // to consider the session suspended until we get it. Set the event
+ // semaphore that will allow the test to proceed
+ synchronized (fTargetSuspendedSem) {
+ fTargetSuspended = true;
+ fTargetSuspendedSem.notify();
+ }
+
+ // no further need for this listener
+ fLaunch.getSession().removeServiceEventListener(this);
+ }
+ }
+ }
+ private final SessionEventListener fSessionEventListener = new SessionEventListener();
@BeforeClass
public static void baseBeforeClassMethod() {
@@ -120,7 +152,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(BaseTestCase.this, null);
+ session.addServiceEventListener(fSessionEventListener, null);
}
};
@@ -155,35 +187,6 @@ public class BaseTestCase {
}
- /**
- * We listen for the target to stop at the main breakpoint. This listener is
- * installed when the session is created and we uninstall ourselves when we
- * get to the breakpoint state, as we have no further need to monitor events
- * beyond that point.
- */
- @DsfServiceEventHandler
- public void eventDispatched(IDMEvent<?> event) {
- if (event instanceof MIStoppedEvent) {
- // We get this low-level event first. Record the MI event; various
- // tests use it for context
- synchronized(this) {
- fInitialStoppedEvent = (MIStoppedEvent)event;
- }
- }
- else if (event instanceof ISuspendedDMEvent) {
- // We get this higher level event shortly thereafter. We don't want
- // to consider the session suspended until we get it. Set the event
- // semaphore that will allow the test to proceed
- synchronized (fTargetSuspendedSem) {
- fTargetSuspended = true;
- fTargetSuspendedSem.notify();
- }
-
- // no further need for this listener
- fLaunch.getSession().removeServiceEventListener(BaseTestCase.this);
- }
- }
-
@After
public void baseAfterMethod() throws Exception {
if (fLaunch != null) {

Back to the top