aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2013-03-22 14:13:46 +0100
committerMicael Karlberg <[email protected]>2013-03-22 14:13:46 +0100
commitaec630d41b13e31c7732513457a54e19937c7a75 (patch)
treee3b5092382590918532d377a36fbb32b4185de98
parentdcac05b4490ce2715c35724b876b539164d7a92e (diff)
downloadotp-aec630d41b13e31c7732513457a54e19937c7a75.tar.gz
otp-aec630d41b13e31c7732513457a54e19937c7a75.tar.bz2
otp-aec630d41b13e31c7732513457a54e19937c7a75.zip
Test case cleanup
-rw-r--r--lib/megaco/test/megaco_codec_flex_lib.erl12
-rw-r--r--lib/megaco/test/megaco_codec_v2_test.erl78
-rw-r--r--lib/megaco/test/megaco_test_lib.erl58
3 files changed, 84 insertions, 64 deletions
diff --git a/lib/megaco/test/megaco_codec_flex_lib.erl b/lib/megaco/test/megaco_codec_flex_lib.erl
index e5f62fe69c..3e70454faf 100644
--- a/lib/megaco/test/megaco_codec_flex_lib.erl
+++ b/lib/megaco/test/megaco_codec_flex_lib.erl
@@ -49,14 +49,14 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
init(Config) when is_list(Config) ->
- io:format("~w:init -> entry with"
- "~n Config: ~p"
- "~n", [?MODULE, Config]),
+ %% io:format("~w:init -> entry with"
+ %% "~n Config: ~p"
+ %% "~n", [?MODULE, Config]),
Flag = process_flag(trap_exit, true),
Res = (catch start()),
- io:format("~w:init -> start result"
- "~n Res: ~p"
- "~n", [?MODULE, Res]),
+ %% io:format("~w:init -> start result"
+ %% "~n Res: ~p"
+ %% "~n", [?MODULE, Res]),
process_flag(trap_exit, Flag),
case Res of
{error, Reason} ->
diff --git a/lib/megaco/test/megaco_codec_v2_test.erl b/lib/megaco/test/megaco_codec_v2_test.erl
index c25eb4be24..248612ed12 100644
--- a/lib/megaco/test/megaco_codec_v2_test.erl
+++ b/lib/megaco/test/megaco_codec_v2_test.erl
@@ -623,7 +623,7 @@ compact_tickets(suite) ->
].
flex_compact_tickets(suite) ->
- io:format("flex_compact_tickets(suite) -> entry~n", []),
+ %% io:format("flex_compact_tickets(suite) -> entry~n", []),
{req, [],
{conf, flex_compact_init, flex_compact_tickets_cases(),
flex_compact_finish}}.
@@ -3944,8 +3944,8 @@ m=audio - TDM -
flex_compact_seq12263_msg01(suite) ->
[];
flex_compact_seq12263_msg01(Config) when is_list(Config) ->
- put(dbg, true),
- put(severity, trc),
+ %% put(dbg, true),
+ %% put(severity, trc),
d("flex_compact_seq12263_msg01 -> entry", []),
Msg = flex_compact_seq12263_msg01(),
d("flex_compact_seq12263_msg01 -> message created", []),
@@ -3960,13 +3960,13 @@ flex_compact_seq12263_msg01(Config) when is_list(Config) ->
exit(Error)
end,
d("flex_compact_seq12263_msg01 -> flex config generated", []),
- flex_compact_seq12263([Conf], Msg).
+ flex_compact_seq12263([Conf], lists:duplicate(1000, Msg)).
flex_compact_seq12263_msg02(suite) ->
[];
flex_compact_seq12263_msg02(Config) when is_list(Config) ->
- put(dbg, true),
- put(severity, trc),
+ %% put(dbg, true),
+ %% put(severity, trc),
d("flex_compact_seq12263_msg02 -> entry", []),
Msg = flex_compact_seq12263_msg02(),
d("flex_compact_seq12263_msg02 -> message created", []),
@@ -3981,13 +3981,13 @@ flex_compact_seq12263_msg02(Config) when is_list(Config) ->
exit(Error)
end,
d("flex_compact_seq12263_msg02 -> flex config generated", []),
- flex_compact_seq12263([Conf], Msg).
+ flex_compact_seq12263([Conf], lists:duplicate(1000, Msg)).
flex_compact_seq12263_msg03(suite) ->
[];
flex_compact_seq12263_msg03(Config) when is_list(Config) ->
- put(dbg, true),
- put(severity, trc),
+ %% put(dbg, true),
+ %% put(severity, trc),
d("flex_compact_seq12263_msg03 -> entry", []),
Msg = flex_compact_seq12263_msg03(),
d("flex_compact_seq12263_msg03 -> message created", []),
@@ -4002,13 +4002,13 @@ flex_compact_seq12263_msg03(Config) when is_list(Config) ->
exit(Error)
end,
d("flex_compact_seq12263_msg03 -> flex config generated", []),
- flex_compact_seq12263([Conf], Msg).
+ flex_compact_seq12263([Conf], lists:duplicate(1000, Msg)).
flex_compact_seq12263_msg04(suite) ->
[];
flex_compact_seq12263_msg04(Config) when is_list(Config) ->
- put(dbg, true),
- put(severity, trc),
+ %% put(dbg, true),
+ %% put(severity, trc),
d("flex_compact_seq12263_msg04 -> entry", []),
Msg = flex_compact_seq12263_msg04(),
d("flex_compact_seq12263_msg04 -> message created", []),
@@ -4023,22 +4023,42 @@ flex_compact_seq12263_msg04(Config) when is_list(Config) ->
exit(Error)
end,
d("flex_compact_seq12263_msg04 -> flex config generated", []),
- flex_compact_seq12263([Conf], Msg).
+ flex_compact_seq12263([Conf], lists:duplicate(1000, Msg)).
-flex_compact_seq12263(EC, BinMsg) ->
- d("flex_compact_seq12263 -> "
- "~n ~p", [binary_to_list(BinMsg)]),
+flex_compact_seq12263(EC, BinMsgs) ->
+ BinMsgs2 = enumerate(BinMsgs),
Codec = megaco_compact_text_encoder,
- case decode_message(Codec, false, EC, BinMsg) of
- {ok, Msg} ->
- d("flex_compact_seq12263 -> decode ok: ~n~p", [Msg]),
- ok;
- {error, Reason} ->
- e("flex_compact_seq12263 -> decode failed: ~p", [Reason]),
- {error, Reason}
+ try
+ begin
+ lists:foreach(
+ fun({No, BinMsg}) ->
+ case decode_message(Codec, false, EC, BinMsg) of
+ {ok, _Msg} ->
+ d("flex_compact_seq12263 -> decode ok", []),
+ ok;
+ {error, Reason} ->
+ e("flex_compact_seq12263 -> "
+ "decode ~w failed: ~p", [No, Reason]),
+ throw({error, No, Reason})
+ end
+ end, BinMsgs2),
+ ok
+ end
+ catch
+ exit:E ->
+ exit(E)
end.
+enumerate(L) ->
+ enumerate(1, L).
+
+enumerate(_No, []) ->
+ [];
+enumerate(No, [H|T]) ->
+ [{No, H} | enumerate(No+1, T)].
+
+
%% ==============================================================
%%
%% P r e t t y T e s t c a s e s
@@ -7665,13 +7685,13 @@ cre_PkgsItem(Name, Ver) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
flex_init(Config) ->
- io:format("~w:flex_init -> entry with: "
- "~n Config: ~p"
- "~n", [?MODULE, Config]),
+ %% io:format("~w:flex_init -> entry with: "
+ %% "~n Config: ~p"
+ %% "~n", [?MODULE, Config]),
Res = megaco_codec_flex_lib:init(Config),
- io:format("~w:flex_init -> flex init result: "
- "~n Res: ~p"
- "~n", [?MODULE, Res]),
+ %% io:format("~w:flex_init -> flex init result: "
+ %% "~n Res: ~p"
+ %% "~n", [?MODULE, Res]),
Res.
flex_finish(Config) ->
diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl
index 0018f4c247..55eee97443 100644
--- a/lib/megaco/test/megaco_test_lib.erl
+++ b/lib/megaco/test/megaco_test_lib.erl
@@ -114,7 +114,7 @@ os_based_skip(_) ->
tickets(Case) ->
Res = lists:flatten(tickets(Case, default_config())),
- io:format("~w:tickets(Case = ~w) -> Res: ~p~n", [?MODULE, Case, Res]),
+ %% io:format("~w:tickets(Case = ~w) -> Res: ~p~n", [?MODULE, Case, Res]),
display_result(Res),
Res.
@@ -122,24 +122,24 @@ tickets(Cases, Config) when is_list(Cases) ->
[tickets(Case, Config) || Case <- Cases];
tickets(Mod, Config) when is_atom(Mod) ->
Res = tickets(Mod, tickets, Config),
- io:format("~w:tickets(Mod = ~w) -> Res: ~p~n", [?MODULE, Mod, Res]),
+ %% io:format("~w:tickets(Mod = ~w) -> Res: ~p~n", [?MODULE, Mod, Res]),
Res;
tickets(Bad, _Config) ->
[{badarg, Bad, ok}].
tickets(Mod, Func, Config) ->
- io:format("~w:tickets -> entry with"
- "~n Mod: ~p"
- "~n Func: ~p"
- "~n Config: ~p"
- "~n", [?MODULE, Mod, Func, Config]),
+ %% io:format("~w:tickets -> entry with"
+ %% "~n Mod: ~p"
+ %% "~n Func: ~p"
+ %% "~n Config: ~p"
+ %% "~n", [?MODULE, Mod, Func, Config]),
case (catch Mod:Func(suite)) of
[] ->
io:format("Eval: ~p:", [{Mod, Func}]),
Res = eval(Mod, Func, Config),
- io:format("~w:tickets -> evaluated"
- "~n Res: ~p"
- "~n", [?MODULE, Res]),
+ %% io:format("~w:tickets -> evaluated"
+ %% "~n Res: ~p"
+ %% "~n", [?MODULE, Res]),
{R, _, _, _} = Res,
io:format(" ~p~n", [R]),
Res;
@@ -156,37 +156,37 @@ tickets(Mod, Func, Config) ->
lists:map(Map, Cases);
{req, _, {conf, Init, Cases, Finish}} ->
- io:format("~w:tickets -> suite result req-conf: "
- "~n Init: ~p"
- "~n Cases: ~p"
- "~n Finish: ~p"
- "~n", [?MODULE, Init, Cases, Finish]),
+ %% io:format("~w:tickets -> suite result req-conf: "
+ %% "~n Init: ~p"
+ %% "~n Cases: ~p"
+ %% "~n Finish: ~p"
+ %% "~n", [?MODULE, Init, Cases, Finish]),
case (catch Mod:Init(Config)) of
Conf when is_list(Conf) ->
io:format("Expand: ~p:~p ...~n", [Mod, Func]),
Map = fun({M,_}) when is_atom(M) ->
- io:format("~w:tickets -> "
- "~n M: ~p"
- "~n", [?MODULE, M]),
+ %% io:format("~w:tickets -> "
+ %% "~n M: ~p"
+ %% "~n", [?MODULE, M]),
tickets(M, tickets, Conf);
(F) when is_atom(F) ->
- io:format("~w:tickets -> "
- "~n F: ~p"
- "~n", [?MODULE, F]),
+ %% io:format("~w:tickets -> "
+ %% "~n F: ~p"
+ %% "~n", [?MODULE, F]),
tickets(Mod, F, Conf);
(Case) ->
- io:format("~w:tickets -> "
- "~n Case: ~p"
- "~n", [?MODULE, Case]),
+ %% io:format("~w:tickets -> "
+ %% "~n Case: ~p"
+ %% "~n", [?MODULE, Case]),
Case
end,
Res = lists:map(Map, Cases),
- io:format("~w:tickets -> and now finish when: "
- "~n Res: ~p"
- "~n", [?MODULE, Res]),
+ %% io:format("~w:tickets -> and now finish when: "
+ %% "~n Res: ~p"
+ %% "~n", [?MODULE, Res]),
(catch Mod:Finish(Conf)),
- io:format("~w:tickets -> finished"
- "~n", [?MODULE]),
+ %% io:format("~w:tickets -> finished"
+ %% "~n", [?MODULE]),
Res;
{'EXIT', {skipped, Reason}} ->