aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssl/test
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-11-18 10:34:04 +0100
committerIngela Anderton Andin <[email protected]>2013-12-02 09:50:27 +0100
commitbae8fb577c0c3d2f5a3db31a34e584c8d7ccab6e (patch)
tree1188bc6a808d3f7adf19aaa721576631009dd58d /lib/ssl/test
parentc9a45539359d71aa0c68c9ca45b8015dd0e1b9cd (diff)
downloadotp-bae8fb577c0c3d2f5a3db31a34e584c8d7ccab6e.tar.gz
otp-bae8fb577c0c3d2f5a3db31a34e584c8d7ccab6e.tar.bz2
otp-bae8fb577c0c3d2f5a3db31a34e584c8d7ccab6e.zip
ssl: Test case enhancement
Make sure that test cases does not fail due to timing circumstances, use selective receive even if it means we can not use test library functions in some cases. TCP does not have delivery guarantee to application layer, so sometimes a error message {error, Msg} or {error, closed} can be acceptable.
Diffstat (limited to 'lib/ssl/test')
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl5
-rw-r--r--lib/ssl/test/ssl_certificate_verify_SUITE.erl24
-rw-r--r--lib/ssl/test/ssl_dist_SUITE.erl2
-rw-r--r--lib/ssl/test/ssl_to_openssl_SUITE.erl5
4 files changed, 27 insertions, 9 deletions
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index b4f71ba776..7a854afc80 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -2490,7 +2490,10 @@ ssl_accept_timeout(Config) ->
ssl_test_lib:check_result(Server, {error, timeout}),
receive
{'EXIT', Server, _} ->
- [] = supervisor:which_children(ssl_connection_sup)
+ %% Make sure supervisor had time to react on process exit
+ %% Could we come up with a better solution to this?
+ ct:sleep(500),
+ [] = supervisor:which_children(tls_connection_sup)
end
end.
diff --git a/lib/ssl/test/ssl_certificate_verify_SUITE.erl b/lib/ssl/test/ssl_certificate_verify_SUITE.erl
index f76c55f670..14047c6e9c 100644
--- a/lib/ssl/test/ssl_certificate_verify_SUITE.erl
+++ b/lib/ssl/test/ssl_certificate_verify_SUITE.erl
@@ -250,10 +250,15 @@ server_require_peer_cert_fail(Config) when is_list(Config) ->
{host, Hostname},
{from, self()},
{options, [{active, false} | BadClientOpts]}]),
-
- ssl_test_lib:check_result(Server, {error, {tls_alert, "handshake failure"}},
- Client, {error, {tls_alert, "handshake failure"}}).
-
+ receive
+ {Server, {error, {tls_alert, "handshake failure"}}} ->
+ receive
+ {Client, {error, {tls_alert, "handshake failure"}}} ->
+ ok;
+ {Client, {error, closed}} ->
+ ok
+ end
+ end.
%%--------------------------------------------------------------------
verify_fun_always_run_client() ->
@@ -827,9 +832,16 @@ unknown_server_ca_fail(Config) when is_list(Config) ->
[{verify, verify_peer},
{verify_fun, FunAndState}
| ClientOpts]}]),
+ receive
+ {Server, {error, {tls_alert, "unknown ca"}}} ->
+ receive
+ {Client, {error, {tls_alert, "unknown ca"}}} ->
+ ok;
+ {Client, {error, closed}} ->
+ ok
+ end
+ end.
- ssl_test_lib:check_result(Server, {error, {tls_alert, "unknown ca"}},
- Client, {error, {tls_alert, "unknown ca"}}).
%%--------------------------------------------------------------------
unknown_server_ca_accept_verify_none() ->
diff --git a/lib/ssl/test/ssl_dist_SUITE.erl b/lib/ssl/test/ssl_dist_SUITE.erl
index 7bfd678f4b..d3b523ca8c 100644
--- a/lib/ssl/test/ssl_dist_SUITE.erl
+++ b/lib/ssl/test/ssl_dist_SUITE.erl
@@ -95,7 +95,7 @@ common_init(Case, Config) ->
end_per_testcase(Case, Config) when is_list(Config) ->
Flags = proplists:get_value(old_flags, Config),
- os:putenv("ERL_FLAGS", Flags),
+ catch os:putenv("ERL_FLAGS", Flags),
common_end(Case, Config).
common_end(_, Config) ->
diff --git a/lib/ssl/test/ssl_to_openssl_SUITE.erl b/lib/ssl/test/ssl_to_openssl_SUITE.erl
index b576b8f70d..21f0172dba 100644
--- a/lib/ssl/test/ssl_to_openssl_SUITE.erl
+++ b/lib/ssl/test/ssl_to_openssl_SUITE.erl
@@ -897,8 +897,11 @@ ssl2_erlang_server_openssl_client(Config) when is_list(Config) ->
OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]),
true = port_command(OpenSslPort, Data),
+
+ ct:log("Ports ~p~n", [[erlang:port_info(P) || P <- erlang:ports()]]),
receive
- {'EXIT', OpenSslPort, _} ->
+ {'EXIT', OpenSslPort, _} = Exit ->
+ ct:log("Received: ~p ~n", [Exit]),
ok
end,