diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-10-05 17:18:28 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-10-08 16:43:36 +0200 |
commit | 6c031990aff7fbae45e45251f863d04ade4d39a1 (patch) | |
tree | 278708366020cf75e6624b1529e7414793f6fa2b /lib/test_server/src/test_server.erl | |
parent | 3ba23ad869bf8e81758d40cee9ddcb545af28aa2 (diff) | |
download | otp-6c031990aff7fbae45e45251f863d04ade4d39a1.tar.gz otp-6c031990aff7fbae45e45251f863d04ade4d39a1.tar.bz2 otp-6c031990aff7fbae45e45251f863d04ade4d39a1.zip |
test_server: Refactor timetrap_scale_factor/0
Diffstat (limited to 'lib/test_server/src/test_server.erl')
-rw-r--r-- | lib/test_server/src/test_server.erl | 29 |
1 files changed, 12 insertions, 17 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()]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |