aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_framework.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2014-03-12 17:18:40 +0100
committerPeter Andersson <[email protected]>2014-03-12 17:19:27 +0100
commit2aca59eb432c8907ac9d316da251a513fcc33901 (patch)
tree09df30769c781d415ab12f0fa8c75163fb70ed5b /lib/common_test/src/ct_framework.erl
parentf406a1661f8b0106b1b203057aedbb60d8d3a6be (diff)
parent0b2bc007ec8b2f393ae4888be2efe3c4f9f2b94c (diff)
downloadotp-2aca59eb432c8907ac9d316da251a513fcc33901.tar.gz
otp-2aca59eb432c8907ac9d316da251a513fcc33901.tar.bz2
otp-2aca59eb432c8907ac9d316da251a513fcc33901.zip
Merge branch 'peppe/common_test/group_events'
* peppe/common_test/group_events: Update test suites and fix various remaining problems Update event protocol and CT Hooks API Introduce group name for skipped cases in events, hooks and overview log OTP-11732
Diffstat (limited to 'lib/common_test/src/ct_framework.erl')
-rw-r--r--lib/common_test/src/ct_framework.erl50
1 files changed, 26 insertions, 24 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index 580588fbd2..63bfea68c4 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -1277,28 +1277,35 @@ report(What,Data) ->
ct_util:set_testdata({What,Data}),
ok;
tc_start ->
- %% Data = {{Suite,Func},LogFileName}
+ %% Data = {Suite,{Func,GroupName}},LogFileName}
+ Data1 = case Data of
+ {{Suite,{Func,undefined}},LFN} -> {{Suite,Func},LFN};
+ _ -> Data
+ end,
ct_event:sync_notify(#event{name=tc_logfile,
node=node(),
- data=Data}),
+ data=Data1}),
ok;
tc_done ->
- {_Suite,Case,Result} = Data,
+ {Suite,{Func,GrName},Result} = Data,
+ Data1 = if GrName == undefined -> {Suite,Func,Result};
+ true -> Data
+ end,
case Result of
{failed, _} ->
- ct_hooks:on_tc_fail(What, Data);
+ ct_hooks:on_tc_fail(What, Data1);
{skipped,{failed,{_,init_per_testcase,_}}} ->
- ct_hooks:on_tc_skip(tc_auto_skip, Data);
+ ct_hooks:on_tc_skip(tc_auto_skip, Data1);
{skipped,{require_failed,_}} ->
- ct_hooks:on_tc_skip(tc_auto_skip, Data);
+ ct_hooks:on_tc_skip(tc_auto_skip, Data1);
{skipped,_} ->
- ct_hooks:on_tc_skip(tc_user_skip, Data);
+ ct_hooks:on_tc_skip(tc_user_skip, Data1);
{auto_skipped,_} ->
- ct_hooks:on_tc_skip(tc_auto_skip, Data);
+ ct_hooks:on_tc_skip(tc_auto_skip, Data1);
_Else ->
ok
end,
- case {Case,Result} of
+ case {Func,Result} of
{init_per_suite,_} ->
ok;
{end_per_suite,_} ->
@@ -1327,20 +1334,17 @@ report(What,Data) ->
tc_user_skip ->
%% test case or config function specified as skipped in testspec,
%% or init config func for suite/group has returned {skip,Reason}
- %% Data = {Suite,Case,Comment} |
- %% {Suite,{GroupConfigFunc,GroupName},Comment}
+ %% Data = {Suite,{Func,GroupName},Comment}
{Func,Data1} = case Data of
- {Suite,{ConfigFunc,undefined},Cmt} ->
- {ConfigFunc,{Suite,ConfigFunc,Cmt}};
- {_,{ConfigFunc,_},_} -> {ConfigFunc,Data};
- {_,Case,_} -> {Case,Data}
+ {Suite,{F,undefined},Comment} ->
+ {F,{Suite,F,Comment}};
+ D = {_,{F,_},_} ->
+ {F,D}
end,
-
ct_event:sync_notify(#event{name=tc_user_skip,
node=node(),
data=Data1}),
ct_hooks:on_tc_skip(What, Data1),
-
if Func /= init_per_suite, Func /= init_per_group,
Func /= end_per_suite, Func /= end_per_group ->
add_to_stats(user_skipped);
@@ -1350,13 +1354,12 @@ report(What,Data) ->
tc_auto_skip ->
%% test case skipped because of error in config function, or
%% config function skipped because of error in info function
- %% Data = {Suite,Case,Comment} |
- %% {Suite,{GroupConfigFunc,GroupName},Comment}
+ %% Data = {Suite,{Func,GroupName},Comment}
{Func,Data1} = case Data of
- {Suite,{ConfigFunc,undefined},Cmt} ->
- {ConfigFunc,{Suite,ConfigFunc,Cmt}};
- {_,{ConfigFunc,_},_} -> {ConfigFunc,Data};
- {_,Case,_} -> {Case,Data}
+ {Suite,{F,undefined},Comment} ->
+ {F,{Suite,F,Comment}};
+ D = {_,{F,_},_} ->
+ {F,D}
end,
%% this test case does not have a log, so printouts
%% from event handlers should end up in the main log
@@ -1364,7 +1367,6 @@ report(What,Data) ->
node=node(),
data=Data1}),
ct_hooks:on_tc_skip(What, Data1),
-
if Func /= end_per_suite,
Func /= end_per_group ->
add_to_stats(auto_skipped);