From 37b394fc0f7a6cb799f07d396b30983327df74fc Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Mon, 19 Dec 2011 13:04:38 +0100 Subject: [inets] Improved error handling in test case --- lib/inets/test/httpc_SUITE.erl | 67 ++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 28 deletions(-) (limited to 'lib/inets/test/httpc_SUITE.erl') diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 3276481fed..c33ac12b66 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -245,31 +245,31 @@ init_per_testcase(Case, Timeout, Config) -> "~n~n*** INIT ~w:~w[~w] ***" "~n~n", [?MODULE, Case, Timeout]), - io:format("init_per_testcase(~w) -> entry with" - "~n Timeout: ~p" - "~n Config: ~p" - "~n" - "~nwhen" - "~n" - "~n OS Type: ~p" - "~n OS version: ~p" - "~n Sys Arch: ~p" - "~n CPU Topology: ~p" - "~n Num logical procs: ~p" - "~n SMP support: ~p" - "~n Num schedulers: ~p" - "~n Scheduler bindings: ~p" - "~n Wordsize: ~p" - "~n~n", [Case, Timeout, Config, - os:type(), os:version(), - erlang:system_info(system_architecture), - erlang:system_info(cpu_topology), - erlang:system_info(logical_processors), - erlang:system_info(smp_support), - erlang:system_info(schedulers), - erlang:system_info(scheduler_bindings), - erlang:system_info(wordsize)]), - + tsp("init_per_testcase(~w) -> entry with" + "~n Timeout: ~p" + "~n Config: ~p" + "~n" + "~nwhen" + "~n" + "~n OS Type: ~p" + "~n OS version: ~p" + "~n Sys Arch: ~p" + "~n CPU Topology: ~p" + "~n Num logical procs: ~p" + "~n SMP support: ~p" + "~n Num schedulers: ~p" + "~n Scheduler bindings: ~p" + "~n Wordsize: ~p" + "~n~n", [Case, Timeout, Config, + os:type(), os:version(), + erlang:system_info(system_architecture), + erlang:system_info(cpu_topology), + erlang:system_info(logical_processors), + erlang:system_info(smp_support), + erlang:system_info(schedulers), + erlang:system_info(scheduler_bindings), + erlang:system_info(wordsize)]), + PrivDir = ?config(priv_dir, Config), application:stop(inets), Dog = test_server:timetrap(inets_test_lib:minutes(Timeout)), @@ -1169,9 +1169,20 @@ ssl_get(SslTag, Config) when is_list(Config) -> "~n URL: ~p" "~n SslTag: ~p" "~n SSLOptions: ~p", [URL, SslTag, SSLOptions]), - {ok, {{_,200, _}, [_ | _], Body = [_ | _]}} = - httpc:request(get, {URL, []}, [{ssl, SSLConfig}], []), - inets_test_lib:check_body(Body); + case httpc:request(get, {URL, []}, [{ssl, SSLConfig}], []) of + {ok, {{_,200, _}, [_ | _], Body = [_ | _]}} -> + inets_test_lib:check_body(Body), + ok; + {ok, {StatusLine, Headers, _Body}} -> + tsp("ssl_get -> unexpected result: " + "~n StatusLine: ~p" + "~n Headers: ~p", [StatusLine, Headers]), + tsf({unexpected_response, StatusLine, Headers}); + {error, Reason} -> + tsp("ssl_get -> request failed: " + "~n Reason: ~p", [Reason]), + tsf({request_failed, Reason}) + end; {ok, _} -> {skip, "local http-server not started"}; _ -> -- cgit v1.2.3