aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-04-14 10:28:04 +0200
committerHans Nilsson <[email protected]>2016-04-29 13:17:52 +0200
commit223b123f576e726c18bcd38fa2b866d23f1a14a3 (patch)
tree728d1c6389f84669b9360a25ff5ef8b5e2b72234 /lib/ssh/test/ssh_test_lib.erl
parent0977a597432d018ff0edb3895a32f78a08647b85 (diff)
downloadotp-223b123f576e726c18bcd38fa2b866d23f1a14a3.tar.gz
otp-223b123f576e726c18bcd38fa2b866d23f1a14a3.tar.bz2
otp-223b123f576e726c18bcd38fa2b866d23f1a14a3.zip
ssh: breakout rcv_expected to ssh_test_lib.erl
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 06fddb8dc8..15f10fa1ae 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -194,6 +194,24 @@ reply(TestCase, Result) ->
%%ct:log("reply ~p sending ~p ! ~p",[self(), TestCase, Result]),
TestCase ! Result.
+
+
+rcv_expected(Expect, SshPort, Timeout) ->
+ receive
+ {SshPort, Expect} ->
+ ct:log("Got expected ~p from ~p",[Expect,SshPort]),
+ catch port_close(SshPort),
+ ok;
+ Other ->
+ ct:log("Got UNEXPECTED ~p",[Other]),
+ rcv_expected(SshPort, Expect, Timeout)
+
+ after Timeout ->
+ catch port_close(SshPort),
+ ct:fail("Did not receive answer")
+ end.
+
+
receive_exec_result(Msg) ->
ct:log("Expect data! ~p", [Msg]),
receive