aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2012-08-23 18:29:45 +0200
committerPeter Andersson <[email protected]>2012-08-23 18:29:45 +0200
commita94308cb1e1aa727a126e99b5a8714490dd3de16 (patch)
tree2452c3b837c23ab62cb16e363d56cfa095005a7e
parent38456cd45c8677a567e32722dee0d9602a306037 (diff)
parente2d5adbd9167ec51edaece5bf672c76e4898ca05 (diff)
downloadotp-a94308cb1e1aa727a126e99b5a8714490dd3de16.tar.gz
otp-a94308cb1e1aa727a126e99b5a8714490dd3de16.tar.bz2
otp-a94308cb1e1aa727a126e99b5a8714490dd3de16.zip
Merge remote branch 'origin/peppe/common_test/parallel_testcases_error' into maint
* origin/peppe/common_test/parallel_testcases_error: Solve problems with verbosity levels and parallel test cases
-rw-r--r--lib/common_test/src/ct_framework.erl31
-rw-r--r--lib/common_test/src/ct_testspec.erl9
-rw-r--r--lib/common_test/test/ct_error_SUITE.erl6
-rw-r--r--lib/test_server/src/test_server.erl14
4 files changed, 41 insertions, 19 deletions
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,
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl
index 0dc3ce48ab..17c5f5b253 100644
--- a/lib/test_server/src/test_server.erl
+++ b/lib/test_server/src/test_server.erl
@@ -1131,7 +1131,8 @@ call_end_conf(Mod,Func,TCPid,TCExitReason,Loc,Conf,TVal) ->
{'EXIT',Why} ->
timer:sleep(1),
group_leader() ! {printout,12,
- "WARNING! ~p:end_per_testcase(~p, ~p)"
+ "WARNING! "
+ "~p:end_per_testcase(~p, ~p)"
" crashed!\n\tReason: ~p\n",
[Mod,Func,Conf,Why]};
_ ->
@@ -1247,13 +1248,18 @@ spawn_fw_call(FwMod,FwFunc,_,_Pid,{framework_error,FwError},_,SendTo) ->
end,
spawn_link(FwCall);
-spawn_fw_call(Mod,Func,_,Pid,Error,Loc,SendTo) ->
+spawn_fw_call(Mod,Func,CurrConf,Pid,Error,Loc,SendTo) ->
+ {Mod1,Func1} =
+ case {Mod,Func,CurrConf} of
+ {undefined,undefined,{{M,F},_}} -> {M,F};
+ _ -> {Mod,Func}
+ end,
FwCall =
fun() ->
%% set group leader so that printouts/comments
%% from the framework get printed in the logs
group_leader(SendTo, self()),
- case catch fw_error_notify(Mod,Func,[],
+ case catch fw_error_notify(Mod1,Func1,[],
Error,Loc) of
{'EXIT',FwErrorNotifyErr} ->
exit({fw_notify_done,error_notification,
@@ -1262,7 +1268,7 @@ spawn_fw_call(Mod,Func,_,Pid,Error,Loc,SendTo) ->
ok
end,
Conf = [{tc_status,{failed,timetrap_timeout}}],
- case catch do_end_tc_call(Mod,Func, Loc,
+ case catch do_end_tc_call(Mod1,Func1, Loc,
{Pid,Error,[Conf]},Error) of
{'EXIT',FwEndTCErr} ->
exit({fw_notify_done,end_tc,FwEndTCErr});