aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test/diameter_traffic_SUITE.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-07-09 06:17:25 +0200
committerAnders Svensson <[email protected]>2017-08-03 17:14:28 +0200
commit9a94d2df5b761685038a5e7f7f0920c6a8c3d451 (patch)
treef8c2035ae2896f80529be73f4c9d3b2bd2b7826e /lib/diameter/test/diameter_traffic_SUITE.erl
parente54f92c328c8fb117de88b1171f64358f1e7d3b1 (diff)
downloadotp-9a94d2df5b761685038a5e7f7f0920c6a8c3d451.tar.gz
otp-9a94d2df5b761685038a5e7f7f0920c6a8c3d451.tar.bz2
otp-9a94d2df5b761685038a5e7f7f0920c6a8c3d451.zip
Tweak limiting of testcases in traffic suite
Since the number is now under 50K again. Also make testing of individual groups or testcases easier.
Diffstat (limited to 'lib/diameter/test/diameter_traffic_SUITE.erl')
-rw-r--r--lib/diameter/test/diameter_traffic_SUITE.erl74
1 files changed, 39 insertions, 35 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl
index fae9f86c38..fbd57ca4d4 100644
--- a/lib/diameter/test/diameter_traffic_SUITE.erl
+++ b/lib/diameter/test/diameter_traffic_SUITE.erl
@@ -120,6 +120,11 @@
%% ===========================================================================
+%% Positive number of testcases from which to select (randomly) from
+%% tc(), the list of testcases to run, or [] to run all. The random
+%% selection is to limit the time it takes for the suite to run.
+-define(LIMIT, length(tc())).
+
-define(util, diameter_util).
-define(A, list_to_atom).
@@ -258,44 +263,40 @@ suite() ->
all() ->
[rfc4005, start, result_codes, {group, traffic}, empty, stop].
+%% Redefine this to run one or more groups for debugging purposes.
+-define(GROUPS, []).
+%-define(GROUPS, [[tcp,rfc6733,record,map,false,false,false,false]]).
+
groups() ->
- [{P, [P], Ts} || Ts <- [tc(tc())], P <- [shuffle, parallel]]
+ Names = names(),
+ [{P, [P], Ts} || Ts <- [tc()], P <- [shuffle, parallel]]
++
- [{?util:name([T,R,E,D,S,ST,SS,CS]),
- [],
- [{group, if S -> shuffle; not S -> parallel end}]}
- || T <- ?TRANSPORTS,
- R <- ?RFCS,
- E <- ?ENCODINGS,
- D <- ?DECODINGS,
- S <- ?STRING_DECODES,
- ST <- ?CALLBACKS,
- SS <- ?SENDERS,
- CS <- ?SENDERS]
+ [{?util:name(N), [], [{group, if S -> shuffle; not S -> parallel end}]}
+ || [_,_,_,_,S|_] = N <- Names]
++
- [{T, [], groups([[T,R,E,D,S,ST,SS,CS]
- || R <- ?RFCS,
- E <- ?ENCODINGS,
- D <- ?DECODINGS,
- S <- ?STRING_DECODES,
- ST <- ?CALLBACKS,
- SS <- ?SENDERS,
- CS <- ?SENDERS,
- SS orelse CS])} %% avoid deadlock
+ [{T, [], [{group, ?util:name(N)} || N <- names(Names, ?GROUPS),
+ T == hd(N)]}
|| T <- ?TRANSPORTS]
++
[{traffic, [], [{group, T} || T <- ?TRANSPORTS]}].
-%groups(_) -> %% debug
-% Name = [tcp,rfc6733,record,map,false,false,false,false],
-% [{group, ?util:name(Name)}];
-groups(Names) ->
- [{group, ?util:name(L)} || L <- Names].
+names() ->
+ [[T,R,E,D,S,ST,SS,CS] || T <- ?TRANSPORTS,
+ R <- ?RFCS,
+ E <- ?ENCODINGS,
+ D <- ?DECODINGS,
+ S <- ?STRING_DECODES,
+ ST <- ?CALLBACKS,
+ SS <- ?SENDERS,
+ CS <- ?SENDERS].
+
+names(Names, []) ->
+ [N || N <- Names,
+ [CS,SS|_] <- [lists:reverse(N)],
+ SS orelse CS]; %% avoid deadlock
-%tc([N|_]) -> %% debug
-% [N];
-tc(L) ->
- L.
+names(_, Names) ->
+ Names.
%% --------------------
@@ -339,11 +340,7 @@ init_per_group(Name, Config) ->
server_decoding = D,
server_sender = SS,
server_throttle = ST},
- %% 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];
+ [{group, G}, {runlist, select()} | Config];
_ ->
Config
end.
@@ -357,6 +354,13 @@ end_per_group(Name, Config)
end_per_group(_, _) ->
ok.
+select() ->
+ try rand:uniform(?LIMIT) of
+ N -> lists:sublist(?util:scramble(tc()), max(N,5))
+ catch
+ error:_ -> ?LIMIT
+ end.
+
%% --------------------
%% Skip testcases that can reasonably fail under SCTP.