diff options
author | eutarass | 2011-07-06 15:34:32 +0000 |
---|---|---|
committer | eutarass | 2011-07-06 15:34:32 +0000 |
commit | d9d41beca6dc33365222f9cb8f5d2aae5d907259 (patch) | |
tree | 4e2895d489b48eda610b7c2333437ce2fc6d40e3 | |
parent | aa6a39985a05db0a54bc3dbc8e631b73626b0f7b (diff) | |
download | org.eclipse.tcf-d9d41beca6dc33365222f9cb8f5d2aae5d907259.tar.gz org.eclipse.tcf-d9d41beca6dc33365222f9cb8f5d2aae5d907259.tar.xz org.eclipse.tcf-d9d41beca6dc33365222f9cb8f5d2aae5d907259.zip |
TCF Tests: improved handling of run control groups.
2 files changed, 34 insertions, 28 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestAttachTerminate.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestAttachTerminate.java index 415ddd1b7..544e60528 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestAttachTerminate.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestAttachTerminate.java @@ -110,7 +110,7 @@ class TestAttachTerminate implements ITCFTest, IRunControl.RunControlListener { if (error instanceof IErrorReport) { int code = ((IErrorReport)error).getErrorCode(); if (code == IErrorReport.TCF_ERROR_ALREADY_RUNNING) return; - if (code == IErrorReport.TCF_ERROR_INV_CONTEXT) return; + if (code == IErrorReport.TCF_ERROR_INV_CONTEXT && ctx_map.get(id) == null) return; } if (error != null) exit(error); } @@ -121,22 +121,41 @@ class TestAttachTerminate implements ITCFTest, IRunControl.RunControlListener { private void startTestContext(String test_name) { for (int i = 0; i < 4; i++) { diag.runTest(test_name, new IDiagnostics.DoneRunTest() { - public void doneRunTest(IToken token, Throwable error, String context_id) { + public void doneRunTest(IToken token, Throwable error, final String id) { cnt--; if (error != null) { exit(error); } else { - assert context_id != null; - if (ctx_map.get(context_id) == null) { - exit(new Error("Missing 'contextAdded' event for context " + context_id)); + assert id != null; + if (ctx_map.get(id) == null) { + exit(new Error("Missing 'contextAdded' event for context " + id)); + } + else { + test_ctx_ids.add(id); + Runnable r = new Runnable() { + public void run() { + if (!test_suite.isActive(TestAttachTerminate.this)) return; + IRunControl.RunControlContext ctx = ctx_map.get(id); + if (ctx == null) return; + if (!test_suite.canResume(ctx)) { + Protocol.invokeLater(100, this); + } + else { + diag.cancelTest(id, new IDiagnostics.DoneCancelTest() { + public void doneCancelTest(IToken token, Throwable error) { + if (error instanceof IErrorReport) { + int code = ((IErrorReport)error).getErrorCode(); + if (code == IErrorReport.TCF_ERROR_INV_CONTEXT && ctx_map.get(id) == null) return; + } + if (error != null) exit(error); + } + }); + } + } + }; + Protocol.invokeLater(r); } - test_ctx_ids.add(context_id); - diag.cancelTest(context_id, new IDiagnostics.DoneCancelTest() { - public void doneCancelTest(IToken token, Throwable error) { - if (error != null) exit(error); - } - }); } } }); diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java index 8af7995ea..373406e71 100644 --- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java +++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestRCBP1.java @@ -281,25 +281,12 @@ class TestRCBP1 implements ITCFTest, IRunControl.RunControlListener { if (test_id != null) { if (test_ctx_id == null) { startTestContext(); - Protocol.invokeLater(100, new Runnable() { - int cnt = 0; + Protocol.invokeLater(200, new Runnable() { public void run() { if (!test_suite.isActive(TestRCBP1.this)) return; - cnt++; - if (test_suite.cancel) { - exit(null); - } - else if (cnt < 600) { - Protocol.invokeLater(100, this); - for (SuspendedContext sc : suspended.values()) { - if (sc.ok_to_resume) resume(sc); - } - } - else if (test_ctx_id == null) { - exit(new Error("Timeout waiting for reply of Diagnostics.runTest command")); - } - else { - exit(new Error("Missing 'contextRemoved' event for " + test_ctx_id)); + Protocol.invokeLater(200, this); + for (SuspendedContext sc : suspended.values()) { + if (sc.ok_to_resume) resume(sc); } } }); |