Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-10-14 20:02:38 +0000
committerEugene Tarassov2011-10-14 20:02:38 +0000
commit16fe1cf7d4cf51d1c5f2255872d8f31b51088e93 (patch)
tree1e1b322aa0ead067597bb59fc970cd06bba35cad /plugins
parent84f789f227e9caa5b15a5afb4f916b28d3ab22fb (diff)
downloadorg.eclipse.tcf-16fe1cf7d4cf51d1c5f2255872d8f31b51088e93.tar.gz
org.eclipse.tcf-16fe1cf7d4cf51d1c5f2255872d8f31b51088e93.tar.xz
org.eclipse.tcf-16fe1cf7d4cf51d1c5f2255872d8f31b51088e93.zip
TCF Tests: fixed "Timeout waiting for 'Terminals.exited' event" in terminals service tests.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestTerminals.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestTerminals.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestTerminals.java
index 5864073e4..a7c8a09b3 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestTerminals.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/tests/TestTerminals.java
@@ -58,6 +58,7 @@ class TestTerminals implements ITCFTest {
private boolean unsubscribe_done;
private boolean exited;
private boolean stdout_eos;
+ private int time_out = 0;
private final ITerminals.TerminalsListener listener = new ITerminals.TerminalsListener() {
@@ -198,16 +199,18 @@ class TestTerminals implements ITCFTest {
}
}
Protocol.invokeLater(100, new Runnable() {
- int cnt = 0;
public void run() {
if (!test_suite.isActive(TestTerminals.this)) return;
- cnt++;
+ time_out++;
if (test_suite.cancel) {
exit(null);
}
- else if (cnt < 300) {
+ else if (time_out < 300) {
Protocol.invokeLater(100, this);
}
+ else if (!signal_sent) {
+ exit(new Error("Timeout waiting for terminal reply. Context: " + terminal.getID()));
+ }
else if (!exited) {
exit(new Error("Timeout waiting for 'Terminals.exited' event. Context: " + terminal.getID()));
}
@@ -303,10 +306,12 @@ class TestTerminals implements ITCFTest {
stdout_buf.append(new String(data, encoding));
if (echo_tx.size() > echo_rx.size()) {
String s = echo_tx.get(echo_rx.size());
+ String p = "\n" + s.substring(0, 12);
int n = 0;
if (echo_rx.size() > 0) n = echo_rx.get(echo_rx.size() - 1);
- int i = stdout_buf.indexOf("\n" + s, n);
+ int i = stdout_buf.indexOf(p, n);
if (i >= 0) {
+ time_out = 0;
echo_rx.add(i + 1);
run = true;
}
@@ -467,6 +472,16 @@ class TestTerminals implements ITCFTest {
if (echo_rx.size() < echo_cnt) {
exit(new Exception("Terminal exited before test finished"));
}
+ else {
+ int n = 0;
+ for (int i : echo_rx) {
+ String s = echo_tx.get(n++);
+ String r = stdout_buf.substring(i, i + s.length());
+ if (!s.equals(r)) {
+ exit(new Exception("Invalid reply: " + r + "\nExpected: " + s));
+ }
+ }
+ }
}
}
}

Back to the top