diff options
author | Ingela Anderton Andin <[email protected]> | 2015-06-22 16:00:14 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2015-06-22 16:02:57 +0200 |
commit | 43787faa5933483128f06d775bc41fef36df4567 (patch) | |
tree | 4e853f2c3c84a6d74dfa454f69421eae27da1b9b /lib/ssl/test/ssl_test_lib.erl | |
parent | 287ab39e946b4578d755038989ad50ccfb95f575 (diff) | |
download | otp-43787faa5933483128f06d775bc41fef36df4567.tar.gz otp-43787faa5933483128f06d775bc41fef36df4567.tar.bz2 otp-43787faa5933483128f06d775bc41fef36df4567.zip |
ssl: Avoid sleep
When possible avoid sleep in test cases.
Diffstat (limited to 'lib/ssl/test/ssl_test_lib.erl')
-rw-r--r-- | lib/ssl/test/ssl_test_lib.erl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl index f35c0502ae..e5a8942400 100644 --- a/lib/ssl/test/ssl_test_lib.erl +++ b/lib/ssl/test/ssl_test_lib.erl @@ -1149,15 +1149,17 @@ check_sane_openssl_version(Version) -> enough_openssl_crl_support("OpenSSL 0." ++ _) -> false; enough_openssl_crl_support(_) -> true. -wait_for_openssl_server() -> - receive - {Port, {data, Debug}} when is_port(Port) -> - ct:log("~p:~p~nopenssl ~s~n",[?MODULE,?LINE, Debug]), - %% openssl has started make sure - %% it will be in accept. Parsing - %% output is too error prone. (Even - %% more so than sleep!) - ct:sleep(?SLEEP) +wait_for_openssl_server(Port) -> + wait_for_openssl_server(Port, 10). +wait_for_openssl_server(_, 0) -> + exit(failed_to_connect_to_openssl); +wait_for_openssl_server(Port, N) -> + case gen_tcp:connect("localhost", Port, []) of + {ok, S} -> + gen_tcp:close(S); + _ -> + ct:sleep(?SLEEP), + wait_for_openssl_server(Port, N-1) end. version_flag(tlsv1) -> |