Skip to content

Commit

Permalink
Merge branch 'egil/add-scalefactor-to-start_node'
Browse files Browse the repository at this point in the history
* egil/add-scalefactor-to-start_node:
  test_server: Let start_node/3 utilize scalefactor
  test_server: Refactor timetrap_scale_factor/0
  • Loading branch information
psyeugenic committed Oct 12, 2012
2 parents ab3d42f + bae975e commit 16d74de
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
29 changes: 12 additions & 17 deletions lib/test_server/src/test_server.erl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2170,24 +2170,19 @@ continue(Pid) when is_pid(Pid) ->
%% %%
%% Returns the amount to scale timetraps with. %% Returns the amount to scale timetraps with.


%% {X, fun() -> check() end} <- multiply scale with X if Fun() is true
timetrap_scale_factor() -> timetrap_scale_factor() ->
F0 = case test_server:purify_is_running() of timetrap_scale_factor([
true -> 5; { 2, fun() -> has_lock_checking() end},
false -> 1 { 3, fun() -> has_superfluous_schedulers() end},
end, { 5, fun() -> purify_is_running() end},
F1 = case {is_debug(), has_lock_checking()} of { 6, fun() -> is_debug() end},
{true,_} -> 6 * F0; {10, fun() -> is_cover() end}
{false,true} -> 2 * F0; ]).
{false,false} -> F0
end, timetrap_scale_factor(Scales) ->
F = case has_superfluous_schedulers() of %% The fun in {S, Fun} a filter input to the list comprehension
true -> 3*F1; lists:foldl(fun(S,O) -> O*S end, 1, [ S || {S,F} <- Scales, F()]).
false -> F1
end,
case test_server:is_cover() of
true -> 10 * F;
false -> F
end.




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
6 changes: 4 additions & 2 deletions lib/test_server/src/test_server_node.erl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -424,10 +424,12 @@ start_node_peer(SlaveName, OptList, From, TI) ->
%% Bad environment can cause open port to fail. If this happens, %% Bad environment can cause open port to fail. If this happens,
%% we ignore it and let the testcase handle the situation... %% we ignore it and let the testcase handle the situation...
catch open_port({spawn, Cmd}, [stream|Opts]), catch open_port({spawn, Cmd}, [stream|Opts]),

Tmo = 60000 * test_server:timetrap_scale_factor(),


case start_node_get_option_value(wait, OptList, true) of case start_node_get_option_value(wait, OptList, true) of
true -> 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 case {Ret,FailOnError} of
{{{ok, Node}, Warning},_} -> {{{ok, Node}, Warning},_} ->
gen_server:reply(From,{{ok,Node},HostStr,Cmd,[],Warning}); gen_server:reply(From,{{ok,Node},HostStr,Cmd,[],Warning});
Expand All @@ -443,7 +445,7 @@ start_node_peer(SlaveName, OptList, From, TI) ->
Self = self(), Self = self(),
spawn_link( spawn_link(
fun() -> fun() ->
wait_for_node_started(LSock,60000,undefined, wait_for_node_started(LSock,Tmo,undefined,
Cleanup,TI,Self), Cleanup,TI,Self),
receive after infinity -> ok end receive after infinity -> ok end
end), end),
Expand Down

0 comments on commit 16d74de

Please sign in to comment.