diff options
Diffstat (limited to 'lib')
26 files changed, 3796 insertions, 192 deletions
diff --git a/lib/common_test/src/ct.erl b/lib/common_test/src/ct.erl index d72b8bc0e1..6fd7693185 100644 --- a/lib/common_test/src/ct.erl +++ b/lib/common_test/src/ct.erl @@ -65,7 +65,7 @@ pal/1, pal/2, pal/3, fail/1, fail/2, comment/1, comment/2, testcases/2, userdata/2, userdata/3, - timetrap/1, sleep/1]). + timetrap/1, get_timetrap_info/0, sleep/1]). %% New API for manipulating with config handlers -export([add_config/2, remove_config/2]). @@ -703,7 +703,8 @@ userdata(TestDir, Suite) -> get_userdata(Info, "suite/0") end. -get_userdata({'EXIT',{undef,_}}, Spec) -> +get_userdata({'EXIT',{Undef,_}}, Spec) when Undef == undef; + Undef == function_clause -> {error,list_to_atom(Spec ++ " is not defined")}; get_userdata({'EXIT',Reason}, Spec) -> {error,{list_to_atom("error in " ++ Spec),Reason}}; @@ -719,16 +720,27 @@ get_userdata(_BadTerm, Spec) -> {error,list_to_atom(Spec ++ " must return a list")}. %%%----------------------------------------------------------------- -%%% @spec userdata(TestDir, Suite, Case) -> TCUserData | {error,Reason} +%%% @spec userdata(TestDir, Suite, GroupOrCase) -> TCUserData | {error,Reason} %%% TestDir = string() %%% Suite = atom() -%%% Case = atom() +%%% GroupOrCase = {group,GroupName} | atom() +%%% GroupName = atom() %%% TCUserData = [term()] %%% Reason = term() %%% %%% @doc Returns any data specified with the tag <code>userdata</code> -%%% in the list of tuples returned from <code>Suite:Case/0</code>. -userdata(TestDir, Suite, Case) -> +%%% in the list of tuples returned from <code>Suite:group(GroupName)</code> +%%% or <code>Suite:Case()</code>. +userdata(TestDir, Suite, {group,GroupName}) -> + case make_and_load(TestDir, Suite) of + E = {error,_} -> + E; + _ -> + Info = (catch apply(Suite, group, [GroupName])), + get_userdata(Info, "group("++atom_to_list(GroupName)++")") + end; + +userdata(TestDir, Suite, Case) when is_atom(Case) -> case make_and_load(TestDir, Suite) of E = {error,_} -> E; @@ -906,6 +918,18 @@ timetrap(Time) -> test_server:timetrap(Time). %%%----------------------------------------------------------------- +%%% @spec get_timetrap_info() -> {Time,Scale} +%%% Time = integer() | infinity +%%% Scale = true | false +%%% +%%% @doc <p>Read info about the timetrap set for the current test case. +%%% <c>Scale</c> indicates if Common Test will attempt to automatically +%%% compensate timetraps for runtime delays introduced by e.g. tools like +%%% cover.</p> +get_timetrap_info() -> + test_server:get_timetrap_info(). + +%%%----------------------------------------------------------------- %%% @spec sleep(Time) -> ok %%% Time = {hours,Hours} | {minutes,Mins} | {seconds,Secs} | Millisecs | infinity %%% Hours = integer() diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index ee0162c5e3..c24a7c238b 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -36,6 +36,10 @@ -include("ct_event.hrl"). -include("ct_util.hrl"). +-define(val(Key, List), proplists:get_value(Key, List)). +-define(val(Key, List, Def), proplists:get_value(Key, List, Def)). +-define(rev(L), lists:reverse(L)). + %%%----------------------------------------------------------------- %%% @spec init_tc(Mod,Func,Args) -> {ok,NewArgs} | {error,Reason} | %%% {skip,Reason} | {auto_skip,Reason} @@ -48,6 +52,8 @@ %%% @doc Test server framework callback, called by the test_server %%% when a new test case is started. init_tc(Mod,Func,Config) -> + %% in case Mod == ct_framework, lookup the suite name + Suite = get_suite_name(Mod, Config), %% check if previous testcase was interpreted and has left %% a "dead" trace window behind - if so, kill it case ct_util:get_testdata(interpret) of @@ -57,34 +63,36 @@ init_tc(Mod,Func,Config) -> _ -> ok end, - %% check if we need to add defaults explicitly because %% there's no init_per_suite exported from Mod {InitFailed,DoInit} = case ct_util:get_testdata(curr_tc) of - {Mod,{suite0_failed,_}=Failure} -> + {Suite,{suite0_failed,_}=Failure} -> {Failure,false}; - {Mod,_} -> + {?MODULE,_} -> % should not really happen {false,false}; - _ when Func == init_per_suite -> + {Suite,_} -> % Func is not 1st case in suite {false,false}; - _ -> + _ when Func == init_per_suite -> % defaults will be added anyway + {false,false}; + _ -> % first case in suite {false,true} end, case InitFailed of false -> - ct_util:set_testdata({curr_tc,{Mod,Func}}), - case ct_util:read_suite_data({seq,Mod,Func}) of + ct_util:set_testdata({curr_tc,{Suite,Func}}), + case ct_util:read_suite_data({seq,Suite,Func}) of undefined -> init_tc1(Mod,Func,Config,DoInit); Seq when is_atom(Seq) -> - case ct_util:read_suite_data({seq,Mod,Seq}) of + 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 - lists:foreach(fun(TC) -> - ct_util:save_suite_data({seq,Mod,TC},Seq) - end, TCs); + lists:foreach( + fun(TC) -> + ct_util:save_suite_data({seq,Suite,TC},Seq) + end, TCs); _ -> ok end, @@ -98,6 +106,17 @@ init_tc(Mod,Func,Config) -> {skip,InitFailed} end. +init_tc1(?MODULE,error_in_suite,[Config0],_) when is_list(Config0) -> + ct_logs:init_tc(false), + ct_event:notify(#event{name=tc_start, + node=node(), + data={?MODULE,error_in_suite}}), + case ?val(error, Config0) of + undefined -> + {skip,"unknown_error_in_suite"}; + Reason -> + {skip,Reason} + end; init_tc1(Mod,Func,[Config0],DoInit) when is_list(Config0) -> Config1 = case ct_util:read_suite_data(last_saved_config) of @@ -122,35 +141,40 @@ init_tc1(Mod,Func,[Config0],DoInit) when is_list(Config0) -> %% release all name -> key bindings (once per suite) ct_config:release_allocated() end, - TestCaseInfo = - case catch apply(Mod,Func,[]) of - Result when is_list(Result) -> Result; - _ -> [] - end, + + GroupPath = ?val(tc_group_path, Config, []), + AllGroups = [?val(tc_group_properties, Config, []) | GroupPath], + %% clear all config data default values set by previous %% testcase info function (these should only survive the %% testcase, not the whole suite) - ct_config:delete_default_config(testcase), - case add_defaults(Mod,Func,TestCaseInfo,DoInit) of + FuncSpec = group_or_func(Func,Config0), + if is_tuple(FuncSpec) -> % group + ok; + true -> + ct_config:delete_default_config(testcase) + end, + %% in case Mod == ct_framework, lookup the suite name + Suite = get_suite_name(Mod, Config), + case add_defaults(Mod,Func,AllGroups,DoInit) of Error = {suite0_failed,_} -> ct_logs:init_tc(false), - FuncSpec = group_or_func(Func,Config0), ct_event:notify(#event{name=tc_start, node=node(), data={Mod,FuncSpec}}), - ct_util:set_testdata({curr_tc,{Mod,Error}}), + ct_util:set_testdata({curr_tc,{Suite,Error}}), {error,Error}; {SuiteInfo,MergeResult} -> case MergeResult of {error,Reason} when DoInit == false -> ct_logs:init_tc(false), - FuncSpec = group_or_func(Func,Config0), ct_event:notify(#event{name=tc_start, node=node(), data={Mod,FuncSpec}}), {skip,Reason}; _ -> - init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) + init_tc2(Mod,Func,SuiteInfo,MergeResult, + Config,DoInit) end end; init_tc1(_Mod,_Func,Args,_DoInit) -> @@ -203,8 +227,9 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> ct_event:notify(#event{name=tc_start, node=node(), data={Mod,FuncSpec}}), - - case catch configure(MergedInfo1,MergedInfo1,SuiteInfo,{Func,DoInit},Config) of + + case catch configure(MergedInfo1,MergedInfo1,SuiteInfo, + {FuncSpec,DoInit},Config) of {suite0_failed,Reason} -> ct_util:set_testdata({curr_tc,{Mod,{suite0_failed,{require,Reason}}}}), {skip,{require_failed_in_suite0,Reason}}; @@ -212,7 +237,7 @@ init_tc2(Mod,Func,SuiteInfo,MergeResult,Config,DoInit) -> {auto_skip,{require_failed,Reason}}; {'EXIT',Reason} -> {auto_skip,Reason}; - {ok, FinalConfig} -> + {ok,FinalConfig} -> case MergeResult of {error,Reason} -> %% suite0 configure finished now, report that @@ -241,19 +266,20 @@ ct_suite_init(Mod, Func, [Config]) when is_list(Config) -> Else end. -add_defaults(Mod,Func,FuncInfo,DoInit) -> - case (catch Mod:suite()) of +add_defaults(Mod,Func, GroupPath, DoInit) -> + Suite = get_suite_name(Mod, GroupPath), + case (catch Suite:suite()) of {'EXIT',{undef,_}} -> - SuiteInfo = merge_with_suite_defaults(Mod,[]), + SuiteInfo = merge_with_suite_defaults(Suite,[]), SuiteInfoNoCTH = [I || I <- SuiteInfo, element(1,I) =/= ct_hooks], - case add_defaults1(Mod,Func,FuncInfo,SuiteInfoNoCTH,DoInit) of + case add_defaults1(Mod,Func, GroupPath, SuiteInfoNoCTH, DoInit) of Error = {error,_} -> {SuiteInfo,Error}; MergedInfo -> {SuiteInfo,MergedInfo} end; {'EXIT',Reason} -> ErrStr = io_lib:format("~n*** ERROR *** " "~w:suite/0 failed: ~p~n", - [Mod,Reason]), + [Suite,Reason]), io:format(ErrStr, []), io:format(user, ErrStr, []), {suite0_failed,{exited,Reason}}; @@ -262,18 +288,18 @@ add_defaults(Mod,Func,FuncInfo,DoInit) -> (_) -> false end, SuiteInfo) of true -> - SuiteInfo1 = merge_with_suite_defaults(Mod,SuiteInfo), + SuiteInfo1 = merge_with_suite_defaults(Suite, SuiteInfo), SuiteInfoNoCTH = [I || I <- SuiteInfo1, element(1,I) =/= ct_hooks], - case add_defaults1(Mod,Func,FuncInfo, - SuiteInfoNoCTH,DoInit) of + case add_defaults1(Mod,Func, GroupPath, + SuiteInfoNoCTH, DoInit) of Error = {error,_} -> {SuiteInfo1,Error}; MergedInfo -> {SuiteInfo1,MergedInfo} end; false -> ErrStr = io_lib:format("~n*** ERROR *** " "Invalid return value from " - "~w:suite/0: ~p~n", [Mod,SuiteInfo]), + "~w:suite/0: ~p~n", [Suite,SuiteInfo]), io:format(ErrStr, []), io:format(user, ErrStr, []), {suite0_failed,bad_return_value} @@ -281,57 +307,178 @@ add_defaults(Mod,Func,FuncInfo,DoInit) -> SuiteInfo -> ErrStr = io_lib:format("~n*** ERROR *** " "Invalid return value from " - "~w:suite/0: ~p~n", [Mod,SuiteInfo]), + "~w:suite/0: ~p~n", [Suite,SuiteInfo]), io:format(ErrStr, []), io:format(user, ErrStr, []), {suite0_failed,bad_return_value} end. -add_defaults1(_Mod,init_per_suite,[],SuiteInfo,_DoInit) -> - SuiteInfo; - -add_defaults1(Mod,Func,FuncInfo,SuiteInfo,DoInit) -> - %% mustn't re-require suite variables in test case info function, - %% can result in weird behaviour (suite values get overwritten) +add_defaults1(Mod,Func, GroupPath, SuiteInfo, DoInit) -> + Suite = get_suite_name(Mod, GroupPath), + %% GroupPathInfo (for subgroup on level X) = + %% [LevelXGroupInfo, LevelX-1GroupInfo, ..., TopLevelGroupInfo] + GroupPathInfo = + lists:map(fun(GroupProps) -> + Name = ?val(name, GroupProps), + case catch Suite:group(Name) of + GrInfo when is_list(GrInfo) -> GrInfo; + _ -> [] + end + end, GroupPath), + Args = if Func == init_per_group; Func == ct_init_per_group; + Func == end_per_group; Func == ct_end_per_group -> + [?val(name, hd(GroupPath))]; + true -> + [] + end, + TestCaseInfo = + case catch apply(Mod,Func,Args) of + TCInfo when is_list(TCInfo) -> TCInfo; + _ -> [] + end, + %% let test case info (also for all config funcs) override group info, + %% and lower level group info override higher level info + TCAndGroupInfo = [TestCaseInfo | remove_info_in_prev(TestCaseInfo, + GroupPathInfo)], + %% find and save require terms found in suite info SuiteReqs = [SDDef || SDDef <- SuiteInfo, ((require == element(1,SDDef)) or (default_config == element(1,SDDef)))], - FuncReqs = - [FIDef || FIDef <- FuncInfo, - require == element(1,FIDef)], - case [element(2,Clash) || Clash <- SuiteReqs, - require == element(1, Clash), - true == lists:keymember(element(2,Clash),2, - FuncReqs)] of + case check_for_clashes(TestCaseInfo, GroupPathInfo, SuiteReqs) of [] -> - add_defaults2(Mod,Func,FuncInfo,SuiteInfo,SuiteReqs,DoInit); + add_defaults2(Mod,Func, TCAndGroupInfo,SuiteInfo,SuiteReqs, DoInit); Clashes -> {error,{config_name_already_in_use,Clashes}} end. -add_defaults2(Mod,init_per_suite,IPSInfo,SuiteInfo,SuiteReqs,false) -> - %% not common practise to use a test case info function for - %% init_per_suite (usually handled by suite/0), but let's support - %% it just in case... - add_defaults2(Mod,init_per_suite,IPSInfo,SuiteInfo,SuiteReqs,true); - -add_defaults2(_Mod,_Func,FuncInfo,SuiteInfo,_,false) -> - %% include require elements from test case info, but not from suite/0 - %% (since we've already required those vars) - FuncInfo ++ - [SFDef || SFDef <- SuiteInfo, - require /= element(1,SFDef), - false == lists:keymember(element(1,SFDef),1,FuncInfo)]; - -add_defaults2(_Mod,_Func,FuncInfo,SuiteInfo,SuiteReqs,true) -> - %% We must include require elements from suite/0 here since - %% there's no init_per_suite call before this first test case. - %% Let other test case info elements override those from suite/0. - FuncInfo ++ SuiteReqs ++ - [SDDef || SDDef <- SuiteInfo, - require /= element(1,SDDef), - false == lists:keymember(element(1,SDDef),1,FuncInfo)]. +get_suite_name(?MODULE, [Cfg|_]) when is_list(Cfg), Cfg /= [] -> + get_suite_name(?MODULE, Cfg); + +get_suite_name(?MODULE, Cfg) when is_list(Cfg), Cfg /= [] -> + case ?val(tc_group_properties, Cfg) of + undefined -> + case ?val(suite, Cfg) of + undefined -> ?MODULE; + Suite -> Suite + end; + GrProps -> + case ?val(suite, GrProps) of + undefined -> ?MODULE; + Suite -> Suite + end + end; +get_suite_name(Mod, _) -> + Mod. + +%% Check that alias names are not already in use +check_for_clashes(TCInfo, GrPathInfo, SuiteInfo) -> + {CurrGrInfo,SearchIn} = case GrPathInfo of + [] -> {[],[SuiteInfo]}; + [Curr|Path] -> {Curr,[SuiteInfo|Path]} + end, + ReqNames = fun(Info) -> [element(2,R) || R <- Info, + size(R) == 3, + require == element(1,R)] + end, + ExistingNames = lists:flatten([ReqNames(L) || L <- SearchIn]), + CurrGrReqNs = ReqNames(CurrGrInfo), + GrClashes = [Name || Name <- CurrGrReqNs, + true == lists:member(Name, ExistingNames)], + AllReqNs = CurrGrReqNs ++ ExistingNames, + TCClashes = [Name || Name <- ReqNames(TCInfo), + true == lists:member(Name, AllReqNs)], + TCClashes ++ GrClashes. + +%% Delete the info terms in Terms from all following info lists +remove_info_in_prev(Terms, [[] | Rest]) -> + [[] | remove_info_in_prev(Terms, Rest)]; +remove_info_in_prev(Terms, [Info | Rest]) -> + UniqueInInfo = [U || U <- Info, + ((timetrap == element(1,U)) and + (not lists:keymember(timetrap,1,Terms))) or + ((require == element(1,U)) and + (not lists:member(U,Terms))) or + ((default_config == element(1,U)) and + (not keysmember([default_config,1, + element(2,U),2], Terms)))], + OtherTermsInInfo = [T || T <- Info, + timetrap /= element(1,T), + require /= element(1,T), + default_config /= element(1,T), + false == lists:keymember(element(1,T),1, + Terms)], + KeptInfo = UniqueInInfo ++ OtherTermsInInfo, + [KeptInfo | remove_info_in_prev(Terms ++ KeptInfo, Rest)]; +remove_info_in_prev(_, []) -> + []. + +keysmember([Key,Pos|Next], List) -> + case [Elem || Elem <- List, Key == element(Pos,Elem)] of + [] -> false; + Found -> keysmember(Next, Found) + end; +keysmember([], _) -> true. + + +add_defaults2(Mod,init_per_suite, IPSInfo, SuiteInfo,SuiteReqs, false) -> + add_defaults2(Mod,init_per_suite, IPSInfo, SuiteInfo,SuiteReqs, true); + +add_defaults2(_Mod,IPG, IPGAndGroupInfo, SuiteInfo,SuiteReqs, DoInit) when + IPG == init_per_group ; IPG == ct_init_per_group -> + %% If DoInit == true, we have to process the suite() list, otherwise + %% it has already been handled (see clause for init_per_suite) + case DoInit of + true -> + %% note: we know for sure this is a top level group + Info = lists:flatten([IPGAndGroupInfo, SuiteReqs]), + Info ++ remove_info_in_prev(Info, [SuiteInfo]); + false -> + SuiteInfo1 = + remove_info_in_prev(lists:flatten([IPGAndGroupInfo, + SuiteReqs]), [SuiteInfo]), + %% don't require terms in prev groups (already processed) + case IPGAndGroupInfo of + [IPGInfo] -> + lists:flatten([IPGInfo,SuiteInfo1]); + [IPGInfo | [CurrGroupInfo | PrevGroupInfo]] -> + PrevGroupInfo1 = delete_require_terms(PrevGroupInfo), + lists:flatten([IPGInfo,CurrGroupInfo,PrevGroupInfo1, + SuiteInfo1]) + end + end; + +add_defaults2(_Mod,_Func, TCAndGroupInfo, SuiteInfo,SuiteReqs, false) -> + %% Include require elements from test case info and current group, + %% but not from previous groups or suite/0 (since we've already required + %% those vars). Let test case info elements override group and suite + %% info elements. + SuiteInfo1 = remove_info_in_prev(lists:flatten([TCAndGroupInfo, + SuiteReqs]), [SuiteInfo]), + %% don't require terms in prev groups (already processed) + case TCAndGroupInfo of + [TCInfo] -> + lists:flatten([TCInfo,SuiteInfo1]); + [TCInfo | [CurrGroupInfo | PrevGroupInfo]] -> + PrevGroupInfo1 = delete_require_terms(PrevGroupInfo), + lists:flatten([TCInfo,CurrGroupInfo,PrevGroupInfo1, + SuiteInfo1]) + end; + +add_defaults2(_Mod,_Func, TCInfo, SuiteInfo,SuiteReqs, true) -> + %% Here we have to process the suite info list also (no call to + %% init_per_suite before this first test case). This TC can't belong + %% to a group, or the clause for (ct_)init_per_group would've caught this. + Info = lists:flatten([TCInfo, SuiteReqs]), + lists:flatten([Info,remove_info_in_prev(Info, [SuiteInfo])]). + +delete_require_terms([Info | Prev]) -> + Info1 = [T || T <- Info, + require /= element(1,T), + default_config /= element(1,T)], + [Info1 | delete_require_terms(Prev)]; +delete_require_terms([]) -> + []. merge_with_suite_defaults(Mod,SuiteInfo) -> case lists:keysearch(suite_defaults,1,Mod:module_info(attributes)) of @@ -355,16 +502,17 @@ timetrap_first([Trap = {timetrap,_} | Rest],Info,Found) -> timetrap_first([Other | Rest],Info,Found) -> timetrap_first(Rest,[Other | Info],Found); timetrap_first([],Info,[]) -> - [{timetrap,{minutes,30}} | lists:reverse(Info)]; + [{timetrap,{minutes,30}} | ?rev(Info)]; timetrap_first([],Info,Found) -> - lists:reverse(Found) ++ lists:reverse(Info). + ?rev(Found) ++ ?rev(Info). configure([{require,Required}|Rest],Info,SuiteInfo,Scope,Config) -> case ct:require(Required) of ok -> configure(Rest,Info,SuiteInfo,Scope,Config); Error = {error,Reason} -> - case required_default('_UNDEF',Required,Info,SuiteInfo,Scope) of + case required_default('_UNDEF',Required,Info, + SuiteInfo,Scope) of ok -> configure(Rest,Info,SuiteInfo,Scope,Config); _ -> @@ -406,18 +554,24 @@ configure([],_,_,_,Config) -> {ok,[Config]}. %% the require element in Info may come from suite/0 and -%% should be scoped 'suite', or come from the testcase info -%% function and should then be scoped 'testcase' -required_default(Name,Key,Info,SuiteInfo,{Func,true}) -> +%% should be scoped 'suite', or come from the group info +%% function and be scoped 'group', or come from the testcase +%% info function and then be scoped 'testcase' + +required_default(Name,Key,Info,SuiteInfo,{FuncSpec,true}) -> case try_set_default(Name,Key,SuiteInfo,suite) of ok -> ok; _ -> - required_default(Name,Key,Info,[],{Func,false}) + required_default(Name,Key,Info,[],{FuncSpec,false}) end; required_default(Name,Key,Info,_,{init_per_suite,_}) -> try_set_default(Name,Key,Info,suite); -required_default(Name,Key,Info,_,_) -> +required_default(Name,Key,Info,_,{{init_per_group,GrName,_},_}) -> + try_set_default(Name,Key,Info,{group,GrName}); +required_default(Name,Key,Info,_,{{ct_init_per_group,GrName,_},_}) -> + try_set_default(Name,Key,Info,{group,GrName}); +required_default(Name,Key,Info,_,_FuncSpec) -> try_set_default(Name,Key,Info,testcase). try_set_default(Name,Key,Info,Where) -> @@ -484,7 +638,11 @@ end_tc(Mod,Func,TCPid,Result,Args,Return) -> ct_util:delete_suite_data(last_saved_config), FuncSpec = case group_or_func(Func,Args) of - {_,GroupName,_Props} = Group -> + {_,GroupName,_Props} = Group -> + if Func == end_per_group; Func == ct_end_per_group -> + ct_config:delete_default_config({group,GroupName}); + true -> ok + end, case lists:keysearch(save_config,1,Args) of {value,{save_config,SaveConfig}} -> ct_util:save_suite_data( @@ -703,12 +861,14 @@ mark_as_failed1(_,_,_,[]) -> ok. group_or_func(Func, Config) when Func == init_per_group; - Func == end_per_group -> - case proplists:get_value(tc_group_properties,Config) of + Func == end_per_group; + Func == ct_init_per_group; + Func == ct_end_per_group -> + case ?val(tc_group_properties, Config) of undefined -> {Func,unknown,[]}; GrProps -> - GrName = proplists:get_value(name,GrProps), + GrName = ?val(name,GrProps), {Func,GrName,proplists:delete(name,GrProps)} end; group_or_func(Func, _Config) -> @@ -732,7 +892,7 @@ get_suite(Mod, all) -> %% (and only) test case so we can report Error properly [{?MODULE,error_in_suite,[[Error]]}]; ConfTests -> - get_all(Mod, ConfTests) + get_all(Mod, ConfTests) end; _ -> E = "Bad return value from "++atom_to_list(Mod)++":groups/0", @@ -746,7 +906,7 @@ get_suite(Mod, all) -> %% group get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) -> - Name = proplists:get_value(name, Props), + Name = ?val(name, Props), case catch apply(Mod, groups, []) of {'EXIT',_} -> [Group]; @@ -764,14 +924,25 @@ get_suite(Mod, Group={conf,Props,_Init,TCs,_End}) -> %% a *subgroup* specified *only* as skipped (and not %% as an explicit test) should not be returned, or %% init/end functions for top groups will be executed - case catch proplists:get_value(name, element(2, hd(ConfTests))) of + case catch ?val(name, element(2, hd(ConfTests))) of Name -> % top group delete_subs(ConfTests, ConfTests); _ -> [] end; false -> - delete_subs(ConfTests, ConfTests) + ConfTests1 = delete_subs(ConfTests, ConfTests), + case ?val(override, Props) of + undefined -> + ConfTests1; + [] -> + ConfTests1; + ORSpec -> + ORSpec1 = if is_tuple(ORSpec) -> [ORSpec]; + true -> ORSpec end, + search_and_override(ConfTests1, + ORSpec1, Mod) + end end end; _ -> @@ -793,13 +964,12 @@ get_all_cases(Suite) -> {error,Error}; Tests -> Cases = get_all_cases1(Suite, Tests), - lists:reverse( - lists:foldl(fun(TC, TCs) -> - case lists:member(TC, TCs) of + ?rev(lists:foldl(fun(TC, TCs) -> + case lists:member(TC, TCs) of true -> TCs; - false -> [TC | TCs] - end - end, [], Cases)) + false -> [TC | TCs] + end + end, [], Cases)) end. get_all_cases1(Suite, [{conf,_Props,_Init,GrTests,_End} | Tests]) -> @@ -918,14 +1088,14 @@ delete_subs([], All) -> All. delete_conf({conf,Props,_,_,_}, Confs) -> - Name = proplists:get_value(name, Props), + Name = ?val(name, Props), [Conf || Conf = {conf,Props0,_,_,_} <- Confs, - Name =/= proplists:get_value(name, Props0)]. + Name =/= ?val(name, Props0)]. is_sub({conf,Props,_,_,_}=Conf, [{conf,_,_,Tests,_} | Confs]) -> - Name = proplists:get_value(name, Props), + Name = ?val(name, Props), case lists:any(fun({conf,Props0,_,_,_}) -> - case proplists:get_value(name, Props0) of + case ?val(name, Props0) of N when N == Name -> true; _ -> @@ -1078,29 +1248,116 @@ expand_groups([H | T], ConfTests, Mod) -> expand_groups([], _ConfTests, _Mod) -> []; expand_groups({group,Name}, ConfTests, Mod) -> - FindConf = - fun({conf,Props,_,_,_}) -> - case proplists:get_value(name, Props) of - Name -> true; - _ -> false + expand_groups({group,Name,default,[]}, ConfTests, Mod); +expand_groups({group,Name,default}, ConfTests, Mod) -> + expand_groups({group,Name,default,[]}, ConfTests, Mod); +expand_groups({group,Name,ORProps}, ConfTests, Mod) when is_list(ORProps) -> + expand_groups({group,Name,ORProps,[]}, ConfTests, Mod); +expand_groups({group,Name,ORProps,SubORSpec}, ConfTests, Mod) -> + FindConf = + fun(Conf = {conf,Props,Init,Ts,End}) -> + case ?val(name, Props) of + Name when ORProps == default -> + [Conf]; + Name -> + [{conf,[{name,Name}|ORProps],Init,Ts,End}]; + _ -> + [] end end, - case lists:filter(FindConf, ConfTests) of - [ConfTest|_] -> - expand_groups(ConfTest, ConfTests, Mod); + case lists:flatmap(FindConf, ConfTests) of [] -> - E = "Invalid reference to group "++ - atom_to_list(Name)++" in "++ - atom_to_list(Mod)++":all/0", - throw({error,list_to_atom(E)}) + throw({error,invalid_ref_msg(Name, Mod)}); + Matching when SubORSpec == [] -> + Matching; + Matching -> + override_props(Matching, SubORSpec, Name,Mod) end; expand_groups(SeqOrTC, _ConfTests, _Mod) -> SeqOrTC. +%% search deep for the matching conf test and modify it and any +%% sub tests according to the override specification +search_and_override([Conf = {conf,Props,Init,Tests,End}], ORSpec, Mod) -> + Name = ?val(name, Props), + case lists:keysearch(Name, 1, ORSpec) of + {value,{Name,default}} -> + [Conf]; + {value,{Name,ORProps}} -> + [{conf,[{name,Name}|ORProps],Init,Tests,End}]; + {value,{Name,default,[]}} -> + [Conf]; + {value,{Name,default,SubORSpec}} -> + override_props([Conf], SubORSpec, Name,Mod); + {value,{Name,ORProps,SubORSpec}} -> + override_props([{conf,[{name,Name}|ORProps], + Init,Tests,End}], SubORSpec, Name,Mod); + _ -> + [{conf,Props,Init,search_and_override(Tests,ORSpec,Mod),End}] + end. + +%% Modify the Tests element according to the override specification +override_props([{conf,Props,Init,Tests,End} | Confs], SubORSpec, Name,Mod) -> + {Subs,SubORSpec1} = override_sub_props(Tests, [], SubORSpec, Mod), + [{conf,Props,Init,Subs,End} | override_props(Confs, SubORSpec1, Name,Mod)]; +override_props([], [], _,_) -> + []; +override_props([], SubORSpec, Name,Mod) -> + Es = [invalid_ref_msg(Name, element(1,Spec), Mod) || Spec <- SubORSpec], + throw({error,Es}). + +override_sub_props([], New, ORSpec, _) -> + {?rev(New),ORSpec}; +override_sub_props([T = {conf,Props,Init,Tests,End} | Ts], + New, ORSpec, Mod) -> + Name = ?val(name, Props), + case lists:keysearch(Name, 1, ORSpec) of + {value,Spec} -> % group found in spec + Props1 = + case element(2, Spec) of + default -> Props; + ORProps -> [{name,Name} | ORProps] + end, + case catch element(3, Spec) of + Undef when Undef == [] ; 'EXIT' == element(1, Undef) -> + override_sub_props(Ts, [{conf,Props1,Init,Tests,End} | New], + lists:keydelete(Name, 1, ORSpec), Mod); + SubORSpec when is_list(SubORSpec) -> + case override_sub_props(Tests, [], SubORSpec, Mod) of + {Subs,[]} -> + override_sub_props(Ts, [{conf,Props1,Init, + Subs,End} | New], + lists:keydelete(Name, 1, ORSpec), + Mod); + {_,NonEmptySpec} -> + Es = [invalid_ref_msg(Name, element(1, GrRef), + Mod) || GrRef <- NonEmptySpec], + throw({error,Es}) + end; + BadGrSpec -> + throw({error,{invalid_form,BadGrSpec}}) + end; + _ -> % not a group in spec + override_sub_props(Ts, [T | New], ORSpec, Mod) + end; +override_sub_props([TC | Ts], New, ORSpec, Mod) -> + override_sub_props(Ts, [TC | New], ORSpec, Mod). + +invalid_ref_msg(Name, Mod) -> + E = "Invalid reference to group "++ + atom_to_list(Name)++" in "++ + atom_to_list(Mod)++":all/0", + list_to_atom(E). + +invalid_ref_msg(Name0, Name1, Mod) -> + E = "Invalid reference to group "++ + atom_to_list(Name1)++" from "++atom_to_list(Name0)++ + " in "++atom_to_list(Mod)++":all/0", + list_to_atom(E). %%!============================================================ %%! The support for sequences by means of using sequences/0 -%%! will be removed in OTP R14. The code below is only kept +%%! will be removed in OTP R15. The code below is only kept %%! for backwards compatibility. From OTP R13 groups with %%! sequence property should be used instead! %%!============================================================ @@ -1234,8 +1491,8 @@ report(What,Data) -> loginfo -> %% logfiles and direcories have been created for a test and the %% top level test index page needs to be refreshed - TestName = filename:basename(proplists:get_value(topdir, Data), ".logs"), - RunDir = proplists:get_value(rundir, Data), + TestName = filename:basename(?val(topdir, Data), ".logs"), + RunDir = ?val(rundir, Data), ct_logs:make_all_suites_index({TestName,RunDir}), ok; tests_start -> @@ -1341,11 +1598,24 @@ report(What,Data) -> node=node(), data=Data}), ct_hooks:on_tc_skip(What, Data), - if Case /= end_per_suite, Case /= end_per_group -> + if Case /= end_per_suite, + Case /= end_per_group, + Case /= ct_end_per_group -> add_to_stats(auto_skipped); true -> ok end; + framework_error -> + case Data of + {{M,F},E} -> + ct_event:sync_notify(#event{name=tc_done, + node=node(), + data={M,F,{framework_error,E}}}); + _ -> + ct_event:sync_notify(#event{name=tc_done, + node=node(), + data=Data}) + end; _ -> ok end, diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 0a9bb5af67..05b10bca32 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -1660,6 +1660,14 @@ final_tests1([{TestDir,Suite,GrsOrCs}|Tests], Final, Skip, Bad) when ({skipped,Group,TCs}) -> [ct_framework:make_conf(TestDir, Suite, Group, [skipped], TCs)]; + ({GrSpec = {Group,_},TCs}) -> + Props = [{override,GrSpec}], + [ct_framework:make_conf(TestDir, Suite, + Group, Props, TCs)]; + ({GrSpec = {Group,_,_},TCs}) -> + Props = [{override,GrSpec}], + [ct_framework:make_conf(TestDir, Suite, + Group, Props, TCs)]; ({Group,TCs}) -> [ct_framework:make_conf(TestDir, Suite, Group, [], TCs)]; diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index 317910d5c8..b68cbd3aa1 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -878,7 +878,11 @@ separate([],_,_,_) -> %% {Suite2,[GrOrCase21,GrOrCase22,...]},...]} %% {{Node,Dir},[{Suite1,{skip,Cmt}}, %% {Suite2,[{GrOrCase21,{skip,Cmt}},GrOrCase22,...]},...]} -%% GrOrCase = {GroupName,[Case1,Case2,...]} | Case +%% GrOrCase = {GroupSpec,[Case1,Case2,...]} | Case +%% GroupSpec = {GroupName,OverrideProps} | +%% {GroupName,OverrideProps,SubGroupSpec} +%% OverrideProps = Props | default +%% SubGroupSpec = GroupSpec | [] insert_suites(Node,Dir,[S|Ss],Tests, MergeTests) -> Tests1 = insert_cases(Node,Dir,S,all,Tests,MergeTests), @@ -889,7 +893,7 @@ insert_suites(Node,Dir,S,Tests,MergeTests) -> insert_suites(Node,Dir,[S],Tests,MergeTests). insert_groups(Node,Dir,Suite,Group,Cases,Tests,MergeTests) - when is_atom(Group) -> + when is_atom(Group); is_tuple(Group) -> insert_groups(Node,Dir,Suite,[Group],Cases,Tests,MergeTests); insert_groups(Node,Dir,Suite,Groups,Cases,Tests,false) when ((Cases == all) or is_list(Cases)) and is_list(Groups) -> diff --git a/lib/common_test/test/Makefile b/lib/common_test/test/Makefile index b7b099069c..284612b8f7 100644 --- a/lib/common_test/test/Makefile +++ b/lib/common_test/test/Makefile @@ -30,8 +30,11 @@ MODULES= \ ct_userconfig_callback \ ct_smoke_test_SUITE \ ct_event_handler_SUITE \ + ct_config_info_SUITE \ ct_groups_test_1_SUITE \ ct_groups_test_2_SUITE \ + ct_group_info_SUITE \ + ct_groups_spec_SUITE \ ct_sequence_1_SUITE \ ct_repeat_1_SUITE \ ct_testspec_1_SUITE \ diff --git a/lib/common_test/test/ct_config_SUITE.erl b/lib/common_test/test/ct_config_SUITE.erl index 8ce75f582a..18218bee47 100644 --- a/lib/common_test/test/ct_config_SUITE.erl +++ b/lib/common_test/test/ct_config_SUITE.erl @@ -228,7 +228,7 @@ expected_events(config_static_SUITE)-> {?eh,tc_start,{config_static_SUITE,test_config_name_already_in_use2}}, {?eh,tc_done, {config_static_SUITE,test_config_name_already_in_use2, - {skipped,{config_name_already_in_use,[x1,alias]}}}}, + {skipped,{config_name_already_in_use,[alias,x1]}}}}, {?eh,test_stats,{4,0,{2,0}}}, {?eh,tc_start,{config_static_SUITE,test_alias_tclocal}}, {?eh,tc_done,{config_static_SUITE,test_alias_tclocal,ok}}, diff --git a/lib/common_test/test/ct_config_info_SUITE.erl b/lib/common_test/test/ct_config_info_SUITE.erl new file mode 100644 index 0000000000..40da377ee5 --- /dev/null +++ b/lib/common_test/test/ct_config_info_SUITE.erl @@ -0,0 +1,178 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%%------------------------------------------------------------------- +%%% File: ct_config_info_SUITE +%%% +%%% Description: Test how Common Test handles info functions +%%% for the config functions. +%%% +%%%------------------------------------------------------------------- +-module(ct_config_info_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(eh, ct_test_support_eh). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Description: Since Common Test starts another Test Server +%% instance, the tests need to be performed on a separate node (or +%% there will be clashes with logging processes etc). +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config1 = ct_test_support:init_per_suite(Config), + Config1. + +end_per_suite(Config) -> + ct_test_support:end_per_suite(Config). + +init_per_testcase(TestCase, Config) -> + ct_test_support:init_per_testcase(TestCase, Config). + +end_per_testcase(TestCase, Config) -> + ct_test_support:end_per_testcase(TestCase, Config). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ + config_info + ]. + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +config_info(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "config_info_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite}, + {label,config_info}], Config), + ok = execute(config_info, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +setup(Test, Config) -> + Opts0 = ct_test_support:get_opts(Config), + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +execute(Name, Opts, ERPid, Config) -> + ok = ct_test_support:run(Opts, Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(Name, + reformat(Events, ?eh), + ?config(priv_dir, Config), + Opts), + + TestEvents = events_to_check(Name), + ct_test_support:verify_events(TestEvents, Events, Config). + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +events_to_check(Test) -> + %% 2 tests (ct:run_test + script_start) is default + events_to_check(Test, 2). + +events_to_check(_, 0) -> + []; +events_to_check(Test, N) -> + test_events(Test) ++ events_to_check(Test, N-1). + + +test_events(config_info) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,6}}, + {?eh,tc_done,{config_info_1_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {init_per_group,unknown,[]}, + {failed,{timetrap_timeout,350}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,t11, + {failed,{config_info_1_SUITE,init_per_group,{timetrap_timeout,350}}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,end_per_group, + {failed,{config_info_1_SUITE,init_per_group, + {timetrap_timeout,350}}}}}], + + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{config_info_1_SUITE,t21,ok}}, + {?eh,tc_start,{config_info_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {end_per_group,unknown,[]}, + {failed,{timetrap_timeout,450}}}}], + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{init_per_group,g3,[]},ok}}, + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {init_per_group,unknown,[]}, + {failed,{timetrap_timeout,400}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,t41, + {failed,{config_info_1_SUITE,init_per_group, + {timetrap_timeout,400}}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,end_per_group, + {failed,{config_info_1_SUITE,init_per_group, + {timetrap_timeout,400}}}}}], + {?eh,tc_start,{config_info_1_SUITE,t31}}, + {?eh,tc_done,{config_info_1_SUITE,t31, + {skipped,{failed,{config_info_1_SUITE,init_per_testcase, + {timetrap_timeout,250}}}}}}, + {?eh,tc_start,{config_info_1_SUITE,t32}}, + {?eh,tc_done,{config_info_1_SUITE,t32, + {failed,{config_info_1_SUITE,end_per_testcase, + {timetrap_timeout,250}}}}}, + + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_done,{config_info_1_SUITE,t51,ok}}, + {?eh,tc_start,{config_info_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {end_per_group,unknown,[]}, + {failed,{timetrap_timeout,400}}}}], + {?eh,tc_start,{config_info_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{end_per_group,g3,[]},ok}}], + + {?eh,tc_start,{config_info_1_SUITE,end_per_suite}}, + {?eh,tc_done,{config_info_1_SUITE,end_per_suite, + {failed,{timetrap_timeout,300}}}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. diff --git a/lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl b/lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl new file mode 100644 index 0000000000..53a233b7a4 --- /dev/null +++ b/lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl @@ -0,0 +1,168 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(config_info_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%%----------------------------------------------------------------- + +suite() -> + [{timetrap,500}]. + +%%%----------------------------------------------------------------- + +group(_) -> + [{timetrap,250}]. + +%%%----------------------------------------------------------------- + +init_per_suite() -> + ct:pal("init_per_suite info called", []), + [{timetrap,1000}, + {require,suite_data}, + {default_config,suite_data,suite_data_val}]. + +init_per_suite(Config) -> + suite_data_val = ct:get_config(suite_data), + ct:sleep(750), + Config. + +%%%----------------------------------------------------------------- + +end_per_suite() -> + ct:pal("end_per_suite info called", []), + [{timetrap,300}, + {require,suite_data2}, + {default_config,suite_data2,suite_data2_val}]. + +end_per_suite(_Config) -> + suite_data2_val = ct:get_config(suite_data2), + ct:sleep(500), + ok. + +%%%----------------------------------------------------------------- + +init_per_group(g1) -> + ct:pal("init_per_group(g1) info called", []), + [{timetrap,350}]; +init_per_group(G) -> + ct:pal("init_per_group(~w) info called", [G]), + [{timetrap,400}]. + +init_per_group(g1, _Config) -> + ct:sleep(1000); +init_per_group(g4, _Config) -> + ct:sleep(1000); +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("init( ~w ): ~p", [G, GrProps1])), + ct:pal("init( ~w ): ~p", [G, GrProps1]), + Config. + +%%%----------------------------------------------------------------- + +end_per_group(g2) -> + ct:pal("end_per_group(g2) info called", []), + [{timetrap,450}]; +end_per_group(G) -> + ct:pal("end_per_group(~w) info called", [G]), + [{timetrap,400}]. + +end_per_group(g2, _Config) -> + ct:sleep(1000); +end_per_group(g5, _Config) -> + ct:sleep(1000); +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("end( ~w ): ~p", [G, GrProps1])), + ct:pal("end( ~w ): ~p", [G, GrProps1]), + ok. + +%%%----------------------------------------------------------------- +init_per_testcase() -> + [{timetrap,750}]. + +init_per_testcase(t1, _Config) -> + ct:sleep(1000); +init_per_testcase(t31, _Config) -> + ct:sleep(1000); +init_per_testcase(_TestCase, Config) -> + Config. + +%%%----------------------------------------------------------------- + +end_per_testcase() -> + [{timetrap,600}]. + +end_per_testcase(t2, _Config) -> + ct:sleep(1000); +end_per_testcase(t32, _Config) -> + ct:sleep(1000); +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% TEST DECLARATIONS +%%-------------------------------------------------------------------- + +groups() -> + [ + {g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[{g4,[],[t41]}, t31, t32, {g5,[],[t51]}]} + ]. + +all() -> + [ + {group,g1}, + {group,g2}, + {group,g3} + ]. + +%%----------------------------------------------------------------- +%% TEST CASES +%%----------------------------------------------------------------- + +t1(_) -> + exit(should_not_execute). + +t2(_) -> + ok. + +t11(_) -> + exit(should_not_execute). + +t21(_) -> + ok. + +t31(_) -> + exit(should_not_execute). + +t32(_) -> + ok. + +t41(_) -> + exit(should_not_execute). + +t51(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl index c1a455c6d8..2b3157ff3b 100644 --- a/lib/common_test/test/ct_error_SUITE.erl +++ b/lib/common_test/test/ct_error_SUITE.erl @@ -493,7 +493,7 @@ test_events(cfg_error) -> {?eh,tc_start,{cfg_error_9_SUITE,tc1}}, {?eh,tc_done,{cfg_error_9_SUITE,tc1, {skipped,{failed,{cfg_error_9_SUITE,init_per_testcase, - tc1_should_be_skipped}}}}}, + {tc1_should_be_skipped,'_'}}}}}}, {?eh,test_stats,{9,0,{0,15}}}, {?eh,tc_start,{cfg_error_9_SUITE,tc2}}, {?eh,tc_done,{cfg_error_9_SUITE,tc2, @@ -535,12 +535,7 @@ test_events(cfg_error) -> {?eh,tc_start,{cfg_error_9_SUITE,tc13}}, {?eh,tc_done,{cfg_error_9_SUITE,tc13, {failed,{cfg_error_9_SUITE,end_per_testcase, - {'EXIT',{{badmatch,undefined}, - [{cfg_error_9_SUITE,end_per_testcase,2}, - {test_server,my_apply,3}, - {test_server,do_end_per_testcase,4}, - {test_server,run_test_case_eval1,6}, - {test_server,run_test_case_eval,9}]}}}}}}, + {'EXIT',{{badmatch,undefined},'_'}}}}}}, {?eh,test_stats,{12,3,{0,18}}}, {?eh,tc_start,{cfg_error_9_SUITE,tc14}}, {?eh,tc_done, @@ -568,8 +563,8 @@ test_events(cfg_error) -> {?eh,tc_start,{cfg_error_11_SUITE,init_per_suite}}, {?eh,tc_done,{cfg_error_11_SUITE,init_per_suite,ok}}, {?eh,tc_start,{cfg_error_11_SUITE,tc1}}, - {?eh,tc_done,{cfg_error_11_SUITE,tc1, - {skipped,{config_name_already_in_use,[dummy0]}}}}, + {?eh,tc_done, {cfg_error_11_SUITE,tc1, + {skipped,{config_name_already_in_use,[dummy_alias]}}}}, {?eh,test_stats,{12,6,{1,19}}}, {?eh,tc_start,{cfg_error_11_SUITE,tc2}}, {?eh,tc_done,{cfg_error_11_SUITE,tc2,ok}}, @@ -577,7 +572,7 @@ test_events(cfg_error) -> {?eh,tc_start,{cfg_error_11_SUITE,end_per_suite}}, {?eh,tc_done,{cfg_error_11_SUITE,end_per_suite,ok}}, {?eh,tc_start,{cfg_error_12_SUITE,tc1}}, - {?eh,tc_done,{cfg_error_12_SUITE,tc1,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_done,{ct_framework,init_tc,{framework_error,{timetrap,500}}}}, {?eh,test_stats,{13,7,{1,19}}}, {?eh,tc_start,{cfg_error_12_SUITE,tc2}}, {?eh,tc_done,{cfg_error_12_SUITE,tc2,{failed, @@ -875,10 +870,10 @@ test_events(timetrap_fun) -> {?eh,tc_done, {timetrap_6_SUITE,init_per_suite,{skipped,{timetrap_error,kaboom}}}}, {?eh,tc_auto_skip, - {timetrap_6_SUITE,tc0,{fw_auto_skip,{timetrap_error,kaboom}}}}, + {timetrap_6_SUITE,tc0,{timetrap_error,kaboom}}}, {?eh,test_stats,{0,8,{0,5}}}, {?eh,tc_auto_skip, - {timetrap_6_SUITE,end_per_suite,{fw_auto_skip,{timetrap_error,kaboom}}}}, + {timetrap_6_SUITE,end_per_suite,{timetrap_error,kaboom}}}, {?eh,tc_done,{timetrap_7_SUITE,init_per_suite,ok}}, {?eh,tc_start,{timetrap_7_SUITE,tc0}}, diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_11_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_11_SUITE.erl index ce94533110..aa7857aa92 100644 --- a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_11_SUITE.erl +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_11_SUITE.erl @@ -29,10 +29,7 @@ suite() -> [{timetrap,{seconds,2}}, {require, dummy0}, {default_config, dummy0, "suite/0"}, - {require, dummy1}, {default_config, dummy1, "suite/0"}, - {require, dummy2}, {default_config, dummy2, "suite/0"}]. - - + {require, dummy_alias, dummy1}, {default_config, dummy1, "suite/0"}]. %%-------------------------------------------------------------------- %% Function: init_per_suite(Config0) -> @@ -119,16 +116,17 @@ groups() -> %% Reason = term() %%-------------------------------------------------------------------- all() -> - [tc1, tc2]. + [tc1,tc2]. tc1() -> - [{require, dummy0}, {default_config, dummy0, "tc1"}]. + [{require, dummy0}, {default_config, dummy0, "tc1"}, + {require, dummy_alias, dummy2}, {default_config, dummy2, "tc1"}]. tc1(_) -> dummy. tc2() -> - [{timetrap,1}]. + [{timetrap,10}]. tc2(_) -> dummy. diff --git a/lib/common_test/test/ct_group_info_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE.erl new file mode 100644 index 0000000000..2da8219196 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE.erl @@ -0,0 +1,859 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%%------------------------------------------------------------------- +%%% File: ct_group_info_SUITE +%%% +%%% Description: +%%% Test that the group info function works as expected with regards +%%% to timetraps and require (and default config values). +%%% +%%%------------------------------------------------------------------- +-module(ct_group_info_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(eh, ct_test_support_eh). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Description: Since Common Test starts another Test Server +%% instance, the tests need to be performed on a separate node (or +%% there will be clashes with logging processes etc). +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config1 = ct_test_support:init_per_suite(Config), + Config1. + +end_per_suite(Config) -> + ct_test_support:end_per_suite(Config). + +init_per_testcase(TestCase, Config) -> + ct_test_support:init_per_testcase(TestCase, Config). + +end_per_testcase(TestCase, Config) -> + ct_test_support:end_per_testcase(TestCase, Config). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ + timetrap_all, + timetrap_group, + timetrap_group_case, + timetrap_all_no_ips, + timetrap_all_no_ipg, + require, + require_default, + require_no_ips, + require_no_ipg + ]. + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +timetrap_all(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_timetrap_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite}, + {label,timetrap_all}], Config), + ok = execute(timetrap_all, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +timetrap_group(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_timetrap_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite},{group,[g1,g3,g7]}, + {label,timetrap_group}], Config), + ok = execute(timetrap_group, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +timetrap_group_case(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_timetrap_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite},{group,g4},{testcase,t41}, + {label,timetrap_group_case}], Config), + ok = execute(timetrap_group_case, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +timetrap_all_no_ips(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_timetrap_2_SUITE"), + {Opts,ERPid} = setup([{suite,Suite}, + {label,timetrap_all_no_ips}], Config), + ok = execute(timetrap_all_no_ips, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +timetrap_all_no_ipg(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_timetrap_3_SUITE"), + {Opts,ERPid} = setup([{suite,Suite}, + {label,timetrap_all_no_ipg}], Config), + ok = execute(timetrap_all_no_ipg, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +require(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_require_1_SUITE"), + CfgFile = filename:join(DataDir, "vars.cfg"), + {Opts,ERPid} = setup([{suite,Suite},{config,CfgFile}, + {label,require}], Config), + ok = execute(require, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +require_default(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_require_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite}, + {label,require_default}], Config), + ok = execute(require_default, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +require_no_ips(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_require_2_SUITE"), + CfgFile = filename:join(DataDir, "vars.cfg"), + {Opts,ERPid} = setup([{suite,Suite},{config,CfgFile}, + {label,require_no_ips}], Config), + ok = execute(require_no_ips, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +require_no_ipg(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "group_require_3_SUITE"), + CfgFile = filename:join(DataDir, "vars.cfg"), + {Opts,ERPid} = setup([{suite,Suite},{config,CfgFile}, + {label,require_no_ipg}], Config), + ok = execute(require_no_ipg, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +setup(Test, Config) -> + Opts0 = ct_test_support:get_opts(Config), + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +execute(Name, Opts, ERPid, Config) -> + ok = ct_test_support:run(Opts, Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(Name, + reformat(Events, ?eh), + ?config(priv_dir, Config), + Opts), + + TestEvents = events_to_check(Name), + ct_test_support:verify_events(TestEvents, Events, Config). + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +events_to_check(Test) -> + %% 2 tests (ct:run_test + script_start) is default + events_to_check(Test, 2). + +events_to_check(_, 0) -> + []; +events_to_check(Test, N) -> + test_events(Test) ++ events_to_check(Test, N-1). + + +test_events(timetrap_all) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,14}}, + {?eh,tc_done,{group_timetrap_1_SUITE,init_per_suite,ok}}, + + {?eh,tc_done,{group_timetrap_1_SUITE,t1,{failed,{timetrap_timeout,1000}}}}, + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t11,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t21,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g2,[]},ok}}], + + {?eh,tc_done,{group_timetrap_1_SUITE,t2,{failed,{timetrap_timeout,1000}}}}, + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g3,[]},ok}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t41,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g4,[]},ok}}], + {?eh,tc_done,{group_timetrap_1_SUITE,t31,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t51,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g5,[]},ok}}], + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g3,[]},ok}}], + + {?eh,tc_done,{group_timetrap_1_SUITE,t3,{failed,{timetrap_timeout,250}}}}, + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g6,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t61,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g6,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g6,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g7,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g7,[]},ok}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g8,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g8,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t81,{failed,{timetrap_timeout,750}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g8,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g8,[]},ok}}], + {?eh,tc_done,{group_timetrap_1_SUITE,t71,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g9,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g9,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t91,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g9,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g9,[]},ok}}], + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g7,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g7,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g10,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g10,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t101,{failed,{timetrap_timeout,1000}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g10,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g10,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g11,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g11,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t111,{failed,{timetrap_timeout,1000}}}}, + {?eh,test_stats,{0,14,{0,0}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g11,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g11,[]},ok}}], + + {?eh,tc_done,{group_timetrap_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(timetrap_group) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,7}}, + {?eh,tc_done,{group_timetrap_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t11,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g3,[]},ok}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t41,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g4,[]},ok}}], + {?eh,tc_done,{group_timetrap_1_SUITE,t31,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t51,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g5,[]},ok}}], + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g3,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g7,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g7,[]},ok}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g8,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g8,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t81,{failed,{timetrap_timeout,750}}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g8,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g8,[]},ok}}], + {?eh,tc_done,{group_timetrap_1_SUITE,t71,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g9,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g9,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t91,{failed,{timetrap_timeout,250}}}}, + {?eh,test_stats,{0,7,{0,0}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g9,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g9,[]},ok}}], + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g7,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g7,[]},ok}}], + + {?eh,tc_done,{group_timetrap_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(timetrap_group_case) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,1}}, + {?eh,tc_done,{group_timetrap_1_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g3,[]},ok}}, + [{?eh,tc_start,{group_timetrap_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_done,{group_timetrap_1_SUITE,t41,{failed,{timetrap_timeout,250}}}}, + {?eh,test_stats,{0,1,{0,0}}}, + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g4,[]},ok}}], + {?eh,tc_start,{group_timetrap_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_1_SUITE,{end_per_group,g3,[]},ok}}], + + {?eh,tc_done,{group_timetrap_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(timetrap_all_no_ips) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,14}}, + + {?eh,tc_done,{group_timetrap_2_SUITE,t1,{failed,{timetrap_timeout,1000}}}}, + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t11,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t21,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g2,[]},ok}}], + + {?eh,tc_done,{group_timetrap_2_SUITE,t2,{failed,{timetrap_timeout,1000}}}}, + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g3,[]},ok}}, + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t41,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g4,[]},ok}}], + {?eh,tc_done,{group_timetrap_2_SUITE,t31,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t51,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g5,[]},ok}}], + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g3,[]},ok}}], + + {?eh,tc_done,{group_timetrap_2_SUITE,t3,{failed,{timetrap_timeout,250}}}}, + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g6,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t61,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g6,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g6,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g7,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g7,[]},ok}}, + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g8,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g8,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t81,{failed,{timetrap_timeout,750}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g8,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g8,[]},ok}}], + {?eh,tc_done,{group_timetrap_2_SUITE,t71,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g9,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g9,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t91,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g9,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g9,[]},ok}}], + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g7,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g7,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g10,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g10,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t101,{failed,{timetrap_timeout,1000}}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g10,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g10,[]},ok}}], + + [{?eh,tc_start,{group_timetrap_2_SUITE,{init_per_group,g11,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{init_per_group,g11,[]},ok}}, + {?eh,tc_done,{group_timetrap_2_SUITE,t111,{failed,{timetrap_timeout,1000}}}}, + {?eh,test_stats,{0,14,{0,0}}}, + {?eh,tc_start,{group_timetrap_2_SUITE,{end_per_group,g11,[]}}}, + {?eh,tc_done,{group_timetrap_2_SUITE,{end_per_group,g11,[]},ok}}], + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(timetrap_all_no_ipg) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,14}}, + + {?eh,tc_done,{group_timetrap_3_SUITE,t1,{failed,{timetrap_timeout,1000}}}}, + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g1,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g1,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t11,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g1,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g1,[{suite,group_timetrap_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g2,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g2,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t21,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g2,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g2,[{suite,group_timetrap_3_SUITE}]},ok}}], + + {?eh,tc_done,{group_timetrap_3_SUITE,t2,{failed,{timetrap_timeout,1000}}}}, + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g3,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g3,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g4,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g4,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t41,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g4,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g4,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_done,{group_timetrap_3_SUITE,t31,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g5,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g5,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t51,{failed,{timetrap_timeout,1500}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g5,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g5,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{ct_end_per_group,g3,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g3,[{suite,group_timetrap_3_SUITE}]},ok}}], + + {?eh,tc_done,{group_timetrap_3_SUITE,t3,{failed,{timetrap_timeout,250}}}}, + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g6,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g6,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t61,{failed,{timetrap_timeout,500}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g6,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g6,[{suite,group_timetrap_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g7,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g7,[{suite,group_timetrap_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g8,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g8,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t81,{failed,{timetrap_timeout,750}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g8,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g8,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_done,{group_timetrap_3_SUITE,t71,{failed,{timetrap_timeout,500}}}}, + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g9,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g9,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t91,{failed,{timetrap_timeout,250}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g9,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g9,[{suite,group_timetrap_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{ct_end_per_group,g7,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g7,[{suite,group_timetrap_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g10,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g10,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t101,{failed,{timetrap_timeout,1000}}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g10,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g10,[{suite,group_timetrap_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g11,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g11,[{suite,group_timetrap_3_SUITE}]},ok}}, + {?eh,tc_done,{group_timetrap_3_SUITE,t111,{failed,{timetrap_timeout,1000}}}}, + {?eh,test_stats,{0,14,{0,0}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g11,[{suite,group_timetrap_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g11,[{suite,group_timetrap_3_SUITE}]},ok}}], + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(require) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,13}}, + {?eh,tc_done,{group_require_1_SUITE,init_per_suite,ok}}, + {?eh,tc_done,{group_require_1_SUITE,t1,ok}}, + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t11,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t21,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g2,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g3,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t31,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g3,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g4,[]}, + {skipped,{require_failed,{name_in_use,common2_alias,common2}}}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,t41, + {require_failed,{name_in_use,common2_alias,common2}}}}, + {?eh,test_stats,{4,0,{0,1}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {require_failed,{name_in_use,common2_alias,common2}}}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g5,[]},ok}}, + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g6,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t61,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g6,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g6,[]},ok}}], + {?eh,tc_done,{group_require_1_SUITE,t51,ok}}, + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g7,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g7,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t71,ok}}, + {?eh,tc_done,{group_require_1_SUITE,t72,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g7,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g7,[]},ok}}], + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g5,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g8,[]}}}, + {?eh,tc_done,{group_require_1_SUITE, + {init_per_group,g8,[]}, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,t81, + {require_failed,{not_available,non_existing}}}}, + {?eh,test_stats,{8,0,{0,2}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {require_failed,{not_available,non_existing}}}}], + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g9,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g9,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t91, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,test_stats,{8,0,{0,3}}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g9,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g9,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g10,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g10,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t101,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g10,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g10,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g11,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g11,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t111,ok}}, + {?eh,test_stats,{10,0,{0,3}}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g11,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g11,[]},ok}}], + + {?eh,tc_done,{group_require_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(require_default) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,13}}, + {?eh,tc_done,{group_require_1_SUITE,init_per_suite,ok}}, + {?eh,tc_done,{group_require_1_SUITE,t1,ok}}, + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t11,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t21,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g2,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g3,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t31,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g3,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_require_1_SUITE, + {init_per_group,g4,[]}, + {skipped,{require_failed,{not_available,common3}}}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,t41, + {require_failed,{not_available,common3}}}}, + {?eh,test_stats,{4,0,{0,1}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {require_failed,{not_available,common3}}}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g5,[]},ok}}, + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g6,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t61,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g6,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g6,[]},ok}}], + {?eh,tc_done,{group_require_1_SUITE,t51,ok}}, + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g7,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g7,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t71,ok}}, + {?eh,tc_done,{group_require_1_SUITE,t72,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g7,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g7,[]},ok}}], + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g5,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g8,[]}}}, + {?eh,tc_done,{group_require_1_SUITE, + {init_per_group,g8,[]}, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,t81, + {require_failed,{not_available,non_existing}}}}, + {?eh,test_stats,{8,0,{0,2}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {require_failed,{not_available,non_existing}}}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g9,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g9,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t91, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,test_stats,{8,0,{0,3}}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g9,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g9,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g10,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g10,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t101,ok}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g10,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g10,[]},ok}}], + + [{?eh,tc_start,{group_require_1_SUITE,{init_per_group,g11,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{init_per_group,g11,[]},ok}}, + {?eh,tc_done,{group_require_1_SUITE,t111,ok}}, + {?eh,test_stats,{10,0,{0,3}}}, + {?eh,tc_start,{group_require_1_SUITE,{end_per_group,g11,[]}}}, + {?eh,tc_done,{group_require_1_SUITE,{end_per_group,g11,[]},ok}}], + + {?eh,tc_done,{group_require_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(require_no_ips) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,13}}, + {?eh,tc_done,{group_require_2_SUITE,t1,ok}}, + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t11,ok}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t21,ok}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g2,[]},ok}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g3,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t31,ok}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g3,[]},ok}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g4,[]}, + {skipped,{require_failed,{name_in_use,common2_alias,common2}}}}}, + {?eh,tc_auto_skip,{group_require_2_SUITE,t41, + {require_failed,{name_in_use,common2_alias,common2}}}}, + {?eh,test_stats,{4,0,{0,1}}}, + {?eh,tc_auto_skip,{group_require_2_SUITE,end_per_group, + {require_failed,{name_in_use,common2_alias,common2}}}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g5,[]},ok}}, + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g6,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t61,ok}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g6,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g6,[]},ok}}], + {?eh,tc_done,{group_require_2_SUITE,t51,ok}}, + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g7,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g7,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t71,ok}}, + {?eh,tc_done,{group_require_2_SUITE,t72,ok}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g7,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g7,[]},ok}}], + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g5,[]},ok}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g8,[]}}}, + {?eh,tc_done,{group_require_2_SUITE, + {init_per_group,g8,[]}, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,tc_auto_skip,{group_require_2_SUITE,t81, + {require_failed,{not_available,non_existing}}}}, + {?eh,test_stats,{8,0,{0,2}}}, + {?eh,tc_auto_skip,{group_require_2_SUITE,end_per_group, + {require_failed,{not_available,non_existing}}}}], + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g9,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g9,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t91, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,test_stats,{8,0,{0,3}}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g9,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g9,[]},ok}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g10,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g10,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t101,ok}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g10,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g10,[]},ok}}], + + [{?eh,tc_start,{group_require_2_SUITE,{init_per_group,g11,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{init_per_group,g11,[]},ok}}, + {?eh,tc_done,{group_require_2_SUITE,t111,ok}}, + {?eh,test_stats,{10,0,{0,3}}}, + {?eh,tc_start,{group_require_2_SUITE,{end_per_group,g11,[]}}}, + {?eh,tc_done,{group_require_2_SUITE,{end_per_group,g11,[]},ok}}], + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(require_no_ipg) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,13}}, + {?eh,tc_done,{group_require_3_SUITE,t1,ok}}, + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g1,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g1,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t11,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g1,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g1,[{suite,group_require_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g2,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g2,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t21,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g2,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g2,[{suite,group_require_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g3,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g3,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t31,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g3,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g3,[{suite,group_require_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g4,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g4,[{suite,group_require_3_SUITE}]}, + {skipped,{require_failed,{name_in_use,common2_alias,common2}}}}}, + {?eh,tc_auto_skip,{group_require_3_SUITE,t41, + {require_failed,{name_in_use,common2_alias,common2}}}}, + {?eh,test_stats,{4,0,{0,1}}}, + {?eh,tc_auto_skip,{ct_framework,ct_end_per_group, + {require_failed,{name_in_use,common2_alias,common2}}}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g5,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g5,[{suite,group_require_3_SUITE}]},ok}}, + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g6,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g6,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t61,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g6,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g6,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_done,{group_require_3_SUITE,t51,ok}}, + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g7,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g7,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t71,ok}}, + {?eh,tc_done,{group_require_3_SUITE,t72,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g7,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g7,[{suite,group_require_3_SUITE}]},ok}}], + {?eh,tc_start,{ct_framework,{ct_end_per_group,g5,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g5,[{suite,group_require_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g8,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g8,[{suite,group_require_3_SUITE}]}, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,tc_auto_skip,{group_require_3_SUITE,t81, + {require_failed,{not_available,non_existing}}}}, + {?eh,test_stats,{8,0,{0,2}}}, + {?eh,tc_auto_skip,{ct_framework,ct_end_per_group, + {require_failed,{not_available,non_existing}}}}], + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g9,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g9,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t91, + {skipped,{require_failed,{not_available,non_existing}}}}}, + {?eh,test_stats,{8,0,{0,3}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g9,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g9,[{suite,group_require_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g10,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g10,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t101,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g10,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g10,[{suite,group_require_3_SUITE}]},ok}}], + + [{?eh,tc_start,{ct_framework,{ct_init_per_group,g11,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,g11,[{suite,group_require_3_SUITE}]},ok}}, + {?eh,tc_done,{group_require_3_SUITE,t111,ok}}, + {?eh,test_stats,{10,0,{0,3}}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,g11,[{suite,group_require_3_SUITE}]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,g11,[{suite,group_require_3_SUITE}]},ok}}], + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/group_require_1_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE_data/group_require_1_SUITE.erl new file mode 100644 index 0000000000..16df897752 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/group_require_1_SUITE.erl @@ -0,0 +1,259 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(group_require_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +init_per_suite(Config) -> + ct:comment(io_lib:format("init( ~w ): ~p", [?MODULE, suite()])), + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + Info = case catch group(G) of {'EXIT',_} -> []; I -> I end, + ct:comment(io_lib:format("init( ~w ): ~p", [G, Info])), + if Info /= [] -> verify_cfg(G); true -> ok end, + Config. + +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + Info = case catch group(G) of {'EXIT',_} -> []; I -> I end, + ct:comment(io_lib:format("end( ~w )", [G])), + if Info /= [] -> verify_cfg(G); true -> ok end, + ok. + +init_per_testcase(t101, Config) -> + Config; +init_per_testcase(t111, Config) -> + Config; +init_per_testcase(TestCase, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = if GrProps == undefined -> []; true -> GrProps end, + verify_cfg(proplists:get_value(name, GrProps1)), + if TestCase == t72 -> verify_cfg(TestCase); true -> ok end, + Info = case catch apply(?MODULE,TestCase,[]) of + {'EXIT',_} -> []; + I -> I + end, + ct:comment(io_lib:format("init( ~w ): ~p", [TestCase, Info])), + Config. + +end_per_testcase(t101, Config) -> + ok; +end_per_testcase(t111, Config) -> + ok; +end_per_testcase(TestCase, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = if GrProps == undefined -> []; true -> GrProps end, + verify_cfg(proplists:get_value(name, GrProps1)), + if TestCase == t72 -> verify_cfg(TestCase); true -> ok end, + ok. + +verify_cfg(undefined) -> + ok; +verify_cfg(Name) -> + Key = list_to_atom(atom_to_list(Name) ++ "_cfg"), + Alias = list_to_atom(atom_to_list(Name) ++ "_cfg_alias"), + Val = list_to_atom(atom_to_list(Name) ++ "_cfg_val"), + ct:pal("Reading ~p & ~p. Expecting ~p.", [Key,Alias,Val]), + Val = ct:get_config(Key), + Val = ct:get_config(Alias), + suite_cfg_val = ct:get_config(suite_cfg), + suite_cfg_val = ct:get_config(suite_cfg_alias). + + + +%%%------------------------------------------------------------------ +%%% TEST DECLARATIONS +%%%------------------------------------------------------------------ + +groups() -> + [{g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[t31]}, + {g4,[],[t41]}, + + {g5,[],[{group,g6},t51,{group,g7}]}, + + {g6,[],[t61]}, + {g7,[],[t71,t72]}, + + {g8,[],[t81]}, + {g9,[],[t91]}, + {g10,[],[t101]}, + {g11,[],[t111]} + ]. + + +all() -> + [t1, + {group,g1}, + {group,g2}, + {group,g3}, + {group,g4}, + {group,g5}, + {group,g8}, + {group,g9}, + {group,g10}, + {group,g11} + ]. + +%%%----------------------------------------------------------------- +%%% INFO FUNCS +%%%----------------------------------------------------------------- + +suite() -> [{require,suite_cfg}, + {require,suite_cfg_alias,suite_cfg}, + {require,common1}, + {default_config,suite_cfg,suite_cfg_val}, + {default_config,common1,common1_val}]. + +group(g1) -> [{require,g1_cfg}, + {require,g1_cfg_alias,g1_cfg}, + {default_config,g1_cfg,g1_cfg_val}]; + +group(g2) -> [{require,g2_cfg}, + {require,g2_cfg_alias,g2_cfg}, + {require,common1}, + {require,common2}, + {default_config,g2_cfg,g2_cfg_val}, + {default_config,common1,common1_val}, + {default_config,common2,common2_val}]; + +group(g3) -> [{require,g3_cfg}, + {require,g3_cfg_alias,g3_cfg}, + {require,common2}, + {require,common2_alias,common2}, + {default_config,g3_cfg,g3_cfg_val}, + {default_config,common2,common2_val}]; + +group(g4) -> [{require,g4_cfg}, + {require,g4_cfg_alias,g4_cfg}, + {require,common2_alias,common3}, + {default_config,g4_cfg,g4_cfg_val}]; + +group(g5) -> [{require,g5_cfg}, + {require,g5_cfg_alias,g5_cfg}, + {default_config,g5_cfg,g5_cfg_val}]; + +group(g6) -> [{require,g6_cfg}, + {require,g6_cfg_alias,g6_cfg}, + {default_config,g6_cfg,g6_cfg_val}]; + +group(g7) -> [{require,g7_cfg}, + {require,g7_cfg_alias,g7_cfg}, + {default_config,g7_cfg,g7_cfg_val}]; + +group(g8) -> [{require,non_existing}]; + +group(g9) -> [{require,g9_cfg}, + {require,g9_cfg_alias,g9_cfg}, + {default_config,g9_cfg,g9_cfg_val}]; + +group(G) when G /= g11 -> []. + +t72() -> [{require,t72_cfg}, + {require,t72_cfg_alias,t72_cfg}, + {default_config,t72_cfg,t72_cfg_val}]. + +t91() -> [{require,non_existing}]. + + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +t1(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + +t11(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + suite_cfg_val = ct:get_config(suite_cfg_alias), + g1_cfg_val = ct:get_config(g1_cfg), + g1_cfg_val = ct:get_config(g1_cfg_alias). + +t21(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g2_cfg_val = ct:get_config(g2_cfg), + g2_cfg_val = ct:get_config(g2_cfg_alias), + common1_val = ct:get_config(common1), + common2_val = ct:get_config(common2). + +t31(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g3_cfg_val = ct:get_config(g3_cfg), + g3_cfg_val = ct:get_config(g3_cfg_alias), + common2_val = ct:get_config(common2), + common2_val = ct:get_config(common2_alias). + +t41(_) -> + exit(should_be_skipped). + +t51(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias). + +t61(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g6_cfg_val = ct:get_config(g6_cfg), + g6_cfg_val = ct:get_config(g6_cfg_alias). + +t71(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g7_cfg_val = ct:get_config(g7_cfg), + g7_cfg_val = ct:get_config(g7_cfg_alias). + +t72(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g7_cfg_val = ct:get_config(g7_cfg), + g7_cfg_val = ct:get_config(g7_cfg_alias), + t72_cfg_val = ct:get_config(t72_cfg). + +t81(_) -> + exit(should_be_skipped). + +t91(_) -> + exit(should_be_skipped). + +t101(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + +t111(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/group_require_2_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE_data/group_require_2_SUITE.erl new file mode 100644 index 0000000000..adb53ff564 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/group_require_2_SUITE.erl @@ -0,0 +1,252 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(group_require_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + Info = case catch group(G) of {'EXIT',_} -> []; I -> I end, + ct:comment(io_lib:format("init( ~w ): ~p", [G, Info])), + if Info /= [] -> verify_cfg(G); true -> ok end, + Config. + +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + Info = case catch group(G) of {'EXIT',_} -> []; I -> I end, + ct:comment(io_lib:format("end( ~w )", [G])), + if Info /= [] -> verify_cfg(G); true -> ok end, + ok. + +init_per_testcase(t101, Config) -> + Config; +init_per_testcase(t111, Config) -> + Config; +init_per_testcase(TestCase, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = if GrProps == undefined -> []; true -> GrProps end, + verify_cfg(proplists:get_value(name, GrProps1)), + if TestCase == t72 -> verify_cfg(TestCase); true -> ok end, + Info = case catch apply(?MODULE,TestCase,[]) of + {'EXIT',_} -> []; + I -> I + end, + ct:comment(io_lib:format("init( ~w ): ~p", [TestCase, Info])), + Config. + +end_per_testcase(t101, Config) -> + ok; +end_per_testcase(t111, Config) -> + ok; +end_per_testcase(TestCase, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = if GrProps == undefined -> []; true -> GrProps end, + verify_cfg(proplists:get_value(name, GrProps1)), + if TestCase == t72 -> verify_cfg(TestCase); true -> ok end, + ok. + +verify_cfg(undefined) -> + ok; +verify_cfg(Name) -> + Key = list_to_atom(atom_to_list(Name) ++ "_cfg"), + Alias = list_to_atom(atom_to_list(Name) ++ "_cfg_alias"), + Val = list_to_atom(atom_to_list(Name) ++ "_cfg_val"), + ct:pal("Reading ~p & ~p. Expecting ~p.", [Key,Alias,Val]), + Val = ct:get_config(Key), + Val = ct:get_config(Alias), + suite_cfg_val = ct:get_config(suite_cfg), + suite_cfg_val = ct:get_config(suite_cfg_alias). + + + +%%%------------------------------------------------------------------ +%%% TEST DECLARATIONS +%%%------------------------------------------------------------------ + +groups() -> + [{g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[t31]}, + {g4,[],[t41]}, + + {g5,[],[{group,g6},t51,{group,g7}]}, + + {g6,[],[t61]}, + {g7,[],[t71,t72]}, + + {g8,[],[t81]}, + {g9,[],[t91]}, + {g10,[],[t101]}, + {g11,[],[t111]} + ]. + + +all() -> + [t1, + {group,g1}, + {group,g2}, + {group,g3}, + {group,g4}, + {group,g5}, + {group,g8}, + {group,g9}, + {group,g10}, + {group,g11} + ]. + +%%%----------------------------------------------------------------- +%%% INFO FUNCS +%%%----------------------------------------------------------------- + +suite() -> [{require,suite_cfg}, + {require,suite_cfg_alias,suite_cfg}, + {require,common1}, + {default_config,suite_cfg,suite_cfg_val}, + {default_config,common1,common1_val}]. + +group(g1) -> [{require,g1_cfg}, + {require,g1_cfg_alias,g1_cfg}, + {default_config,g1_cfg,g1_cfg_val}]; + +group(g2) -> [{require,g2_cfg}, + {require,g2_cfg_alias,g2_cfg}, + {require,common1}, + {require,common2}, + {default_config,g2_cfg,g2_cfg_val}, + {default_config,common1,common1_val}, + {default_config,common2,common2_val}]; + +group(g3) -> [{require,g3_cfg}, + {require,g3_cfg_alias,g3_cfg}, + {require,common2}, + {require,common2_alias,common2}, + {default_config,g3_cfg,g3_cfg_val}, + {default_config,common2,common2_val}]; + +group(g4) -> [{require,g4_cfg}, + {require,g4_cfg_alias,g4_cfg}, + {require,common2_alias,common3}, + {default_config,g4_cfg,g4_cfg_val}]; + +group(g5) -> [{require,g5_cfg}, + {require,g5_cfg_alias,g5_cfg}, + {default_config,g5_cfg,g5_cfg_val}]; + +group(g6) -> [{require,g6_cfg}, + {require,g6_cfg_alias,g6_cfg}, + {default_config,g6_cfg,g6_cfg_val}]; + +group(g7) -> [{require,g7_cfg}, + {require,g7_cfg_alias,g7_cfg}, + {default_config,g7_cfg,g7_cfg_val}]; + +group(g8) -> [{require,non_existing}]; + +group(g9) -> [{require,g9_cfg}, + {require,g9_cfg_alias,g9_cfg}, + {default_config,g9_cfg,g9_cfg_val}]; + +group(G) when G /= g11 -> []. + +t72() -> [{require,t72_cfg}, + {require,t72_cfg_alias,t72_cfg}, + {default_config,t72_cfg,t72_cfg_val}]. + +t91() -> [{require,non_existing}]. + + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +t1(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + +t11(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + suite_cfg_val = ct:get_config(suite_cfg_alias), + g1_cfg_val = ct:get_config(g1_cfg), + g1_cfg_val = ct:get_config(g1_cfg_alias). + +t21(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g2_cfg_val = ct:get_config(g2_cfg), + g2_cfg_val = ct:get_config(g2_cfg_alias), + common1_val = ct:get_config(common1), + common2_val = ct:get_config(common2). + +t31(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g3_cfg_val = ct:get_config(g3_cfg), + g3_cfg_val = ct:get_config(g3_cfg_alias), + common2_val = ct:get_config(common2), + common2_val = ct:get_config(common2_alias). + +t41(_) -> + exit(should_be_skipped). + +t51(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias). + +t61(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g6_cfg_val = ct:get_config(g6_cfg), + g6_cfg_val = ct:get_config(g6_cfg_alias). + +t71(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g7_cfg_val = ct:get_config(g7_cfg), + g7_cfg_val = ct:get_config(g7_cfg_alias). + +t72(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g7_cfg_val = ct:get_config(g7_cfg), + g7_cfg_val = ct:get_config(g7_cfg_alias), + t72_cfg_val = ct:get_config(t72_cfg). + +t81(_) -> + exit(should_be_skipped). + +t91(_) -> + exit(should_be_skipped). + +t101(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + +t111(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/group_require_3_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE_data/group_require_3_SUITE.erl new file mode 100644 index 0000000000..1f2dfd2a30 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/group_require_3_SUITE.erl @@ -0,0 +1,241 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(group_require_3_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +%% init_per_suite(Config) -> +%% Config. +%% end_per_suite(_) -> +%% ok. + +init_per_testcase(t101, Config) -> + Config; +init_per_testcase(t111, Config) -> + Config; +init_per_testcase(TestCase, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = if GrProps == undefined -> []; true -> GrProps end, + verify_cfg(proplists:get_value(name, GrProps1)), + if TestCase == t72 -> verify_cfg(TestCase); true -> ok end, + Info = case catch apply(?MODULE,TestCase,[]) of + {'EXIT',_} -> []; + I -> I + end, + ct:comment(io_lib:format("init( ~w ): ~p", [TestCase, Info])), + Config. + +end_per_testcase(t101, _Config) -> + ok; +end_per_testcase(t111, _Config) -> + ok; +end_per_testcase(TestCase, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = if GrProps == undefined -> []; true -> GrProps end, + verify_cfg(proplists:get_value(name, GrProps1)), + if TestCase == t72 -> verify_cfg(TestCase); true -> ok end, + ok. + +verify_cfg(undefined) -> + ok; +verify_cfg(Name) -> + Key = list_to_atom(atom_to_list(Name) ++ "_cfg"), + Alias = list_to_atom(atom_to_list(Name) ++ "_cfg_alias"), + Val = list_to_atom(atom_to_list(Name) ++ "_cfg_val"), + ct:pal("Reading ~p & ~p. Expecting ~p.", [Key,Alias,Val]), + Val = ct:get_config(Key), + Val = ct:get_config(Alias), + suite_cfg_val = ct:get_config(suite_cfg), + suite_cfg_val = ct:get_config(suite_cfg_alias). + + + +%%%------------------------------------------------------------------ +%%% TEST DECLARATIONS +%%%------------------------------------------------------------------ + +groups() -> + [{g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[t31]}, + {g4,[],[t41]}, + + {g5,[],[{group,g6},t51,{group,g7}]}, + + {g6,[],[t61]}, + {g7,[],[t71,t72]}, + + {g8,[],[t81]}, + {g9,[],[t91]}, + {g10,[],[t101]}, + {g11,[],[t111]} + ]. + + +all() -> + [t1, + {group,g1}, + {group,g2}, + {group,g3}, + {group,g4}, + {group,g5}, + {group,g8}, + {group,g9}, + {group,g10}, + {group,g11} + ]. + +%%%----------------------------------------------------------------- +%%% INFO FUNCS +%%%----------------------------------------------------------------- + +suite() -> [{require,suite_cfg}, + {require,suite_cfg_alias,suite_cfg}, + {require,common1}, + {default_config,suite_cfg,suite_cfg_val}, + {default_config,common1,common1_val}]. + +group(g1) -> [{require,g1_cfg}, + {require,g1_cfg_alias,g1_cfg}, + {default_config,g1_cfg,g1_cfg_val}]; + +group(g2) -> [{require,g2_cfg}, + {require,g2_cfg_alias,g2_cfg}, + {require,common1}, + {require,common2}, + {default_config,g2_cfg,g2_cfg_val}, + {default_config,common1,common1_val}, + {default_config,common2,common2_val}]; + +group(g3) -> [{require,g3_cfg}, + {require,g3_cfg_alias,g3_cfg}, + {require,common2}, + {require,common2_alias,common2}, + {default_config,g3_cfg,g3_cfg_val}, + {default_config,common2,common2_val}]; + +group(g4) -> [{require,g4_cfg}, + {require,g4_cfg_alias,g4_cfg}, + {require,common2_alias,common3}, + {default_config,g4_cfg,g4_cfg_val}]; + +group(g5) -> [{require,g5_cfg}, + {require,g5_cfg_alias,g5_cfg}, + {default_config,g5_cfg,g5_cfg_val}]; + +group(g6) -> [{require,g6_cfg}, + {require,g6_cfg_alias,g6_cfg}, + {default_config,g6_cfg,g6_cfg_val}]; + +group(g7) -> [{require,g7_cfg}, + {require,g7_cfg_alias,g7_cfg}, + {default_config,g7_cfg,g7_cfg_val}]; + +group(g8) -> [{require,non_existing}]; + +group(g9) -> [{require,g9_cfg}, + {require,g9_cfg_alias,g9_cfg}, + {default_config,g9_cfg,g9_cfg_val}]; + +group(G) when G /= g11 -> []. + +t72() -> [{require,t72_cfg}, + {require,t72_cfg_alias,t72_cfg}, + {default_config,t72_cfg,t72_cfg_val}]. + +t91() -> [{require,non_existing}]. + + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +t1(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + +t11(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + suite_cfg_val = ct:get_config(suite_cfg_alias), + g1_cfg_val = ct:get_config(g1_cfg), + g1_cfg_val = ct:get_config(g1_cfg_alias). + +t21(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g2_cfg_val = ct:get_config(g2_cfg), + g2_cfg_val = ct:get_config(g2_cfg_alias), + common1_val = ct:get_config(common1), + common2_val = ct:get_config(common2). + +t31(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g3_cfg_val = ct:get_config(g3_cfg), + g3_cfg_val = ct:get_config(g3_cfg_alias), + common2_val = ct:get_config(common2), + common2_val = ct:get_config(common2_alias). + +t41(_) -> + exit(should_be_skipped). + +t51(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias). + +t61(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g6_cfg_val = ct:get_config(g6_cfg), + g6_cfg_val = ct:get_config(g6_cfg_alias). + +t71(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g7_cfg_val = ct:get_config(g7_cfg), + g7_cfg_val = ct:get_config(g7_cfg_alias). + +t72(_) -> + suite_cfg_val = ct:get_config(suite_cfg), + g5_cfg_val = ct:get_config(g5_cfg), + g5_cfg_val = ct:get_config(g5_cfg_alias), + g7_cfg_val = ct:get_config(g7_cfg), + g7_cfg_val = ct:get_config(g7_cfg_alias), + t72_cfg_val = ct:get_config(t72_cfg). + +t81(_) -> + exit(should_be_skipped). + +t91(_) -> + exit(should_be_skipped). + +t101(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + +t111(_) -> + suite_cfg_val = ct:get_config(suite_cfg). + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_1_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_1_SUITE.erl new file mode 100644 index 0000000000..0a81edf729 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_1_SUITE.erl @@ -0,0 +1,191 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(group_timetrap_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +init_per_suite(Config) -> + ct:comment(io_lib:format("init( ~w ): ~p", [?MODULE, suite()])), + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + Info = case catch group(G) of {'EXIT',_} -> []; I -> I end, + ct:comment(io_lib:format("init( ~w ): ~p", [G, Info])), + Config. + +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("end( ~w )", [G])), + ok. + +init_per_testcase(TestCase, Config) -> + Info = case catch apply(?MODULE,TestCase,[]) of + {'EXIT',_} -> []; + I -> I + end, + ct:comment(io_lib:format("init( ~w ): ~p", [TestCase, Info])), + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +%%%------------------------------------------------------------------ +%%% TEST DECLARATIONS +%%%------------------------------------------------------------------ + +groups() -> + [{g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[{group,g4},t31,{group,g5}]}, + + {g4,[],[t41]}, + {g5,[],[t51]}, + + {g6,[],[t61]}, + {g7,[],[{group,g8},t71,{group,g9}]}, + + {g8,[],[t81]}, + {g9,[],[t91]}, + + {g10,[],[t101]}, + {g11,[],[t111]} + ]. + + +all() -> + [t1, + {group,g1}, + {group,g2}, + t2, + {group,g3}, + t3, + {group,g6}, + {group,g7}, + {group,g10}, + {group,g11} + ]. + +%%%----------------------------------------------------------------- +%%% INFO FUNCS +%%%----------------------------------------------------------------- + +suite() -> [{timetrap,1000}]. + +group(g1) -> [{timetrap,500}]; + +group(g2) -> [{timetrap,1500}]; + +group(g3) -> [{timetrap,500}]; + +group(g4) -> [{timetrap,250}]; + +group(g5) -> [{timetrap,1500}]; + +group(g6) -> [{timetrap,250}]; + +group(g7) -> [{timetrap,250}]; + +group(g8) -> [{timetrap,250}]; + +group(G) when G /= g11 -> []. + +t3() -> [{timetrap,250}]. + +t61() -> [{timetrap,500}]. + +t71() -> [{timetrap,500}]. + +t81() -> [{timetrap,750}]. + +t91() -> [{timetrap,250}]. + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +t1(_) -> + ct:sleep(3000), + exit(should_timeout). + +t11(_) -> + ct:sleep(750), + exit(should_timeout). + +t21(_) -> + ct:sleep(3000), + exit(should_timeout). + +t2(_) -> + ct:sleep(1250), + exit(should_timeout). + +t31(_) -> + ct:sleep(750), + exit(should_timeout). + +t41(_) -> + ct:sleep(350), + exit(should_timeout). + +t51(_) -> + ct:sleep(2000), + exit(should_timeout). + +t3(_) -> + ct:sleep(500), + exit(should_timeout). + +t61(_) -> + ct:sleep(750), + exit(should_timeout). + +t71(_) -> + ct:sleep(750), + exit(should_timeout). + +t81(_) -> + ct:sleep(1000), + exit(should_timeout). + +t91(_) -> + ct:sleep(350), + exit(should_timeout). + +t101(_) -> + ct:sleep(1500), + exit(should_timeout). + +t111(_) -> + ct:sleep(1500), + exit(should_timeout). + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_2_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_2_SUITE.erl new file mode 100644 index 0000000000..1ebe8bd510 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_2_SUITE.erl @@ -0,0 +1,184 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(group_timetrap_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + Info = case catch group(G) of {'EXIT',_} -> []; I -> I end, + ct:comment(io_lib:format("init( ~w ): ~p", [G, Info])), + Config. + +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + _GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("end( ~w )", [G])), + ok. + +init_per_testcase(TestCase, Config) -> + Info = case catch apply(?MODULE,TestCase,[]) of + {'EXIT',_} -> []; + I -> I + end, + ct:comment(io_lib:format("init( ~w ): ~p", [TestCase, Info])), + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +%%%------------------------------------------------------------------ +%%% TEST DECLARATIONS +%%%------------------------------------------------------------------ + +groups() -> + [{g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[{group,g4},t31,{group,g5}]}, + + {g4,[],[t41]}, + {g5,[],[t51]}, + + {g6,[],[t61]}, + {g7,[],[{group,g8},t71,{group,g9}]}, + + {g8,[],[t81]}, + {g9,[],[t91]}, + + {g10,[],[t101]}, + {g11,[],[t111]} + ]. + + +all() -> + [t1, + {group,g1}, + {group,g2}, + t2, + {group,g3}, + t3, + {group,g6}, + {group,g7}, + {group,g10}, + {group,g11} + ]. + +%%%----------------------------------------------------------------- +%%% INFO FUNCS +%%%----------------------------------------------------------------- + +suite() -> [{timetrap,1000}]. + +group(g1) -> [{timetrap,500}]; + +group(g2) -> [{timetrap,1500}]; + +group(g3) -> [{timetrap,500}]; + +group(g4) -> [{timetrap,250}]; + +group(g5) -> [{timetrap,1500}]; + +group(g6) -> [{timetrap,250}]; + +group(g7) -> [{timetrap,250}]; + +group(g8) -> [{timetrap,250}]; + +group(G) when G /= g11 -> []. + +t3() -> [{timetrap,250}]. + +t61() -> [{timetrap,500}]. + +t71() -> [{timetrap,500}]. + +t81() -> [{timetrap,750}]. + +t91() -> [{timetrap,250}]. + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +t1(_) -> + ct:sleep(3000), + exit(should_timeout). + +t11(_) -> + ct:sleep(750), + exit(should_timeout). + +t21(_) -> + ct:sleep(3000), + exit(should_timeout). + +t2(_) -> + ct:sleep(1250), + exit(should_timeout). + +t31(_) -> + ct:sleep(750), + exit(should_timeout). + +t41(_) -> + ct:sleep(350), + exit(should_timeout). + +t51(_) -> + ct:sleep(2000), + exit(should_timeout). + +t3(_) -> + ct:sleep(500), + exit(should_timeout). + +t61(_) -> + ct:sleep(750), + exit(should_timeout). + +t71(_) -> + ct:sleep(750), + exit(should_timeout). + +t81(_) -> + ct:sleep(1000), + exit(should_timeout). + +t91(_) -> + ct:sleep(350), + exit(should_timeout). + +t101(_) -> + ct:sleep(1500), + exit(should_timeout). + +t111(_) -> + ct:sleep(1500), + exit(should_timeout). + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_3_SUITE.erl b/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_3_SUITE.erl new file mode 100644 index 0000000000..66d29802e2 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/group_timetrap_3_SUITE.erl @@ -0,0 +1,171 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(group_timetrap_3_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + + +%%%----------------------------------------------------------------- +%%% CONFIG FUNCS +%%%----------------------------------------------------------------- + +init_per_testcase(TestCase, Config) -> + Info = case catch apply(?MODULE,TestCase,[]) of + {'EXIT',_} -> []; + I -> I + end, + ct:comment(io_lib:format("init( ~w ): ~p", [TestCase, Info])), + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +%%%------------------------------------------------------------------ +%%% TEST DECLARATIONS +%%%------------------------------------------------------------------ + +groups() -> + [{g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[{group,g4},t31,{group,g5}]}, + + {g4,[],[t41]}, + {g5,[],[t51]}, + + {g6,[],[t61]}, + {g7,[],[{group,g8},t71,{group,g9}]}, + + {g8,[],[t81]}, + {g9,[],[t91]}, + + {g10,[],[t101]}, + {g11,[],[t111]} + ]. + + +all() -> + [t1, + {group,g1}, + {group,g2}, + t2, + {group,g3}, + t3, + {group,g6}, + {group,g7}, + {group,g10}, + {group,g11} + ]. + +%%%----------------------------------------------------------------- +%%% INFO FUNCS +%%%----------------------------------------------------------------- + +suite() -> [{timetrap,1000}]. + +group(g1) -> [{timetrap,500}]; + +group(g2) -> [{timetrap,1500}]; + +group(g3) -> [{timetrap,500}]; + +group(g4) -> [{timetrap,250}]; + +group(g5) -> [{timetrap,1500}]; + +group(g6) -> [{timetrap,250}]; + +group(g7) -> [{timetrap,250}]; + +group(g8) -> [{timetrap,250}]; + +group(G) when G /= g11 -> []. + +t3() -> [{timetrap,250}]. + +t61() -> [{timetrap,500}]. + +t71() -> [{timetrap,500}]. + +t81() -> [{timetrap,750}]. + +t91() -> [{timetrap,250}]. + +%%%------------------------------------------------------------------ +%%% TEST CASES +%%%------------------------------------------------------------------ + +t1(_) -> + ct:sleep(3000), + exit(should_timeout). + +t11(_) -> + ct:sleep(750), + exit(should_timeout). + +t21(_) -> + ct:sleep(3000), + exit(should_timeout). + +t2(_) -> + ct:sleep(1250), + exit(should_timeout). + +t31(_) -> + ct:sleep(750), + exit(should_timeout). + +t41(_) -> + ct:sleep(350), + exit(should_timeout). + +t51(_) -> + ct:sleep(2000), + exit(should_timeout). + +t3(_) -> + ct:sleep(500), + exit(should_timeout). + +t61(_) -> + ct:sleep(750), + exit(should_timeout). + +t71(_) -> + ct:sleep(750), + exit(should_timeout). + +t81(_) -> + ct:sleep(1000), + exit(should_timeout). + +t91(_) -> + ct:sleep(350), + exit(should_timeout). + +t101(_) -> + ct:sleep(1500), + exit(should_timeout). + +t111(_) -> + ct:sleep(1500), + exit(should_timeout). + + diff --git a/lib/common_test/test/ct_group_info_SUITE_data/vars.cfg b/lib/common_test/test/ct_group_info_SUITE_data/vars.cfg new file mode 100644 index 0000000000..8a1960d121 --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE_data/vars.cfg @@ -0,0 +1,19 @@ +{suite_cfg,suite_cfg_val}. +{g1_cfg,g1_cfg_val}. +{g2_cfg,g2_cfg_val}. +{g3_cfg,g3_cfg_val}. +{g4_cfg,g4_cfg_val}. +{g5_cfg,g5_cfg_val}. +{g6_cfg,g6_cfg_val}. +{g7_cfg,g7_cfg_val}. +{g8_cfg,g8_cfg_val}. +{g9_cfg,g9_cfg_val}. +{g10_cfg,g10_cfg_val}. +{g11_cfg,g11_cfg_val}. + +{t72_cfg,t72_cfg_val}. +{t91_cfg,t91_cfg_val}. + +{common1,common1_val}. +{common2,common2_val}. +{common3,common3_val}. diff --git a/lib/common_test/test/ct_groups_spec_SUITE.erl b/lib/common_test/test/ct_groups_spec_SUITE.erl new file mode 100644 index 0000000000..5a6d5ac0ac --- /dev/null +++ b/lib/common_test/test/ct_groups_spec_SUITE.erl @@ -0,0 +1,586 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%%------------------------------------------------------------------- +%%% File: ct_groups_spec_SUITE +%%% +%%% Description: +%%% Test that overriding default group properties with group terms +%%% in all/0 and in test specifications works as expected. +%%% +%%%------------------------------------------------------------------- +-module(ct_groups_spec_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(eh, ct_test_support_eh). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Description: Since Common Test starts another Test Server +%% instance, the tests need to be performed on a separate node (or +%% there will be clashes with logging processes etc). +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config1 = ct_test_support:init_per_suite(Config), + Config1. + +end_per_suite(Config) -> + ct_test_support:end_per_suite(Config). + +init_per_testcase(TestCase, Config) -> + ct_test_support:init_per_testcase(TestCase, Config). + +end_per_testcase(TestCase, Config) -> + ct_test_support:end_per_testcase(TestCase, Config). + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> + [ + simple_group_opt, + simple_group_case_opt, + override_with_all, + override_with_spec + ]. + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +simple_group_opt(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "groups_spec_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite},{group,[g1,g5]}, + {label,simple_group_opt}], Config), + ok = execute(simple_group_opt, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +simple_group_case_opt(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "groups_spec_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite},{group,g5},{testcase,[t52,t54]}, + {label,simple_group_case_opt}], Config), + ok = execute(simple_group_case_opt, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +override_with_all(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Suite = filename:join(DataDir, "groups_spec_1_SUITE"), + {Opts,ERPid} = setup([{suite,Suite},{label,override_with_all}], Config), + ok = execute(override_with_all, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% +override_with_spec(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Spec = filename:join(DataDir, "override.spec"), + {Opts,ERPid} = setup([{spec,Spec},{label,override_with_spec}], Config), + ok = execute(override_with_spec, Opts, ERPid, Config). + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +setup(Test, Config) -> + Opts0 = ct_test_support:get_opts(Config), + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + Opts = Opts0 ++ [{event_handler,{?eh,EvHArgs}}|Test], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +execute(Name, Opts, ERPid, Config) -> + ok = ct_test_support:run(Opts, Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(Name, + reformat(Events, ?eh), + ?config(priv_dir, Config), + Opts), + + TestEvents = events_to_check(Name), + ct_test_support:verify_events(TestEvents, Events, Config). + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +events_to_check(Test) -> + %% 2 tests (ct:run_test + script_start) is default + events_to_check(Test, 2). + +events_to_check(_, 0) -> + []; +events_to_check(Test, N) -> + test_events(Test) ++ events_to_check(Test, N-1). + + +test_events(simple_group_opt) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,start_info,{1,1,7}}, + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_done,{groups_spec_1_SUITE,t13,ok}}, + {?eh,test_stats,{2,1,{0,0}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]},ok}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[]},ok}}, + + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t51}}, + {?eh,tc_done,{groups_spec_1_SUITE,t51,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t52}}, + {?eh,tc_done,{groups_spec_1_SUITE,t52,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t53}}, + {?eh,tc_done,{groups_spec_1_SUITE,t53,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t54}}, + {?eh,tc_done,{groups_spec_1_SUITE,t54,ok}}, + {?eh,test_stats,{4,3,{0,0}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[]},ok}}], + + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(simple_group_case_opt) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,start_info,{1,1,2}}, + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]},ok}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[]},ok}}, + + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t52}}, + {?eh,tc_done,{groups_spec_1_SUITE,t52,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t54}}, + {?eh,tc_done,{groups_spec_1_SUITE,t54,ok}}, + {?eh,test_stats,{1,1,{0,0}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[]},ok}}], + + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(override_with_all) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,start_info,{1,1,45}}, + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + + %% TEST: {group,g1,default} + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_done,{groups_spec_1_SUITE,t13,ok}}, + {?eh,test_stats,{2,1,{0,0}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[]},ok}}], + + %% TEST: {group,g1,[sequence]} + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t13,{failed,{groups_spec_1_SUITE,t12}}}}, + {?eh,test_stats,{3,2,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[sequence]},ok}}], + + %% TEST: {group,g1,[parallel],[]} + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t11}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t12}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t13}}, + {?eh,tc_done,{groups_spec_1_SUITE,t13,ok}}, + {?eh,test_stats,{5,3,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[parallel]},ok}}]}, + + %% TEST: {group,g2,[],[]} + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t21,ok}}, + {?eh,test_stats,{6,3,{0,1}}}, + + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g3,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g3,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t31}}, + {?eh,tc_done,{groups_spec_1_SUITE,t31,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t32}}, + {?eh,tc_done,{groups_spec_1_SUITE,t32,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t33}}, + {?eh,tc_done,{groups_spec_1_SUITE,t33,ok}}, + {?eh,test_stats,{8,4,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g3,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g3,[parallel]},ok}}]}, + + {?eh,tc_done,{groups_spec_1_SUITE,t22,{failed,{error,crashes}}}}, + {?eh,test_stats,{8,5,{0,1}}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t41,ok}}, + {?eh,test_stats,{9,5,{0,1}}}, + + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t51}}, + {?eh,tc_done,{groups_spec_1_SUITE,t51,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t52}}, + {?eh,tc_done,{groups_spec_1_SUITE,t52,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t53}}, + {?eh,tc_done,{groups_spec_1_SUITE,t53,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t54}}, + {?eh,tc_done,{groups_spec_1_SUITE,t54,ok}}, + {?eh,test_stats,{11,7,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]},ok}}]}, + + {?eh,tc_done,{groups_spec_1_SUITE,t42,{failed,{error,crashes}}}}, + {?eh,test_stats,{11,8,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,t23,ok}}, + {?eh,test_stats,{12,8,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[]},ok}}], + + %% TEST: {group,g2,default,[{g3,[sequence]}]} + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t21,ok}}, + {?eh,test_stats,{13,8,{0,1}}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t31,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t32,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t33,{failed,{groups_spec_1_SUITE,t32}}}}, + {?eh,test_stats,{14,9,{0,2}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,t22,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t41,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t51,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t52,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t53,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t54,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t42,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t23,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,test_stats,{14,10,{0,9}}}, + + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]},ok}}], + + %% TEST: {group,g2,[],[{g4,[sequence],[{g5,[sequence]}]},{g3,[sequence]}]} + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t21,ok}}, + {?eh,test_stats,{15,10,{0,9}}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t31,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t32,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t33,{failed,{groups_spec_1_SUITE,t32}}}}, + {?eh,test_stats,{16,11,{0,10}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,t22,{failed,{error,crashes}}}}, + {?eh,test_stats,{16,12,{0,10}}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t41,ok}}, + {?eh,test_stats,{17,12,{0,10}}}, + + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t51,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t52,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t53,{failed,{groups_spec_1_SUITE,t52}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t54,{failed,{groups_spec_1_SUITE,t52}}}}, + {?eh,test_stats,{18,13,{0,12}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[sequence]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,t42,{failed,{error,crashes}}}}, + {?eh,test_stats,{18,14,{0,12}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[sequence]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,t23,ok}}, + {?eh,test_stats,{19,14,{0,12}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[]},ok}}], + + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(override_with_spec) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,start_info,{7,4,49}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, {g1,default}}. + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_done,{groups_spec_1_SUITE,t13,ok}}, + {?eh,test_stats,{2,1,{0,0}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, [{g1,[sequence]}, + %% {g1,[parallel],[]}]}. + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t13,{failed,{groups_spec_1_SUITE,t12}}}}, + {?eh,test_stats,{3,2,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[sequence]},ok}}], + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t11}}, + {?eh,tc_done,{groups_spec_1_SUITE,t11,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t12}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t13}}, + {?eh,tc_done,{groups_spec_1_SUITE,t13,ok}}, + {?eh,test_stats,{5,3,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[parallel]},ok}}]}, + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, {g2,[],[]}}. + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t21}}, + {?eh,test_stats,{6,3,{0,1}}}, + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g3,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g3,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t31}}, + {?eh,tc_done,{groups_spec_1_SUITE,t31,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t32}}, + {?eh,tc_done,{groups_spec_1_SUITE,t32,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t33}}, + {?eh,tc_done,{groups_spec_1_SUITE,t33,ok}}, + {?eh,test_stats,{8,4,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g3,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g3,[parallel]},ok}}]}, + {?eh,tc_done,{groups_spec_1_SUITE,t22,{failed,{error,crashes}}}}, + {?eh,test_stats,{8,5,{0,1}}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t41,ok}}, + {?eh,test_stats,{9,5,{0,1}}}, + {parallel, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[parallel]},ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t51}}, + {?eh,tc_done,{groups_spec_1_SUITE,t51,ok}}, + {?eh,tc_start,{groups_spec_1_SUITE,t52}}, + {?eh,tc_done,{groups_spec_1_SUITE,t52,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t53}}, + {?eh,tc_done,{groups_spec_1_SUITE,t53,{failed,{error,crashes}}}}, + {?eh,tc_start,{groups_spec_1_SUITE,t54}}, + {?eh,tc_done,{groups_spec_1_SUITE,t54,ok}}, + {?eh,test_stats,{11,7,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[parallel]},ok}}]}, + {?eh,tc_done,{groups_spec_1_SUITE,t42,{failed,{error,crashes}}}}, + {?eh,test_stats,{11,8,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,t23,ok}}, + {?eh,test_stats,{12,8,{0,1}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, {g2,default,[{g3,[sequence]}]}} + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t21,ok}}, + {?eh,test_stats,{13,8,{0,1}}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t31,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t32,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t33,{failed,{groups_spec_1_SUITE,t32}}}}, + {?eh,test_stats,{14,9,{0,2}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,t22,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t41,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t51,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t52,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t53,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t54,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t42,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t23,{failed,{groups_spec_1_SUITE,t22}}}}, + {?eh,test_stats,{14,10,{0,9}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, + %% {g2,[],[{g4,[sequence],[{g5,[sequence]}]},{g3,[sequence]}]}}. + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t21,ok}}, + {?eh,test_stats,{15,10,{0,9}}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g3,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t31,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t32,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t33,{failed,{groups_spec_1_SUITE,t32}}}}, + {?eh,test_stats,{16,11,{0,10}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g3,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,t22,{failed,{error,crashes}}}}, + {?eh,test_stats,{16,12,{0,10}}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t41,ok}}, + {?eh,test_stats,{17,12,{0,10}}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t51,ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t52,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t53,{failed,{groups_spec_1_SUITE,t52}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t54,{failed,{groups_spec_1_SUITE,t52}}}}, + {?eh,test_stats,{18,13,{0,12}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,t42,{failed,{error,crashes}}}}, + {?eh,test_stats,{18,14,{0,12}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,t23,ok}}, + {?eh,test_stats,{19,14,{0,12}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, {g1,[sequence]}, {cases,[t12,t13]}} + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g1,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g1,[sequence]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t12,{failed,{error,crashes}}}}, + {?eh,tc_auto_skip,{groups_spec_1_SUITE,t13,{failed,{groups_spec_1_SUITE,t12}}}}, + {?eh,test_stats,{19,15,{0,13}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g1,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g1,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + %% TEST: {groups, dir, groups_spec_1_SUITE, {g5,[]}, {cases,[t53,t54]}} + {?eh,tc_done,{groups_spec_1_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g2,[sequence]},ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g4,[]},ok}}, + [{?eh,tc_start,{groups_spec_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_done,{groups_spec_1_SUITE,t53,{failed,{error,crashes}}}}, + {?eh,tc_done,{groups_spec_1_SUITE,t54,ok}}, + {?eh,test_stats,{20,16,{0,13}}}, + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g5,[]},ok}}], + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g4,[]},ok}}], + {?eh,tc_start,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]}}}, + {?eh,tc_done,{groups_spec_1_SUITE,{end_per_group,g2,[sequence]},ok}}], + {?eh,tc_done,{groups_spec_1_SUITE,end_per_suite,ok}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. + diff --git a/lib/common_test/test/ct_groups_spec_SUITE_data/groups_spec_1_SUITE.erl b/lib/common_test/test/ct_groups_spec_SUITE_data/groups_spec_1_SUITE.erl new file mode 100644 index 0000000000..ae6065bae4 --- /dev/null +++ b/lib/common_test/test/ct_groups_spec_SUITE_data/groups_spec_1_SUITE.erl @@ -0,0 +1,124 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(groups_spec_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% INFO FUNCS +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,1000}]. + +group(_) -> + [{timetrap,2000}]. + +%%-------------------------------------------------------------------- +%% CONFIG FUNCS +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("init( ~w ): ~p", [G, GrProps1])), + ct:pal("init( ~w ): ~p", [G, GrProps1]), + Config. + +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("end( ~w ): ~p", [G, GrProps1])), + ct:pal("end( ~w ): ~p", [G, GrProps1]), + ok. + +init_per_testcase(_TestCase, Config) -> + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% TEST DECLARATIONS +%%-------------------------------------------------------------------- + +groups() -> + [ + {g1,[],[t11,t12,t13]}, + {g2,[sequence],[t21,{group,g3},t22,{group,g4},t23]}, + {g3,[parallel],[t31,t32,t33]}, + {g4,[],[t41,{group,g5},t42]}, + {g5,[parallel],[t51,t52,t53,t54]} + ]. + +all() -> + [ + {group,g1,default}, + {group,g1,[sequence]}, + {group,g1,[parallel],[]}, + + {group,g2,[],[]}, + {group,g2,default,[{g3,[sequence]}]}, + {group,g2,[],[{g4,[sequence],[{g5,[sequence]}]},{g3,[sequence]}]} + ]. + +%%----------------------------------------------------------------- +%% TEST CASES +%%----------------------------------------------------------------- + +t11(_) -> + ok. +t12(_) -> + exit(crashes). +t13(_) -> + ok. + +t21(_) -> + ok. +t22(_) -> + exit(crashes). +t23(_) -> + ok. + +t31(_) -> + ok. +t32(_) -> + exit(crashes). +t33(_) -> + ok. + +t41(_) -> + ok. +t42(_) -> + exit(crashes). + +t51(_) -> + ok. +t52(_) -> + ct:sleep(3000). +t53(_) -> + exit(crashes). +t54(_) -> + ok. diff --git a/lib/common_test/test/ct_groups_spec_SUITE_data/override.spec b/lib/common_test/test/ct_groups_spec_SUITE_data/override.spec new file mode 100644 index 0000000000..1bfc6405c9 --- /dev/null +++ b/lib/common_test/test/ct_groups_spec_SUITE_data/override.spec @@ -0,0 +1,15 @@ +{merge_tests,false}. + +{alias,dir,"."}. + +{groups, dir, groups_spec_1_SUITE, {g1,default}}. +{groups, dir, groups_spec_1_SUITE, [{g1,[sequence]}, + {g1,[parallel],[]}]}. + +{groups, dir, groups_spec_1_SUITE, {g2,[],[]}}. +{groups, dir, groups_spec_1_SUITE, {g2,default,[{g3,[sequence]}]}}. +{groups, dir, groups_spec_1_SUITE, {g2,[],[{g4,[sequence],[{g5,[sequence]}]}, + {g3,[sequence]}]}}. + +{groups, dir, groups_spec_1_SUITE, {g1,[sequence]}, {cases,[t12,t13]}}. +{groups, dir, groups_spec_1_SUITE, {g5,[]}, {cases,[t53,t54]}}. 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 940d791b15..2392b0b850 100644 --- a/lib/common_test/test/ct_groups_test_2_SUITE.erl +++ b/lib/common_test/test/ct_groups_test_2_SUITE.erl @@ -171,16 +171,16 @@ test_events(missing_conf) -> {?eh,start_logging,{'DEF','RUNDIR'}}, {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, {?eh,start_info,{1,1,2}}, - {?eh,tc_start,{ct_framework,ct_init_per_group}}, - {?eh,tc_done,{ct_framework,ct_init_per_group,ok}}, + {?eh,tc_start,{ct_framework,{ct_init_per_group,group1,[]}}}, + {?eh,tc_done,{ct_framework,{ct_init_per_group,group1,[]},ok}}, {?eh,tc_start,{missing_conf_SUITE,tc1}}, {?eh,tc_done,{missing_conf_SUITE,tc1,ok}}, {?eh,test_stats,{1,0,{0,0}}}, {?eh,tc_start,{missing_conf_SUITE,tc2}}, {?eh,tc_done,{missing_conf_SUITE,tc2,ok}}, {?eh,test_stats,{2,0,{0,0}}}, - {?eh,tc_start,{ct_framework,ct_end_per_group}}, - {?eh,tc_done,{ct_framework,ct_end_per_group,ok}}, + {?eh,tc_start,{ct_framework,{ct_end_per_group,group1,[]}}}, + {?eh,tc_done,{ct_framework,{ct_end_per_group,group1,[]},ok}}, {?eh,test_done,{'DEF','STOP_TIME'}}, {?eh,stop_logging,[]} ]; diff --git a/lib/common_test/test/ct_repeat_1_SUITE_data/repeat_1_SUITE.erl b/lib/common_test/test/ct_repeat_1_SUITE_data/repeat_1_SUITE.erl index fb8d31edd4..4c5b880e39 100644 --- a/lib/common_test/test/ct_repeat_1_SUITE_data/repeat_1_SUITE.erl +++ b/lib/common_test/test/ct_repeat_1_SUITE_data/repeat_1_SUITE.erl @@ -1,11 +1,21 @@ -%%%------------------------------------------------------------------- -%%% @author Peter Andersson <[email protected]> -%%% @copyright (C) 2010, Peter Andersson -%%% @doc -%%% -%%% @end -%%% Created : 11 Aug 2010 by Peter Andersson <[email protected]> -%%%------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% -module(repeat_1_SUITE). -compile(export_all). diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE.erl index 4471915e69..efc0309781 100644 --- a/lib/common_test/test/ct_test_server_if_1_SUITE.erl +++ b/lib/common_test/test/ct_test_server_if_1_SUITE.erl @@ -228,39 +228,39 @@ test_events(ts_if_1) -> {failed,{error,{suite0_failed,{exited,suite0_goes_boom}}}}}}, {?eh,tc_start,{ct_framework,error_in_suite}}, - {?eh,test_stats,{3,6,{3,7}}}, + {?eh,test_stats,{3,5,{4,7}}}, {?eh,tc_start,{ct_framework,error_in_suite}}, - {?eh,test_stats,{3,7,{3,7}}}, + {?eh,test_stats,{3,5,{5,7}}}, {?eh,tc_start,{ts_if_5_SUITE,init_per_suite}}, {?eh,tc_done,{ts_if_5_SUITE,init_per_suite, {skipped,{require_failed_in_suite0,{not_available,undef_variable}}}}}, {?eh,tc_auto_skip,{ts_if_5_SUITE,my_test_case, {require_failed_in_suite0,{not_available,undef_variable}}}}, - {?eh,test_stats,{3,7,{3,8}}}, + {?eh,test_stats,{3,5,{5,8}}}, {?eh,tc_auto_skip,{ts_if_5_SUITE,end_per_suite, {require_failed_in_suite0,{not_available,undef_variable}}}}, {?eh,tc_start,{ts_if_6_SUITE,tc1}}, {?eh,tc_done,{ts_if_6_SUITE,tc1,{failed,{error,{suite0_failed,{exited,suite0_byebye}}}}}}, - {?eh,test_stats,{3,7,{4,8}}}, + {?eh,test_stats,{3,5,{6,8}}}, {?eh,tc_start,{ts_if_7_SUITE,tc1}}, {?eh,tc_done,{ts_if_7_SUITE,tc1,ok}}, - {?eh,test_stats,{4,7,{4,8}}}, + {?eh,test_stats,{4,5,{6,8}}}, {?eh,tc_start,{ts_if_8_SUITE,tc1}}, {?eh,tc_done,{ts_if_8_SUITE,tc1,{failed,{error,failed_on_purpose}}}}, - {?eh,test_stats,{4,8,{4,8}}}, + {?eh,test_stats,{4,6,{6,8}}}, {?eh,tc_user_skip,{skipped_by_spec_1_SUITE,all,"should be skipped"}}, - {?eh,test_stats,{4,8,{5,8}}}, + {?eh,test_stats,{4,6,{7,8}}}, {?eh,tc_start,{skipped_by_spec_2_SUITE,init_per_suite}}, {?eh,tc_done,{skipped_by_spec_2_SUITE,init_per_suite,ok}}, {?eh,tc_user_skip,{skipped_by_spec_2_SUITE,tc1,"should be skipped"}}, - {?eh,test_stats,{4,8,{6,8}}}, + {?eh,test_stats,{4,6,{8,8}}}, {?eh,tc_start,{skipped_by_spec_2_SUITE,end_per_suite}}, {?eh,tc_done,{skipped_by_spec_2_SUITE,end_per_suite,ok}}, diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index 98a2e21e21..51754cb3b4 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -36,7 +36,8 @@ -export([capture_start/0,capture_stop/0,capture_get/0]). -export([messages_get/0]). -export([hours/1,minutes/1,seconds/1,sleep/1,adjusted_sleep/1,timecall/3]). --export([timetrap_scale_factor/0,timetrap/1,timetrap_cancel/1,timetrap_cancel/0]). +-export([timetrap_scale_factor/0,timetrap/1,get_timetrap_info/0, + timetrap_cancel/1,timetrap_cancel/0]). -export([m_out_of_n/3,do_times/4,do_times/2]). -export([call_crash/3,call_crash/4,call_crash/5]). -export([temp_name/1]). @@ -1139,7 +1140,7 @@ run_test_case_eval(Mod, Func, Args0, Name, Ref, RunInit, {auto_skip,Reason} -> Where = {Mod,Func}, NewResult = do_end_tc_call(Mod,Func, Where, {{skip,Reason},Args0}, - {skip,{fw_auto_skip,Reason}}), + {skip,Reason}), {{0,NewResult},Where,[]} end, exit({Ref,Time,Value,Loc,Opts}). @@ -1257,11 +1258,15 @@ run_test_case_eval1(Mod, Func, Args, Name, RunInit, TCCallback) -> end. do_end_tc_call(M,F, Loc, Res, Return) -> + IsSuite = case lists:reverse(atom_to_list(M)) of + [$E,$T,$I,$U,$S,$_|_] -> true; + _ -> false + end, FwMod = os:getenv("TEST_SERVER_FRAMEWORK"), {Mod,Func} = if FwMod == M ; FwMod == "undefined"; FwMod == false -> {M,F}; - is_list(Loc) and (length(Loc)>1) -> + (not IsSuite) and is_list(Loc) and (length(Loc)>1) -> %% If failure in other module (M) than suite, try locate %% suite name in Loc list and call end_tc with Suite:TestCase %% instead of M:F. @@ -1524,7 +1529,10 @@ get_loc(Pid) -> process_info(Pid, [current_stacktrace,dictionary]), lists:foreach(fun({Key,Val}) -> put(Key, Val) end, Dict), Stk = [rewrite_loc_item(Loc) || Loc <- Stk0], - put(test_server_loc, Stk), + case get(test_server_loc) of + undefined -> put(test_server_loc, Stk); + _ -> ok + end, get_loc(). %% find the latest known Suite:Testcase @@ -1856,7 +1864,9 @@ fail() -> break(Comment) -> case erase(test_server_timetraps) of undefined -> ok; - List -> lists:foreach(fun({Ref,_}) -> timetrap_cancel(Ref) end, List) + List -> lists:foreach(fun({Ref,_,_}) -> + timetrap_cancel(Ref) + end, List) end, io:format(user, "\n\n\n--- SEMIAUTOMATIC TESTING ---" @@ -1945,8 +1955,8 @@ timetrap1(Timeout, Scale) -> TCPid = self(), Ref = spawn_link(test_server_sup,timetrap,[Timeout,Scale,TCPid]), case get(test_server_timetraps) of - undefined -> put(test_server_timetraps,[{Ref,TCPid}]); - List -> put(test_server_timetraps,[{Ref,TCPid}|List]) + undefined -> put(test_server_timetraps,[{Ref,TCPid,{Timeout,Scale}}]); + List -> put(test_server_timetraps,[{Ref,TCPid,{Timeout,Scale}}|List]) end, Ref. @@ -2057,7 +2067,7 @@ timetrap_cancel(infinity) -> timetrap_cancel(Handle) -> case get(test_server_timetraps) of undefined -> ok; - [{Handle,_}] -> erase(test_server_timetraps); + [{Handle,_,_}] -> erase(test_server_timetraps); Timers -> put(test_server_timetraps, lists:keydelete(Handle, 1, Timers)) end, @@ -2073,13 +2083,30 @@ timetrap_cancel() -> ok; Timers -> case lists:keysearch(self(), 2, Timers) of - {value,{Handle,_}} -> + {value,{Handle,_,_}} -> timetrap_cancel(Handle); _ -> ok end end. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% get_timetrap_info() -> {Timeout,Scale} | undefined +%% +%% Read timetrap info for current test case +get_timetrap_info() -> + case get(test_server_timetraps) of + undefined -> + undefined; + Timers -> + case lists:keysearch(self(), 2, Timers) of + {value,{_,_,Info}} -> + Info; + _ -> + undefined + end + end. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% hours(N) -> Milliseconds %% minutes(N) -> Milliseconds diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 70422adccd..3432b3bc8e 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -1826,18 +1826,27 @@ start_log_file() -> exit({cant_create_log_dir,{MkDirError,Dir}}) end, TestDir = timestamp_filename_get(filename:join(Dir, "run.")), - case file:make_dir(TestDir) of - ok -> - ok; - MkDirError2 -> - exit({cant_create_log_dir,{MkDirError2,TestDir}}) - end, - - ok = file:write_file(filename:join(Dir, ?last_file), TestDir ++ "\n"), - ok = file:write_file(?last_file, TestDir ++ "\n"), - - put(test_server_log_dir_base,TestDir), - MajorName = filename:join(TestDir, ?suitelog_name), + TestDir1 = + case file:make_dir(TestDir) of + ok -> + TestDir; + {error,eexist} -> + timer:sleep(1000), + %% we need min 1 second between timestamps unfortunately + TestDirX = timestamp_filename_get(filename:join(Dir, "run.")), + case file:make_dir(TestDirX) of + ok -> + TestDirX; + MkDirError2 -> + exit({cant_create_log_dir,{MkDirError2,TestDirX}}) + end; + MkDirError2 -> + exit({cant_create_log_dir,{MkDirError2,TestDir}}) + end, + ok = file:write_file(filename:join(Dir, ?last_file), TestDir1 ++ "\n"), + ok = file:write_file(?last_file, TestDir1 ++ "\n"), + put(test_server_log_dir_base,TestDir1), + MajorName = filename:join(TestDir1, ?suitelog_name), HtmlName = MajorName ++ ?html_ext, {ok,Major} = file:open(MajorName, [write]), {ok,Html} = file:open(HtmlName, [write]), @@ -1850,14 +1859,14 @@ start_log_file() -> make_html_link(LinkName ++ ?html_ext, HtmlName, filename:basename(Dir)), - PrivDir = filename:join(TestDir, ?priv_dir), + PrivDir = filename:join(TestDir1, ?priv_dir), ok = file:make_dir(PrivDir), put(test_server_priv_dir,PrivDir++"/"), print_timestamp(13,"Suite started at "), - LogInfo = [{topdir,Dir},{rundir,lists:flatten(TestDir)}], + LogInfo = [{topdir,Dir},{rundir,lists:flatten(TestDir1)}], test_server_sup:framework_call(report, [loginfo,LogInfo]), - {ok,TestDir}. + {ok,TestDir1}. make_html_link(LinkName, Target, Explanation) -> %% if possible use a relative reference to Target. @@ -2725,23 +2734,32 @@ run_test_cases_loop([{conf,Ref,Props,{Mod,Func}}|_Cases]=Cs0, "(configuration case ~w)", [What]); (_) -> ok end, - CfgProps = if StartConf -> if Shuffle == undefined -> [{tc_group_properties,Props}]; true -> - [{tc_group_properties,[Shuffle|delete_shuffle(Props)]}] + [{tc_group_properties, + [Shuffle|delete_shuffle(Props)]}] end; not StartConf -> {TcOk,TcSkip,TcFail} = get_tc_results(Status1), [{tc_group_properties,get_props(Mode0)}, - {tc_group_result,[{ok,TcOk},{skipped,TcSkip},{failed,TcFail}]}] + {tc_group_result,[{ok,TcOk}, + {skipped,TcSkip}, + {failed,TcFail}]}] end, - ActualCfg = - update_config(hd(Config), [{priv_dir,get(test_server_priv_dir)}, - {data_dir,get_data_dir(Mod)}] ++ CfgProps), + TSDirs = [{priv_dir,get(test_server_priv_dir)},{data_dir,get_data_dir(Mod)}], + ActualCfg = + if not StartConf -> + update_config(hd(Config), TSDirs ++ CfgProps); + true -> + GroupPath = lists:flatmap(fun({_Ref,[],_T}) -> []; + ({_Ref,GrProps,_T}) -> [GrProps] + end, Mode0), + update_config(hd(Config), + TSDirs ++ [{tc_group_path,GroupPath} | CfgProps]) + end, CurrMode = curr_mode(Ref, Mode0, Mode), - ConfCaseResult = run_test_case(Ref, 0, Mod, Func, [ActualCfg], skip_init, target, TimetrapData, CurrMode), |