From b318cb48b9a2e7609d4406138600e4873dbce0c5 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Wed, 14 Nov 2012 20:07:17 +0100 Subject: Minor test suite tweaks --- lib/diameter/test/diameter_compiler_SUITE.erl | 12 +++--------- lib/diameter/test/diameter_traffic_SUITE.erl | 21 +++++---------------- lib/diameter/test/diameter_util.erl | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 26 deletions(-) (limited to 'lib/diameter') diff --git a/lib/diameter/test/diameter_compiler_SUITE.erl b/lib/diameter/test/diameter_compiler_SUITE.erl index 4b792b5426..79bf9d32db 100644 --- a/lib/diameter/test/diameter_compiler_SUITE.erl +++ b/lib/diameter/test/diameter_compiler_SUITE.erl @@ -31,8 +31,8 @@ %% testcases -export([format/1, format/2, replace/1, replace/2, - generate/1, generate/4, generate/0, - examples/1, examples/0]). + generate/1, generate/4, + examples/1]). -export([dict/0]). %% fake dictionary module @@ -339,7 +339,7 @@ %% =========================================================================== suite() -> - [{timetrap, {minutes, 2}}]. + [{timetrap, {minutes, 10}}]. all() -> [format, @@ -407,9 +407,6 @@ re({RE, Repl}, Bin) -> %% %% Ensure success when generating code and compiling. -generate() -> - [{timetrap, {seconds, 2*length(?REPLACE)}}]. - generate(Config) -> Bin = proplists:get_value(base, Config), Rs = lists:zip(?REPLACE, lists:seq(1, length(?REPLACE))), @@ -436,9 +433,6 @@ generate(Mods, Bin, N, Mode) -> %% %% Compile dictionaries extracted from various standards. -examples() -> - [{timetrap, {seconds, 3*length(?EXAMPLES)}}]. - examples(_Config) -> Dir = filename:join([code:lib_dir(diameter, examples), "dict"]), [D || D <- ?EXAMPLES, _ <- [examples(?S(D), Dir)]]. diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl index fa9333a226..c157b0e304 100644 --- a/lib/diameter/test/diameter_traffic_SUITE.erl +++ b/lib/diameter/test/diameter_traffic_SUITE.erl @@ -183,14 +183,14 @@ suite() -> all() -> [start, start_services, add_transports, result_codes] - ++ [{group, name([E,C]), P} || E <- ?ENCODINGS, - C <- ?CONNECTIONS, - P <- [[], [parallel]]] + ++ [{group, ?util:name([E,C]), P} || E <- ?ENCODINGS, + C <- ?CONNECTIONS, + P <- [[], [parallel]]] ++ [remove_transports, stop_services, stop]. groups() -> Ts = tc(), - [{name([E,C]), [], Ts} || E <- ?ENCODINGS, C <- ?CONNECTIONS]. + [{?util:name([E,C]), [], Ts} || E <- ?ENCODINGS, C <- ?CONNECTIONS]. init_per_group(Name, Config) -> [{group, Name} | Config]. @@ -559,7 +559,7 @@ call(Config, Req) -> call(Config, Req, Opts) -> Name = proplists:get_value(testcase, Config), - [Encoding, Client] = name(proplists:get_value(group, Config)), + [Encoding, Client] = ?util:name(proplists:get_value(group, Config)), diameter:call(?CLIENT, dict(Req), req(Req, Encoding), @@ -599,17 +599,6 @@ set(Dict, E, FV, Rec) set(_, _, _, Rec) -> Rec. -%% Contruct and deconstruct names to work around group names being -%% restricted to atoms. - -name(Names) - when is_list(Names) -> - ?A(string:join([?L(A) || A <- Names], ",")); - -name(A) - when is_atom(A) -> - [?A(S) || S <- string:tokens(?L(A), ",")]. - %% =========================================================================== %% diameter callbacks diff --git a/lib/diameter/test/diameter_util.erl b/lib/diameter/test/diameter_util.erl index 890d24f6f8..5af4ad9ba5 100644 --- a/lib/diameter/test/diameter_util.erl +++ b/lib/diameter/test/diameter_util.erl @@ -24,7 +24,8 @@ %% %% generic --export([consult/2, +-export([name/1, + consult/2, run/1, fold/3, foldl/3, @@ -45,6 +46,21 @@ -define(L, atom_to_list). + +%% --------------------------------------------------------------------------- +%% name/2 +%% +%% Contruct and deconstruct lists of atoms as atoms to work around +%% group names in common_test being restricted to atoms. + +name(Names) + when is_list(Names) -> + list_to_atom(string:join([atom_to_list(A) || A <- Names], ",")); + +name(A) + when is_atom(A) -> + [list_to_atom(S) || S <- string:tokens(atom_to_list(A), ",")]. + %% --------------------------------------------------------------------------- %% consult/2 %% -- cgit v1.2.3