diff options
-rw-r--r-- | lib/diameter/test/diameter_traffic_SUITE.erl | 10 | ||||
-rw-r--r-- | lib/diameter/test/diameter_util.erl | 13 |
2 files changed, 10 insertions, 13 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index 6aa3ffb7af..bb10638cd2 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -341,7 +341,11 @@ init_per_group(Name, Config) -> server_strings = SD, server_sender = SS, server_throttle = ST}, - [{group, G} | Config]; + %% Limit the number of testcase, since the number of + %% groups is large. + All = ?util:scramble(tc()), + TCs = lists:sublist(All, rand:uniform(32)), + [{group, G}, {runlist, TCs} | Config]; _ -> Config end. @@ -359,12 +363,16 @@ end_per_group(_, _) -> %% Skip testcases that can reasonably fail under SCTP. init_per_testcase(Name, Config) -> + TCs = proplists:get_value(runlist, Config, []), + Run = [] == TCs orelse lists:member(Name, TCs), case [G || #group{transport = sctp} = G <- [proplists:get_value(group, Config)]] of [_] when Name == send_maxlen; Name == send_long -> {skip, sctp}; + _ when not Run -> + {skip, random}; _ -> [{testcase, Name} | Config] end. diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index 81b43913de..7266d3678c 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -173,18 +173,7 @@ recvl([{MRef, F} | L], Ref, Fun, Acc) -> %% Sort a list into random order. scramble(L) -> - foldl(fun(true, _, S, false) -> S end, - false, - [[fun s/1, L]]). - -s(L) -> - s([], L). - -s(Acc, []) -> - Acc; -s(Acc, L) -> - {H, [T|Rest]} = lists:split(rand:uniform(length(L)) - 1, L), - s([T|Acc], H ++ Rest). + [X || {_,X} <- lists:sort([{rand:uniform(), T} || T <- L])]. %% --------------------------------------------------------------------------- %% unique_string/0 |