From e2d5adbd9167ec51edaece5bf672c76e4898ca05 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Thu, 23 Aug 2012 17:41:36 +0200 Subject: Solve problems with verbosity levels and parallel test cases --- lib/common_test/src/ct_framework.erl | 31 ++++++++++++++++++++----------- lib/common_test/src/ct_testspec.erl | 9 ++++++++- lib/common_test/test/ct_error_SUITE.erl | 6 +++--- 3 files changed, 31 insertions(+), 15 deletions(-) (limited to 'lib/common_test') diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index d698ebb5dc..e8d5d4708b 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -75,8 +75,11 @@ init_tc(Mod,Func,Config) -> case CurrTC of undefined -> ct_util:set_testdata({curr_tc,[{Suite,Func}]}); - Running when is_list(Running) -> - ct_util:set_testdata({curr_tc,[{Suite,Func}|Running]}) + _ when is_list(CurrTC) -> + ct_util:update_testdata(curr_tc, + fun(Running) -> + [{Suite,Func}|Running] + end) end, case ct_util:read_suite_data({seq,Suite,Func}) of undefined -> @@ -84,11 +87,13 @@ init_tc(Mod,Func,Config) -> Seq when is_atom(Seq) -> case ct_util:read_suite_data({seq,Suite,Seq}) of [Func|TCs] -> % this is the 1st case in Seq - %% make sure no cases in this seq are marked as failed - %% from an earlier execution in the same suite + %% make sure no cases in this seq are + %% marked as failed from an earlier execution + %% in the same suite lists:foreach( fun(TC) -> - ct_util:save_suite_data({seq,Suite,TC},Seq) + ct_util:save_suite_data({seq,Suite,TC}, + Seq) end, TCs); _ -> ok @@ -665,12 +670,16 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) -> %% reset the curr_tc state, or delete this TC from the list of %% executing cases (if in a parallel group) - case ct_util:get_testdata(curr_tc) of - Running = [_,_|_] -> - ct_util:set_testdata({curr_tc,lists:delete({Mod,Func}, Running)}); - [_] -> - ct_util:set_testdata({curr_tc,undefined}) - end, + ClearCurrTC = fun(Running = [_,_|_]) -> + lists:delete({Mod,Func},Running); + ({_,{suite0_failed,_}}) -> + undefined; + ([{_,CurrTC}]) when CurrTC == Func -> + undefined; + (undefined) -> + undefined + end, + ct_util:update_testdata(curr_tc,ClearCurrTC), case FinalResult of {skip,{sequence_failed,_,_}} -> diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index d66caef100..7759aca16b 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -934,6 +934,12 @@ handle_data(ct_hooks,Node,Hook,_Spec) -> [{Node,Hook}]; handle_data(stylesheet,Node,CSSFile,Spec) -> [{Node,get_absfile(CSSFile,Spec)}]; +handle_data(verbosity,Node,VLvls,_Spec) when is_integer(VLvls) -> + [{Node,[{'$unspecified',VLvls}]}]; +handle_data(verbosity,Node,VLvls,_Spec) when is_list(VLvls) -> + VLvls1 = lists:map(fun(VLvl = {_Cat,_Lvl}) -> VLvl; + (Lvl) -> {'$unspecified',Lvl} end, VLvls), + [{Node,VLvls1}]; handle_data(_Tag,Node,Data,_Spec) -> [{Node,Data}]. @@ -943,7 +949,8 @@ should_be_added(Tag,Node,_Data,Spec) -> %% list terms *without* possible duplicates here Tag == logdir; Tag == logopts; Tag == basic_html; Tag == label; - Tag == auto_compile; Tag == stylesheet -> + Tag == auto_compile; Tag == stylesheet; + Tag == verbosity -> lists:keymember(ref2node(Node,Spec#testspec.nodes),1, read_field(Spec,Tag)) == false; %% for terms *with* possible duplicates diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl index c9ee47e01b..338e76264e 100644 --- a/lib/common_test/test/ct_error_SUITE.erl +++ b/lib/common_test/test/ct_error_SUITE.erl @@ -878,11 +878,11 @@ test_events(timetrap_fun) -> {failed,{timetrap_timeout,{'$approx',1000}}}}}, {?eh,test_stats,{0,5,{0,0}}}, {?eh,tc_start,{timetrap_5_SUITE,tc1}}, - {?eh,tc_done,{undefined,undefined,{user_timetrap_error, + {?eh,tc_done,{timetrap_5_SUITE,tc1,{user_timetrap_error, {kaboom,'_'}}}}, {?eh,test_stats,{0,6,{0,0}}}, {?eh,tc_start,{timetrap_5_SUITE,tc2}}, - {?eh,tc_done,{undefined,undefined,{user_timetrap_error, + {?eh,tc_done,{timetrap_5_SUITE,tc2,{user_timetrap_error, {kaboom,'_'}}}}, {?eh,test_stats,{0,7,{0,0}}}, {?eh,tc_start,{timetrap_5_SUITE,tc3}}, @@ -937,7 +937,7 @@ test_events(timetrap_fun) -> {?eh,tc_done,{timetrap_5_SUITE,end_per_suite,ok}}, {?eh,tc_start,{timetrap_6_SUITE,init_per_suite}}, - {?eh,tc_done,{undefined,undefined,{user_timetrap_error, + {?eh,tc_done,{timetrap_6_SUITE,init_per_suite,{user_timetrap_error, {kaboom,'_'}}}}, {?eh,tc_auto_skip,{timetrap_6_SUITE,tc0, {failed,{timetrap_6_SUITE,init_per_suite, -- cgit v1.2.3