diff options
author | Anders Svensson <[email protected]> | 2017-06-10 15:33:49 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-06-12 16:11:53 +0200 |
commit | 9296f611de2055c65bdae9425ce80e63fba6610f (patch) | |
tree | 478206de60e05e456f4681c085a46fea2bd7e6a6 | |
parent | 090898729237d33b0a6968ece9f11741cde7c27b (diff) | |
download | otp-9296f611de2055c65bdae9425ce80e63fba6610f.tar.gz otp-9296f611de2055c65bdae9425ce80e63fba6610f.tar.bz2 otp-9296f611de2055c65bdae9425ce80e63fba6610f.zip |
Randomly select traffic testcases
Since the number of configuration variants tested makes for (too) many.
Randomly select a subset of testcases in each configuration group.
-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 |