aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-10-13 13:09:42 +0200
committerHans Nilsson <[email protected]>2016-10-13 15:43:25 +0200
commitd53bd4936297f6310e59f88191014bb5dd0d8b2c (patch)
treee9626c254f8f39787b0d4ce30cb4a11389209d37 /lib/ssh/test/ssh_test_lib.erl
parenta59807ef9a6a8af6eb6f13976eb405ddb9baad6c (diff)
downloadotp-d53bd4936297f6310e59f88191014bb5dd0d8b2c.tar.gz
otp-d53bd4936297f6310e59f88191014bb5dd0d8b2c.tar.bz2
otp-d53bd4936297f6310e59f88191014bb5dd0d8b2c.zip
ssh: property test case for illegal infoline and close
This tests an illegal client that sends an info line and closes 'immediatly'.
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 6233680dce..c43c6519f9 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -767,3 +767,28 @@ open_port(Arg1, ExtraOpts) ->
use_stdio,
overlapped_io, hide %only affects windows
| ExtraOpts]).
+
+%%%----------------------------------------------------------------
+%%% Sleeping
+
+%%% Milli sec
+sleep_millisec(Nms) -> receive after Nms -> ok end.
+
+%%% Micro sec
+sleep_microsec(Nus) ->
+ busy_wait(Nus, erlang:system_time(microsecond)).
+
+busy_wait(Nus, T0) ->
+ T = erlang:system_time(microsecond) - T0,
+ Tleft = Nus - T,
+ if
+ Tleft > 2000 ->
+ sleep_millisec((Tleft-1500) div 1000), % μs -> ms
+ busy_wait(Nus,T0);
+ Tleft > 1 ->
+ busy_wait(Nus, T0);
+ true ->
+ T
+ end.
+
+%%%----------------------------------------------------------------