aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2013-04-17 15:37:22 +0200
committerMicael Karlberg <[email protected]>2013-04-17 15:37:22 +0200
commit317c83c20b1593353055ef894e1bff7a4b201638 (patch)
treeeaf3dedd1c63c16dc1a4c31a64cc446fbf78a3cb
parent1dcfcb31c8d5f0f23e0b836ea0aa85277c71ee17 (diff)
downloadotp-317c83c20b1593353055ef894e1bff7a4b201638.tar.gz
otp-317c83c20b1593353055ef894e1bff7a4b201638.tar.bz2
otp-317c83c20b1593353055ef894e1bff7a4b201638.zip
[megaco] Internal test server not handling failing cases
-rw-r--r--lib/megaco/test/megaco_test_lib.erl45
1 files changed, 41 insertions, 4 deletions
diff --git a/lib/megaco/test/megaco_test_lib.erl b/lib/megaco/test/megaco_test_lib.erl
index 2a62d91a5b..b8cf7d2022 100644
--- a/lib/megaco/test/megaco_test_lib.erl
+++ b/lib/megaco/test/megaco_test_lib.erl
@@ -247,9 +247,16 @@ end_group(Mod, Group, Config) ->
%% This is for sub-SUITEs
t({_Mod, {NewMod, all}, _Groups}, _Config) when is_atom(NewMod) ->
+ p("t(all) -> entry with"
+ "~n NewMod: ~p", [NewMod]),
t(NewMod);
t({Mod, {group, Name} = Group, Groups}, Config)
when is_atom(Mod) andalso is_atom(Name) andalso is_list(Groups) ->
+ p("t(group) -> entry with"
+ "~n Mod: ~p"
+ "~n Name: ~p"
+ "~n Groups: ~p"
+ "~n Config: ~p", [Mod, Name, Groups, Config]),
case lists:keysearch(Name, 1, Groups) of
{value, {Name, _Props, GroupsAndCases}} ->
try init_group(Mod, Name, Config) of
@@ -277,6 +284,10 @@ t({Mod, {group, Name} = Group, Groups}, Config)
end;
t({Mod, Fun, _}, Config)
when is_atom(Mod) andalso is_atom(Fun) ->
+ p("t -> entry with"
+ "~n Mod: ~p"
+ "~n Fun: ~p"
+ "~n Config: ~p", [Mod, Fun, Config]),
try apply(Mod, Fun, [suite]) of
[] ->
io:format("Eval: ~p:", [{Mod, Fun}]),
@@ -304,9 +315,9 @@ t({Mod, Fun, _}, Config)
end;
t(Mod, Config) when is_atom(Mod) ->
- %% p("t -> entry with"
- %% "~n Mod: ~p"
- %% "~n Config: ~p", [Mod, Config]),
+ p("t -> entry with"
+ "~n Mod: ~p"
+ "~n Config: ~p", [Mod, Config]),
%% This is assumed to be a test suite, so we start by calling
%% the top test suite function(s) (all/0 and groups/0).
try Mod:all() of
@@ -368,6 +379,14 @@ eval(Mod, Fun, Config) ->
wait_for_evaluator(Pid, Mod, Fun, Config, Errors) ->
wait_for_evaluator(Pid, Mod, Fun, Config, Errors, 0).
wait_for_evaluator(Pid, Mod, Fun, Config, Errors, AccTime) ->
+ %% p("wait_for_evaluator -> "
+ %% "~n Pid: ~p"
+ %% "~n Mod: ~p"
+ %% "~n Fun: ~p"
+ %% "~n Config: ~p"
+ %% "~n Errors: ~p"
+ %% "~n AccTime: ~p",
+ %% [Pid, Mod, Fun, Config, Errors, AccTime]),
TestCase = {?MODULE, Mod, Fun},
Label = lists:concat(["TEST CASE: ", Fun]),
receive
@@ -405,10 +424,17 @@ wait_for_evaluator(Pid, Mod, Fun, Config, Errors, AccTime) ->
end.
do_eval(ReplyTo, Mod, Fun, Config) ->
+ %% p("do_eval -> "
+ %% "~n ReplyTo: ~p"
+ %% "~n Mod: ~p"
+ %% "~n Fun: ~p"
+ %% "~n Config: ~p", [ReplyTo, Mod, Fun, Config]),
display_system_info("before", Mod, Fun),
T1 = os:timestamp(),
try Mod:Fun(Config) of
Res ->
+ p("do_eval -> done"
+ "~n Res: ~p", [Res]),
T2 = os:timestamp(),
Time = timer:now_diff(T2, T1),
display_tc_time(Time),
@@ -416,13 +442,24 @@ do_eval(ReplyTo, Mod, Fun, Config) ->
ReplyTo ! {done, self(), Res, Time}
catch
error:undef ->
+ %% p("do_eval -> error - undef", []),
ReplyTo ! {'EXIT', self(), undef, 0};
exit:{skipped, Reason} ->
+ %% p("do_eval -> exit - skipped"
+ %% "~n Reason: ~p", [Reason]),
T2 = os:timestamp(),
Time = timer:now_diff(T2, T1),
display_tc_time(Time),
display_system_info("after (skipped)", Mod, Fun),
- ReplyTo ! {'EXIT', self(), {skipped, Reason}, Time}
+ ReplyTo ! {'EXIT', self(), {skipped, Reason}, Time};
+ exit:{suite_failed, Reason} ->
+ %% p("do_eval -> exit - suite-failed"
+ %% "~n Reason: ~p", [Reason]),
+ T2 = os:timestamp(),
+ Time = timer:now_diff(T2, T1),
+ display_tc_time(Time),
+ display_system_info("after (failed)", Mod, Fun),
+ ReplyTo ! {done, self(), Reason, Time}
end,
unlink(ReplyTo),