aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test/httpc_SUITE.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-02-29 15:19:54 +0100
committerMicael Karlberg <[email protected]>2012-02-29 15:19:54 +0100
commit66288284701787c7b9e1775ec9bc91732c87f51d (patch)
treefbebd93cb70018893c154a7235973a1644cff702 /lib/inets/test/httpc_SUITE.erl
parentfae2034ba30fd9936960418ba36b90ca7028bb3d (diff)
downloadotp-66288284701787c7b9e1775ec9bc91732c87f51d.tar.gz
otp-66288284701787c7b9e1775ec9bc91732c87f51d.tar.bz2
otp-66288284701787c7b9e1775ec9bc91732c87f51d.zip
[inets/httpc] Make inets tests behave on all IPv6 impl
Updated according to pan/inets_ipv6_test_issues as far as possible (that branch is based on master).
Diffstat (limited to 'lib/inets/test/httpc_SUITE.erl')
-rw-r--r--lib/inets/test/httpc_SUITE.erl44
1 files changed, 31 insertions, 13 deletions
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index 3484a36047..a18d079426 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -275,6 +275,20 @@ init_per_testcase(Case, Timeout, Config) ->
%% inets:enable_trace(max, io, httpc),
%% inets:enable_trace(max, io, all),
+ %% <IPv6>
+ % Set default ipfamily to the same as the main server has by default
+ %% This makes the client try w/ ipv6 before falling back to ipv4,
+ %% as that is what the server is configured to do.
+ %% Note that this is required for the tests to run on *BSD w/ ipv6 enabled
+ %% as well as on Windows. The Linux behaviour of allowing ipv4 connects
+ %% to ipv6 sockets is not required or even encouraged.
+
+ httpc:set_options([{ipfamily, inet6fb4}]),
+
+ %% Note that the IPv6 trest case *must* use inet6,
+ %% so this value will be overwritten (see "ipv6_" below).
+ %% </IPv6>
+
NewConfig =
case atom_to_list(Case) of
[$s, $s, $l | _] ->
@@ -376,16 +390,18 @@ init_per_testcase(Case, Timeout, Config) ->
_ ->
%% Try inet6fb4 on windows...
- tsp("init_per_testcase -> allways try IPv6 on windows"),
- ?RUN_ON_WINDOWS(
- fun() ->
- tsp("init_per_testcase:set_options_fun -> "
- "set-option ipfamily to inet6fb4"),
- Res = httpc:set_options([{ipfamily, inet6fb4}]),
- tsp("init_per_testcase:set_options_fun -> "
- "~n Res: ~p", [Res]),
- Res
- end),
+ %% No need? Since it is set above?
+
+ %% tsp("init_per_testcase -> allways try IPv6 on windows"),
+ %% ?RUN_ON_WINDOWS(
+ %% fun() ->
+ %% tsp("init_per_testcase:set_options_fun -> "
+ %% "set-option ipfamily to inet6fb4"),
+ %% Res = httpc:set_options([{ipfamily, inet6fb4}]),
+ %% tsp("init_per_testcase:set_options_fun -> "
+ %% "~n Res: ~p", [Res]),
+ %% Res
+ %% end),
TmpConfig2 = lists:keydelete(local_server, 1, TmpConfig),
%% Will start inets
@@ -441,6 +457,7 @@ end_per_testcase(http_save_to_file = Case, Config) ->
end_per_testcase(Case, Config) ->
io:format(user, "~n~n*** END ~w:~w ***~n~n",
[?MODULE, Case]),
+ dbg:stop(), % ?
case atom_to_list(Case) of
"ipv6_" ++ _Rest ->
tsp("end_per_testcase(~w) -> stop ssl", [Case]),
@@ -1267,8 +1284,8 @@ http_redirect(Config) when is_list(Config) ->
"~n Config: ~p", [Config]),
case ?config(local_server, Config) of
ok ->
- tsp("http_redirect -> set ipfamily option to inet"),
- ok = httpc:set_options([{ipfamily, inet}]),
+ %% tsp("http_redirect -> set ipfamily option to inet"),
+ %% ok = httpc:set_options([{ipfamily, inet}]),
tsp("http_redirect -> start dummy server inet"),
{DummyServerPid, Port} = dummy_server(ipv4),
@@ -3316,7 +3333,8 @@ create_config(FileName, ComType, Port, PrivDir, ServerRoot, DocRoot,
" mod_include mod_dir mod_get mod_head"
" mod_log mod_disk_log mod_trace",
- BindAddress = "*|inet",
+ %% BindAddress = "*|inet", % Force the use of IPv4
+ BindAddress = "*", % This corresponds to using IpFamily inet6fb4
HttpConfig = [
cline(["BindAddress ", BindAddress]),