aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-12-19 13:04:38 +0100
committerMicael Karlberg <[email protected]>2012-02-03 18:22:03 +0100
commit37b394fc0f7a6cb799f07d396b30983327df74fc (patch)
treef5e53746059ebb1c90bf67c2e1c54815cab4c084 /lib
parent411da4a989320ba7f7b775e696b94df4c6b13c59 (diff)
downloadotp-37b394fc0f7a6cb799f07d396b30983327df74fc.tar.gz
otp-37b394fc0f7a6cb799f07d396b30983327df74fc.tar.bz2
otp-37b394fc0f7a6cb799f07d396b30983327df74fc.zip
[inets] Improved error handling in test case
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/test/httpc_SUITE.erl67
1 files changed, 39 insertions, 28 deletions
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"};
_ ->