diff options
author | Hans Nilsson <[email protected]> | 2016-10-13 13:09:42 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2016-10-13 15:43:25 +0200 |
commit | d53bd4936297f6310e59f88191014bb5dd0d8b2c (patch) | |
tree | e9626c254f8f39787b0d4ce30cb4a11389209d37 /lib/ssh/test/ssh_test_lib.erl | |
parent | a59807ef9a6a8af6eb6f13976eb405ddb9baad6c (diff) | |
download | otp-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.erl | 25 |
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. + +%%%---------------------------------------------------------------- |