diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-10-12 15:28:53 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-10-12 15:28:53 +0200 |
commit | 16d74de34df5fcfed25c55f0ee52cbb01e4169cb (patch) | |
tree | d56e88a3cb0f56a45348ad7769dd7f0f74a71f32 | |
parent | ab3d42f58df46d8b0011b154d51ce14a20282ad9 (diff) | |
parent | bae975e50a2270a267790f95fe918b71f688d2dc (diff) | |
download | otp-16d74de34df5fcfed25c55f0ee52cbb01e4169cb.tar.gz otp-16d74de34df5fcfed25c55f0ee52cbb01e4169cb.tar.bz2 otp-16d74de34df5fcfed25c55f0ee52cbb01e4169cb.zip |
Merge branch 'egil/add-scalefactor-to-start_node'
* egil/add-scalefactor-to-start_node:
test_server: Let start_node/3 utilize scalefactor
test_server: Refactor timetrap_scale_factor/0
-rw-r--r-- | lib/test_server/src/test_server.erl | 29 | ||||
-rw-r--r-- | lib/test_server/src/test_server_node.erl | 6 |
2 files changed, 16 insertions, 19 deletions
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index 8beed9bd3e..bfa5e927b1 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -2170,24 +2170,19 @@ continue(Pid) when is_pid(Pid) -> %% %% Returns the amount to scale timetraps with. +%% {X, fun() -> check() end} <- multiply scale with X if Fun() is true timetrap_scale_factor() -> - F0 = case test_server:purify_is_running() of - true -> 5; - false -> 1 - end, - F1 = case {is_debug(), has_lock_checking()} of - {true,_} -> 6 * F0; - {false,true} -> 2 * F0; - {false,false} -> F0 - end, - F = case has_superfluous_schedulers() of - true -> 3*F1; - false -> F1 - end, - case test_server:is_cover() of - true -> 10 * F; - false -> F - end. + timetrap_scale_factor([ + { 2, fun() -> has_lock_checking() end}, + { 3, fun() -> has_superfluous_schedulers() end}, + { 5, fun() -> purify_is_running() end}, + { 6, fun() -> is_debug() end}, + {10, fun() -> is_cover() end} + ]). + +timetrap_scale_factor(Scales) -> + %% The fun in {S, Fun} a filter input to the list comprehension + lists:foldl(fun(S,O) -> O*S end, 1, [ S || {S,F} <- Scales, F()]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/lib/test_server/src/test_server_node.erl b/lib/test_server/src/test_server_node.erl index 17c02dfbe5..872f15f2be 100644 --- a/lib/test_server/src/test_server_node.erl +++ b/lib/test_server/src/test_server_node.erl @@ -424,10 +424,12 @@ start_node_peer(SlaveName, OptList, From, TI) -> %% Bad environment can cause open port to fail. If this happens, %% we ignore it and let the testcase handle the situation... catch open_port({spawn, Cmd}, [stream|Opts]), + + Tmo = 60000 * test_server:timetrap_scale_factor(), case start_node_get_option_value(wait, OptList, true) of true -> - Ret = wait_for_node_started(LSock,60000,undefined,Cleanup,TI,self()), + Ret = wait_for_node_started(LSock,Tmo,undefined,Cleanup,TI,self()), case {Ret,FailOnError} of {{{ok, Node}, Warning},_} -> gen_server:reply(From,{{ok,Node},HostStr,Cmd,[],Warning}); @@ -443,7 +445,7 @@ start_node_peer(SlaveName, OptList, From, TI) -> Self = self(), spawn_link( fun() -> - wait_for_node_started(LSock,60000,undefined, + wait_for_node_started(LSock,Tmo,undefined, Cleanup,TI,Self), receive after infinity -> ok end end), |