diff options
Diffstat (limited to 'lib/common_test')
9 files changed, 1809 insertions, 0 deletions
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_info_SUITE.erl b/lib/common_test/test/ct_config_info_SUITE.erl new file mode 100644 index 0000000000..df8fff7701 --- /dev/null +++ b/lib/common_test/test/ct_config_info_SUITE.erl @@ -0,0 +1,123 @@ +%% +%% %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: +%%% +%%% Description: +%%% +%%%------------------------------------------------------------------- +-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() -> + [ + timetrap_all, + timetrap_group, + timetrap_group_case, + require, + require_default + ]. + +%%-------------------------------------------------------------------- +%% 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). + +%%%----------------------------------------------------------------- +%%% 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) -> + [ + ]; 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..2ad908e5fc --- /dev/null +++ b/lib/common_test/test/ct_group_info_SUITE.erl @@ -0,0 +1,489 @@ +%% +%% %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, + require, + require_default + ]. + +%%-------------------------------------------------------------------- +%% 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). + +%%%----------------------------------------------------------------- +%%% +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). + + +%%%----------------------------------------------------------------- +%%% 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(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, + {fw_auto_skip, + {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, + {fw_auto_skip,{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, + {fw_auto_skip,{require_failed,{not_available,non_existing}}}}}, + {?eh,test_stats,{8,0,{0,2}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {fw_auto_skip,{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, + {fw_auto_skip,{require_failed,{not_available,common3}}}}}, + {?eh,test_stats,{4,0,{0,1}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {fw_auto_skip,{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, + {fw_auto_skip,{require_failed,{not_available,non_existing}}}}}, + {?eh,test_stats,{8,0,{0,2}}}, + {?eh,tc_auto_skip,{group_require_1_SUITE,end_per_group, + {fw_auto_skip,{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,[]} + ]. 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_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/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]}}. |