aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2016-10-13 16:17:04 +0200
committerErlang/OTP <[email protected]>2016-10-13 16:17:04 +0200
commitad56ed3c3ce10f50b1943a5827c516fc0ff98f4d (patch)
tree97a5ac8baaf7ab220fab2d88a2986b3b5e8c8440 /lib/ssh/test/ssh_test_lib.erl
parenta59807ef9a6a8af6eb6f13976eb405ddb9baad6c (diff)
parentf6c9b5caaa1ba6c22248ff22cc678b30d89cdd36 (diff)
downloadotp-ad56ed3c3ce10f50b1943a5827c516fc0ff98f4d.tar.gz
otp-ad56ed3c3ce10f50b1943a5827c516fc0ff98f4d.tar.bz2
otp-ad56ed3c3ce10f50b1943a5827c516fc0ff98f4d.zip
Merge branch 'hans/ssh/harmful_badmatch/OTP-13966' into maint-19
* hans/ssh/harmful_badmatch/OTP-13966: ssh: Removed matching of 'ok' after send which could cause error reports ssh: ssh_protocol_SUITE test for handling of illegal info_lines 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.
+
+%%%----------------------------------------------------------------