aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2011-04-18 21:47:47 +0200
committerPeter Andersson <[email protected]>2011-04-28 22:43:54 +0200
commit17808ea01d04f25574aa627f2716704a09e59354 (patch)
treee813e8dcd08359e324f6c0207c467be876f563c3
parentb4c851d574b6e9ebd29ffd41b7ebd76b0912b7cf (diff)
downloadotp-17808ea01d04f25574aa627f2716704a09e59354.tar.gz
otp-17808ea01d04f25574aa627f2716704a09e59354.tar.bz2
otp-17808ea01d04f25574aa627f2716704a09e59354.zip
Fix issues related to test case groups:
1. Allow empty group to be specified without generating an error. 2. Sort out potential problem with unnecessary call to delete_subs/2.
-rw-r--r--lib/common_test/src/ct_framework.erl20
-rw-r--r--lib/common_test/test/ct_groups_test_2_SUITE.erl24
-rw-r--r--lib/common_test/test/ct_groups_test_2_SUITE_data/groups_2/groups_22_SUITE.erl25
3 files changed, 43 insertions, 26 deletions
diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl
index af71d1f69b..2572bf1dde 100644
--- a/lib/common_test/src/ct_framework.erl
+++ b/lib/common_test/src/ct_framework.erl
@@ -737,7 +737,7 @@ get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) ->
%% (and only) test case so we can report Error properly
[{?MODULE,error_in_suite,[[Error]]}];
[] ->
- {error,{invalid_group_spec,Name}};
+ [];
ConfTests ->
case lists:member(skipped, Props) of
true ->
@@ -767,23 +767,7 @@ get_suite(Mod, Name) ->
find_groups(Mod, Name, TCs, GroupDefs) ->
Found = find(Mod, Name, TCs, GroupDefs, [], GroupDefs, false),
- Trimmed = trim(Found),
- %% I cannot find a reason to why this function is called,
- %% It deletes any group which is referenced in any other
- %% group. i.e.
- %% groups() ->
- %% [{test, [], [testcase1]},
- %% {testcases, [], [{group, test}]}].
- %% Would be changed to
- %% groups() ->
- %% [{testcases, [], [testcase1]}].
- %% instead of what I believe is correct:
- %% groups() ->
- %% [{test, [], [testcase1]},
- %% {testcases, [], [testcase1]}].
- %% Have to double check with peppe
- delete_subs(Trimmed, Trimmed),
- Trimmed.
+ trim(Found).
find(Mod, all, _TCs, [{Name,Props,Tests} | Gs], Known, Defs, _)
when is_atom(Name), is_list(Props), is_list(Tests) ->
diff --git a/lib/common_test/test/ct_groups_test_2_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE.erl
index 43a2b86602..ee901bf608 100644
--- a/lib/common_test/test/ct_groups_test_2_SUITE.erl
+++ b/lib/common_test/test/ct_groups_test_2_SUITE.erl
@@ -124,7 +124,7 @@ empty_group(Config) when is_list(Config) ->
Suite = filename:join(DataDir, "groups_2/groups_22_SUITE"),
{Opts,ERPid} = setup([{suite,Suite},
- {group,[test_group_8,test_group_9]}],
+ {group,[test_group_8,test_group_9,test_group_10]}],
Config),
ok = ct_test_support:run(Opts, Config),
Events = ct_test_support:get_events(ERPid, Config),
@@ -282,4 +282,24 @@ test_events(repeat_1) ->
];
test_events(empty_group) ->
- [].
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,start_info,{1,1,1}},
+ {?eh,tc_start,{groups_22_SUITE,init_per_suite}},
+ {?eh,tc_done,{groups_22_SUITE,init_per_suite,ok}},
+ [{?eh,tc_start,
+ {groups_22_SUITE,{init_per_group,test_group_8,[]}}},
+ {?eh,tc_done,
+ {groups_22_SUITE,{init_per_group,test_group_8,[]},ok}},
+ {?eh,tc_start,{groups_22_SUITE,testcase_8}},
+ {?eh,tc_done,{groups_22_SUITE,testcase_8,ok}},
+ {?eh,test_stats,{1,0,{0,0}}},
+ {?eh,tc_start,
+ {groups_22_SUITE,{end_per_group,test_group_8,[]}}},
+ {?eh,tc_done,
+ {groups_22_SUITE,{end_per_group,test_group_8,[]},ok}}],
+ {?eh,tc_start,{groups_22_SUITE,end_per_suite}},
+ {?eh,tc_done,{groups_22_SUITE,end_per_suite,init}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ].
diff --git a/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_2/groups_22_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_2/groups_22_SUITE.erl
index a41489e55c..14eb8769ad 100644
--- a/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_2/groups_22_SUITE.erl
+++ b/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_2/groups_22_SUITE.erl
@@ -52,8 +52,11 @@ groups() ->
{test_group_7, [sequence], [testcase_7a,testcase_7b]},
- {test_group_8, [], [{group,test_group_9}]},
- {test_group_9, [], []}
+ {test_group_8, [], [{group, test_group_9}, testcase_8]},
+
+ {test_group_9, [], []},
+
+ {test_group_10, [], [{group, test_group_9}]}
].
all() ->
@@ -65,7 +68,8 @@ all() ->
testcase_3,
{group, test_group_4},
{group, test_group_8},
- {group, test_group_9}].
+ {group, test_group_9},
+ {group, test_group_10}].
%% this func only for internal test purposes
grs_and_tcs() ->
@@ -74,7 +78,8 @@ grs_and_tcs() ->
test_group_2, test_group_3,
test_group_4, test_group_5,
test_group_6, test_group_7,
- test_group_8, test_group_9
+ test_group_8, test_group_9,
+ test_group_10
],
[
testcase_1a, testcase_1b, testcase_1c,
@@ -84,7 +89,8 @@ grs_and_tcs() ->
testcase_3a, testcase_3b,
testcase_3,
testcase_5a, testcase_5b,
- testcase_7a, testcase_7b
+ testcase_7a, testcase_7b,
+ testcase_8
]}.
%%--------------------------------------------------------------------
@@ -113,7 +119,10 @@ init_per_group(Group, Config) ->
{test_group_4,[{name,test_group_4}]} -> ok;
{test_group_5,[{name,test_group_5},parallel]} -> "parallel";
{test_group_6,[{name,test_group_6},parallel]} -> "parallel";
- {test_group_7,[{name,test_group_7},sequence]} -> "sequence"
+ {test_group_7,[{name,test_group_7},sequence]} -> "sequence";
+ {test_group_8,[{name,test_group_8}]} -> ok;
+ {test_group_9,[{name,test_group_9}]} -> ok;
+ {test_group_10,[{name,test_group_10}]} -> ok
end,
{Grs,_} = grs_and_tcs(),
case lists:member(Group, Grs) of
@@ -318,3 +327,7 @@ testcase_7b(Config) ->
undefined = ?config(testcase_7a,Config),
testcase_7b = ?config(testcase_7b,Config),
ok.
+testcase_8() ->
+ [].
+testcase_8(_Config) ->
+ ok.