aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/inets/test/httpc_SUITE.erl37
-rw-r--r--lib/inets/test/httpd_mod.erl23
-rw-r--r--lib/inets/test/httpd_test_lib.erl22
-rw-r--r--lib/inets/test/inets_test_lib.hrl5
4 files changed, 41 insertions, 46 deletions
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index c33ac12b66..089e0766cb 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -245,30 +245,7 @@ init_per_testcase(Case, Timeout, Config) ->
"~n~n*** INIT ~w:~w[~w] ***"
"~n~n", [?MODULE, Case, Timeout]),
- 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)]),
+ ?PRINT_SYSTEM_INFO("init_per_testcase"),
PrivDir = ?config(priv_dir, Config),
application:stop(inets),
@@ -382,8 +359,10 @@ init_per_testcase(Case, Timeout, Config) ->
_ ->
%% Try inet6fb4 on windows...
- %% ...but since I dont know exactly how to test this...
- %% ...this should also effect the server...
+ ?RUN_ON_WINDOWS(
+ fun() ->
+ httpc:set_options([{ipfamily, inet6fb4}])
+ end),
TmpConfig2 = lists:keydelete(local_server, 1, TmpConfig),
%% Will start inets
@@ -397,9 +376,9 @@ init_per_testcase(Case, Timeout, Config) ->
inets:enable_trace(max, io, httpc),
%% inets:enable_trace(max, io, all),
%% snmp:set_trace([gen_tcp]),
- io:format("init_per_testcase(~w) -> done when"
- "~n NewConfig: ~p"
- "~n~n", [Case, NewConfig]),
+ tsp("init_per_testcase(~w) -> done when"
+ "~n NewConfig: ~p"
+ "~n~n", [Case, NewConfig]),
NewConfig.
diff --git a/lib/inets/test/httpd_mod.erl b/lib/inets/test/httpd_mod.erl
index 5016cdb9e6..6ba0624210 100644
--- a/lib/inets/test/httpd_mod.erl
+++ b/lib/inets/test/httpd_mod.erl
@@ -39,14 +39,25 @@
%% Test cases starts here.
%%-------------------------------------------------------------------------
alias(Type, Port, Host, Node) ->
-%% io:format(user, "~w:alias -> entry with"
+ %% io:format(user, "~w:alias -> entry with"
%% "~n Type: ~p"
%% "~n Port: ~p"
%% "~n Host: ~p"
%% "~n Node: ~p"
%% "~n", [?MODULE, Type, Port, Host, Node]),
+
+ %% This is very crude, but...
+ io:format(user,
+ "alias -> Has IPv6 support: ~p",
+ [inets_test_lib:has_ipv6_support()]),
+ Opts = case os:type() of
+ {win32, _} ->
+ [inet6fb4];
+ _ ->
+ []
+ end,
- ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
+ ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node,
"GET /pics/icon.sheet.gif "
"HTTP/1.0\r\n\r\n",
[{statuscode, 200},
@@ -55,7 +66,7 @@ alias(Type, Port, Host, Node) ->
{header, "Date"},
{version, "HTTP/1.0"}]),
- ok = httpd_test_lib:verify_request(Type, Host, Port, Node,
+ ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node,
"GET / HTTP/1.0\r\n\r\n",
[{statuscode, 200},
{header, "Content-Type","text/html"},
@@ -63,7 +74,7 @@ alias(Type, Port, Host, Node) ->
{header, "Date"},
{version, "HTTP/1.0"}]),
- ok = httpd_test_lib:verify_request(Type,Host,Port,Node,
+ ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node,
"GET /misc/ HTTP/1.0\r\n\r\n",
[{statuscode, 200},
{header, "Content-Type","text/html"},
@@ -71,8 +82,8 @@ alias(Type, Port, Host, Node) ->
{header, "Date"},
{version, "HTTP/1.0"}]),
- %% Check redirection if trailing slash is missing.
- ok = httpd_test_lib:verify_request(Type,Host,Port,Node,
+ %% Check redirection if trailing slash is missing.
+ ok = httpd_test_lib:verify_request(Type, Host, Port, Opts, Node,
"GET /misc HTTP/1.0\r\n\r\n",
[{statuscode, 301},
{header, "Location"},
diff --git a/lib/inets/test/httpd_test_lib.erl b/lib/inets/test/httpd_test_lib.erl
index 2f5867559a..ed6ee315b3 100644
--- a/lib/inets/test/httpd_test_lib.erl
+++ b/lib/inets/test/httpd_test_lib.erl
@@ -79,19 +79,19 @@
%%--------------------------------------------------------------------
%% API
%%------------------------------------------------------------------
+
verify_request(SocketType, Host, Port, Node, RequestStr, Options) ->
- verify_request(SocketType, Host, Port, Node, RequestStr,
- Options, 30000).
+ verify_request(SocketType, Host, Port, Node, RequestStr, Options, 30000).
+
verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, Options)
when is_list(TranspOpts) ->
- verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr,
- Options, 30000);
+ verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, Options, 30000);
+
verify_request(SocketType, Host, Port, Node, RequestStr, Options, TimeOut)
when (is_integer(TimeOut) orelse (TimeOut =:= infinity)) ->
- verify_request(SocketType, Host, Port, [], Node, RequestStr,
- Options, TimeOut).
-verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr,
- Options, TimeOut) ->
+ verify_request(SocketType, Host, Port, [], Node, RequestStr, Options, TimeOut).
+
+verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr, Options, TimeOut) ->
tsp("verify_request -> entry with"
"~n SocketType: ~p"
"~n Host: ~p"
@@ -117,15 +117,15 @@ verify_request(SocketType, Host, Port, TranspOpts, Node, RequestStr,
case request(State#state{request = RequestStr,
socket = Socket}, TimeOut) of
{error, Reason} ->
- tsp("request failed: "
+ tsp("verify_request -> request failed: "
"~n Reason: ~p", [Reason]),
{error, Reason};
NewState ->
- tsp("validate reply: "
+ tsp("verify_request -> validate reply: "
"~n NewState: ~p", [NewState]),
ValidateResult =
validate(RequestStr, NewState, Options, Node, Port),
- tsp("validation result: "
+ tsp("verify_request -> validation result: "
"~n ~p", [ValidateResult]),
inets_test_lib:close(SocketType, Socket),
ValidateResult
diff --git a/lib/inets/test/inets_test_lib.hrl b/lib/inets/test/inets_test_lib.hrl
index c578398c55..6a86b1b764 100644
--- a/lib/inets/test/inets_test_lib.hrl
+++ b/lib/inets/test/inets_test_lib.hrl
@@ -50,6 +50,11 @@
-define(OSCMD(Cmd), inets_test_lib:oscmd(Cmd)).
+-define(PRINT_SYSTEM_INFO(P), inets_test_lib:print_system_info(P)).
+
+-define(RUN_ON_OS(OS, FUN), inets_test_lib:run_on_os(OS, FUN)).
+-define(RUN_ON_WINDOWS(FUN), inets_test_lib:run_on_windows(FUN)).
+
%% - Test case macros -