Skip to content

Commit

Permalink
Merge branch 'lukas/fix_erts_testcases/OTP-9596' into dev
Browse files Browse the repository at this point in the history
* lukas/fix_erts_testcases/OTP-9596:
  Skip create_big_boot on platforms without crypto
  Remove test_server path instead of cwd for clash test
  Skip getaddr_v6 test if on the ipv4_only host
  Use static port for old solaris versions
  Extend time to wait for zone files to be loaded
  Allow out of memory exception for max_port checks
  Extend slave start timeout for windows tests
  Double timeout to make sure debug builds pass
  Use now instead of os:timestamp
  Increase timeout in scheduler_suspend for slow platforms
  Skip update_cpu_info if 'taskset' cannot be found
  • Loading branch information
garazdawi committed Sep 29, 2011
2 parents 0911888 + d41617d commit 1be1c1c
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 20 deletions.
4 changes: 2 additions & 2 deletions erts/emulator/test/busy_port_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,12 @@ hs_busy_pcmd(Prt, Opts, StartFun, EndFun) ->
P = spawn_link(fun () ->
erlang:yield(),
Tester ! {self(), doing_port_command},
Start = os:timestamp(),
Start = now(),
Res = try {return,
port_command(Prt, [], Opts)}
catch Exception:Error -> {Exception, Error}
end,
End = os:timestamp(),
End = now(),
Time = round(timer:now_diff(End, Start)/1000),
Tester ! {self(), port_command_result, Res, Time}
end),
Expand Down
4 changes: 2 additions & 2 deletions erts/emulator/test/distribution_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ receiver2(Num, TotSize) ->

link_to_busy(doc) -> "Test that link/1 to a busy distribution port works.";
link_to_busy(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(30)),
?line Dog = test_server:timetrap(test_server:seconds(60)),
?line {ok, Node} = start_node(link_to_busy),
?line Recv = spawn(Node, erlang, apply, [fun sink/1, [link_to_busy_sink]]),

Expand Down Expand Up @@ -383,7 +383,7 @@ tail_applied_linker(Pid) ->

exit_to_busy(doc) -> "Test that exit/2 to a busy distribution port works.";
exit_to_busy(Config) when is_list(Config) ->
?line Dog = test_server:timetrap(test_server:seconds(30)),
?line Dog = test_server:timetrap(test_server:seconds(60)),
?line {ok, Node} = start_node(exit_to_busy),

Tracer = case os:getenv("TRACE_BUSY_DIST_PORT") of
Expand Down
2 changes: 2 additions & 0 deletions erts/emulator/test/port_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,8 @@ open_ports(Name, Settings) ->
[];
system_limit ->
[];
enomem ->
[];
Other ->
?line test_server:fail({open_ports, Other})
end;
Expand Down
13 changes: 11 additions & 2 deletions erts/emulator/test/scheduler_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,17 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.


init_per_testcase(update_cpu_info, Config) ->
case os:find_executable("taskset") of
false ->
{skip,"Could not find 'taskset' in path"};
_ ->
init_per_tc(update_cpu_info, Config)
end;
init_per_testcase(Case, Config) when is_list(Config) ->
init_per_tc(Case, Config).

init_per_tc(Case, Config) ->
Dog = ?t:timetrap(?DEFAULT_TIMEOUT),
process_flag(priority, max),
erlang:display({'------------', ?MODULE, Case, '------------'}),
Expand Down Expand Up @@ -1030,7 +1039,7 @@ sbt_test(Config, CpuTCmd, ClBt, Bt, LP) ->
?line ok.

scheduler_suspend(Config) when is_list(Config) ->
?line Dog = ?t:timetrap(?t:minutes(2)),
?line Dog = ?t:timetrap(?t:minutes(5)),
?line lists:foreach(fun (S) -> scheduler_suspend_test(Config, S) end,
[64, 32, 16, default]),
?line ?t:timetrap_cancel(Dog),
Expand Down
6 changes: 4 additions & 2 deletions lib/common_test/test/ct_test_support.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

-include_lib("test_server/include/test_server.hrl").
-include_lib("common_test/include/ct_event.hrl").
-include_lib("common_test/include/ct.hrl").

-export([init_per_suite/1, init_per_suite/2, end_per_suite/1,
init_per_testcase/2, end_per_testcase/2,
Expand All @@ -46,9 +47,10 @@ init_per_suite(Config) ->
init_per_suite(Config, Level) ->
case os:type() of
{win32, _} ->
%% Extend timeout for windows as starting node
%% Extend timeout to 1 hour for windows as starting node
%% can take a long time there
test_server:timetrap( 120000 * test_server:timetrap_scale_factor());
test_server:timetrap( 60*60*1000 *
test_server:timetrap_scale_factor());
_ ->
ok
end,
Expand Down
21 changes: 15 additions & 6 deletions lib/kernel/test/code_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ init_per_suite(Config) ->
end_per_suite(Config) ->
Config.

init_per_testcase(big_boot_embedded, Config) ->
case catch crypto:start() of
ok ->
init_per_testcase(do_big_boot_embedded, Config);
_Else ->
{skip, "Needs crypto!"}
end;
init_per_testcase(_Func, Config) ->
Dog=?t:timetrap(?t:minutes(5)),
P=code:get_path(),
Expand Down Expand Up @@ -573,11 +580,13 @@ add_del_path(Config) when is_list(Config) ->
clash(Config) when is_list(Config) ->
DDir = ?config(data_dir,Config)++"clash/",
P = code:get_path(),
[TestServerPath|_] = [Path || Path <- code:get_path(),
re:run(Path,"test_server/?$",[]) /= nomatch],

%% test non-clashing entries

%% remove "." to prevent clash with test-server path
?line true = code:del_path("."),
%% remove TestServerPath to prevent clash with test-server path
?line true = code:del_path(TestServerPath),
?line true = code:add_path(DDir++"foobar-0.1/ebin"),
?line true = code:add_path(DDir++"zork-0.8/ebin"),
test_server:capture_start(),
Expand All @@ -589,8 +598,8 @@ clash(Config) when is_list(Config) ->

%% test clashing entries

%% remove "." to prevent clash with test-server path
?line true = code:del_path("."),
%% remove TestServerPath to prevent clash with test-server path
?line true = code:del_path(TestServerPath),
?line true = code:add_path(DDir++"foobar-0.1/ebin"),
?line true = code:add_path(DDir++"foobar-0.1.ez/foobar-0.1/ebin"),
test_server:capture_start(),
Expand All @@ -603,9 +612,9 @@ clash(Config) when is_list(Config) ->

%% test "Bad path can't read"

%% remove "." to prevent clash with test-server path
%% remove TestServerPath to prevent clash with test-server path
Priv = ?config(priv_dir, Config),
?line true = code:del_path("."),
?line true = code:del_path(TestServerPath),
TmpEzFile = Priv++"foobar-0.tmp.ez",
?line {ok, _} = file:copy(DDir++"foobar-0.1.ez", TmpEzFile),
?line true = code:add_path(TmpEzFile++"/foobar-0.1/ebin"),
Expand Down
2 changes: 1 addition & 1 deletion lib/kernel/test/inet_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ t_getaddr_v6(Config) when is_list(Config) ->
?line {Name,FullName,IPStr,_IP,_,IP_46_Str,IP46} =
ct:get_config(test_host_ipv4_only),
case {inet:getaddr(IP_46_Str, inet6),inet:getaddr(Name, inet6)} of
{{ok,IP46},{ok,_}} ->
{{ok,IP46},{ok,V4Addr}} when V4Addr /= {0,0,0,0,0,0,0,1} ->
%% Since we suceeded in parsing an IPv6 address string and
%% look up the name, this computer fully supports IPv6.
?line {ok,IP46} = inet:getaddr(IP46, inet6),
Expand Down
12 changes: 9 additions & 3 deletions lib/kernel/test/inet_res_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ ns_init(ZoneDir, PrivDir, DataDir) ->
case os:type() of
{unix,_} when ZoneDir =:= undefined -> undefined;
{unix,_} ->
{ok,S} = gen_udp:open(0, [{reuseaddr,true}]),
{ok,PortNum} = inet:port(S),
gen_udp:close(S),
PortNum = case {os:type(),os:version()} of
{{unix,solaris},{M,V,_}} when M =< 5, V < 10 ->
11895 + random:uniform(100);
_ ->
{ok,S} = gen_udp:open(0, [{reuseaddr,true}]),
{ok,PNum} = inet:port(S),
gen_udp:close(S),
PNum
end,
RunNamed = filename:join(DataDir, ?RUN_NAMED),
NS = {{127,0,0,1},PortNum},
P = erlang:open_port({spawn_executable,RunNamed},
Expand Down
4 changes: 2 additions & 2 deletions lib/kernel/test/inet_res_SUITE_data/run-named
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##
## %CopyrightBegin%
##
## Copyright Ericsson AB 2009. All Rights Reserved.
## Copyright Ericsson AB 2009-2011. All Rights Reserved.
##
## The contents of this file are subject to the Erlang Public License,
## Version 1.1, (the "License"); you may not use this file except in
Expand Down Expand Up @@ -155,7 +155,7 @@ $NAMED $NAMED_FG -c "$CONF_FILE" >"$LOG_FILE" 2>&1 </dev/null &
NAMED=$!
trap "kill -TERM $NAMED >/dev/null 2>&1; wait $NAMED >/dev/null 2>&1" \
0 1 2 3 15
sleep 1 # Give name server time to load its zone files
sleep 2 # Give name server time to load its zone files
echo "Running: Enter \`\`quit'' to terminate nameserver[$NAMED]..."
while read LINE; do
test :"$LINE" = :'quit' && break
Expand Down

0 comments on commit 1be1c1c

Please sign in to comment.