diff options
Diffstat (limited to 'lib/common_test/test')
61 files changed, 11418 insertions, 0 deletions
diff --git a/lib/common_test/test/Makefile b/lib/common_test/test/Makefile new file mode 100644 index 0000000000..35ba22aa59 --- /dev/null +++ b/lib/common_test/test/Makefile @@ -0,0 +1,94 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2008-2010. 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% +# + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES= \ + ct_test_support \ + ct_test_support_eh \ + ct_smoke_test_SUITE \ + ct_event_handler_SUITE \ + ct_groups_test_1_SUITE \ + ct_groups_test_2_SUITE \ + ct_skip_SUITE \ + ct_error_SUITE \ + ct_test_server_if_1_SUITE + +ERL_FILES= $(MODULES:%=%.erl) + +TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +INSTALL_PROGS= $(TARGET_FILES) + +EMAKEFILE=Emakefile +COVERFILE= + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/common_test_test + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + +ERL_MAKE_FLAGS += -pa $(ERL_TOP)/lib/test_server/ebin +ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include + +EBIN = . + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +#.PHONY: make_emakefile + +#make_emakefile: +# $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) \ +# '*_SUITE_make' > $(EMAKEFILE) +# $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES)\ +# >> $(EMAKEFILE) + +tests debug opt: + +clean: + rm -f $(TARGET_FILES) + rm -f core + +docs: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + +release_tests_spec: + $(INSTALL_DIR) $(RELSYSDIR) + $(INSTALL_DATA) $(ERL_FILES) $(COVERFILE) $(RELSYSDIR) + $(INSTALL_PROGRAM) common_test.spec $(RELSYSDIR) + chmod -f -R u+w $(RELSYSDIR) + @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) + +release_docs_spec: diff --git a/lib/common_test/test/common_test.spec b/lib/common_test/test/common_test.spec new file mode 100644 index 0000000000..7619a75b31 --- /dev/null +++ b/lib/common_test/test/common_test.spec @@ -0,0 +1 @@ +{topcase, {dir, "../common_test"}}. diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl new file mode 100644 index 0000000000..be75d768fc --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE.erl @@ -0,0 +1,558 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_error_SUITE +%%% +%%% Description: +%%% Test various errors in Common Test suites. +%%% +%%% The suites used for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_error_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.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). + +all(doc) -> + [""]; + +all(suite) -> + [ + cfg_error, + lib_error, + no_compile + ]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +cfg_error(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Join = fun(D, S) -> filename:join(D, "error/test/"++S) end, + Suites = [Join(DataDir, "cfg_error_1_SUITE"), + Join(DataDir, "cfg_error_2_SUITE"), + Join(DataDir, "cfg_error_3_SUITE"), + Join(DataDir, "cfg_error_4_SUITE"), + Join(DataDir, "cfg_error_5_SUITE"), + Join(DataDir, "cfg_error_6_SUITE"), + Join(DataDir, "cfg_error_7_SUITE"), + Join(DataDir, "cfg_error_8_SUITE"), + Join(DataDir, "cfg_error_9_SUITE") + ], + {Opts,ERPid} = setup({suite,Suites}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(cfg_error, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(cfg_error), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% +lib_error(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Join = fun(D, S) -> filename:join(D, "error/test/"++S) end, + Suites = [Join(DataDir, "lib_error_1_SUITE")], + {Opts,ERPid} = setup({suite,Suites}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(lib_error, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(lib_error), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% +no_compile(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Join = fun(D, S) -> filename:join(D, "error/test/"++S) end, + Suites = [Join(DataDir, "no_compile_SUITE")], + {Opts,ERPid} = setup({suite,Suites}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(no_compile, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(no_compile), + ok = ct_test_support:verify_events(TestEvents, Events, 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 ++ [Test,{event_handler,{?eh,EvHArgs}}], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). +%reformat(Events, _EH) -> +% Events. + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +test_events(cfg_error) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{9,9,33}}, + + {?eh,tc_start,{cfg_error_1_SUITE,init_per_suite}}, + {?eh,tc_done, + {cfg_error_1_SUITE,init_per_suite,{failed,{error,init_per_suite_fails}}}}, + {?eh,tc_auto_skip, + {cfg_error_1_SUITE,tc1,{failed,{cfg_error_1_SUITE,init_per_suite, + {'EXIT',init_per_suite_fails}}}}}, + {?eh,test_stats,{0,0,{0,1}}}, + {?eh,tc_auto_skip, + {cfg_error_1_SUITE,tc2,{failed,{cfg_error_1_SUITE,init_per_suite, + {'EXIT',init_per_suite_fails}}}}}, + {?eh,test_stats,{0,0,{0,2}}}, + {?eh,tc_auto_skip, + {cfg_error_1_SUITE,end_per_suite,{failed,{cfg_error_1_SUITE,init_per_suite, + {'EXIT',init_per_suite_fails}}}}}, + + {?eh,tc_start,{cfg_error_2_SUITE,init_per_suite}}, + {?eh,tc_done, + {cfg_error_2_SUITE,init_per_suite, + {failed,{error,{{badmatch,[1,2]}, + [{cfg_error_2_SUITE,init_per_suite,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}, + {?eh,tc_auto_skip, + {cfg_error_2_SUITE,tc1, + {failed,{cfg_error_2_SUITE,init_per_suite, + {'EXIT',{{badmatch,[1,2]}, + [{cfg_error_2_SUITE,init_per_suite,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}, + {?eh,test_stats,{0,0,{0,3}}}, + {?eh,tc_auto_skip, + {cfg_error_2_SUITE,tc2, + {failed,{cfg_error_2_SUITE,init_per_suite, + {'EXIT',{{badmatch,[1,2]}, + [{cfg_error_2_SUITE,init_per_suite,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}, + {?eh,test_stats,{0,0,{0,4}}}, + {?eh,tc_auto_skip, + {cfg_error_2_SUITE,end_per_suite, + {failed,{cfg_error_2_SUITE,init_per_suite, + {'EXIT',{{badmatch,[1,2]}, + [{cfg_error_2_SUITE,init_per_suite,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}, + + {?eh,tc_start,{cfg_error_3_SUITE,init_per_suite}}, + {?eh,tc_done, + {cfg_error_3_SUITE,init_per_suite,{failed,{timetrap_timeout,2000}}}}, + {?eh,tc_auto_skip, + {cfg_error_3_SUITE,tc1, + {failed,{cfg_error_3_SUITE,init_per_suite,{timetrap_timeout,2000}}}}}, + {?eh,test_stats,{0,0,{0,5}}}, + {?eh,tc_auto_skip, + {cfg_error_3_SUITE,tc2, + {failed,{cfg_error_3_SUITE,init_per_suite,{timetrap_timeout,2000}}}}}, + {?eh,test_stats,{0,0,{0,6}}}, + {?eh,tc_auto_skip, + {cfg_error_3_SUITE,end_per_suite, + {failed,{cfg_error_3_SUITE,init_per_suite,{timetrap_timeout,2000}}}}}, + + {?eh,tc_start,{cfg_error_4_SUITE,init_per_suite}}, + {?eh,tc_done,{cfg_error_4_SUITE,init_per_suite,ok}}, + {?eh,tc_auto_skip, + {cfg_error_4_SUITE,tc1, + {failed,{cfg_error_4_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{0,0,{0,7}}}, + {?eh,tc_auto_skip, + {cfg_error_4_SUITE,tc2, + {failed,{cfg_error_4_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{0,0,{0,8}}}, + {?eh,tc_auto_skip, + {cfg_error_4_SUITE,end_per_suite, + {failed,{cfg_error_4_SUITE,init_per_suite,bad_return}}}}, + + {?eh,tc_start,{cfg_error_5_SUITE,init_per_suite}}, + {?eh,tc_done,{cfg_error_5_SUITE,init_per_suite,ok}}, + {?eh,tc_auto_skip, + {cfg_error_5_SUITE,tc1, + {failed,{cfg_error_5_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{0,0,{0,9}}}, + {?eh,tc_auto_skip, + {cfg_error_5_SUITE,tc2, + {failed,{cfg_error_5_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{0,0,{0,10}}}, + {?eh,tc_auto_skip, + {cfg_error_5_SUITE,end_per_suite, + {failed,{cfg_error_5_SUITE,init_per_suite,bad_return}}}}, + + {?eh,tc_start,{cfg_error_6_SUITE,init_per_suite}}, + {?eh,tc_done,{cfg_error_6_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{cfg_error_6_SUITE,tc1}}, + {?eh,tc_done,{cfg_error_6_SUITE,tc1,ok}}, + {?eh,test_stats,{1,0,{0,10}}}, + [{?eh,tc_start,{cfg_error_6_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{cfg_error_6_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_start,{cfg_error_6_SUITE,tc2}}, + {?eh,tc_done,{cfg_error_6_SUITE,tc2,ok}}, + {?eh,test_stats,{2,0,{0,10}}}, + {?eh,tc_start,{cfg_error_6_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{cfg_error_6_SUITE,{end_per_group,g1,[]},ok}}], + {?eh,tc_start,{cfg_error_6_SUITE,end_per_suite}}, + {?eh,tc_done,{cfg_error_6_SUITE,end_per_suite, + {failed,{error,{{badmatch,[1,2]}, + [{cfg_error_6_SUITE,end_per_suite,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}, + + {?eh,tc_start,{cfg_error_7_SUITE,init_per_suite}}, + {?eh,tc_done,{cfg_error_7_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{cfg_error_7_SUITE,tc1}}, + {?eh,tc_done,{cfg_error_7_SUITE,tc1,ok}}, + {?eh,test_stats,{3,0,{0,10}}}, + [{?eh,tc_start,{cfg_error_7_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{cfg_error_7_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_start,{cfg_error_7_SUITE,tc2}}, + {?eh,tc_done,{cfg_error_7_SUITE,tc2,ok}}, + {?eh,test_stats,{4,0,{0,10}}}, + {?eh,tc_start,{cfg_error_7_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{cfg_error_7_SUITE,{end_per_group,g1,[]},ok}}], + {?eh,tc_start,{cfg_error_7_SUITE,end_per_suite}}, + {?eh,tc_done, + {cfg_error_7_SUITE,end_per_suite,{failed,{timetrap_timeout,2000}}}}, + + {?eh,tc_start,{cfg_error_8_SUITE,init_per_suite}}, + {?eh,tc_done,{cfg_error_8_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done, + {cfg_error_8_SUITE,{init_per_group,g1,[]}, + {failed,{error,{init_per_group_fails,g1}}}}}, + {?eh,tc_auto_skip, + {cfg_error_8_SUITE,tc1, + {failed,{cfg_error_8_SUITE,init_per_group, + {'EXIT',{init_per_group_fails,g1}}}}}}, + {?eh,test_stats,{4,0,{0,11}}}, + {?eh,tc_auto_skip, + {cfg_error_8_SUITE,end_per_group, + {failed,{cfg_error_8_SUITE,init_per_group, + {'EXIT',{init_per_group_fails,g1}}}}}}], + + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE, + {init_per_group,unknown,[]}, + {failed,{timetrap_timeout,2000}}}}, + {?eh,tc_auto_skip,{cfg_error_8_SUITE,tc1, + {failed,{cfg_error_8_SUITE,init_per_group, + {timetrap_timeout,2000}}}}}, + {?eh,test_stats,{4,0,{0,12}}}, + {?eh,tc_auto_skip,{cfg_error_8_SUITE,end_per_group, + {failed,{cfg_error_8_SUITE,init_per_group, + {timetrap_timeout,2000}}}}}], + + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done, + {cfg_error_8_SUITE,{init_per_group,g3,[]}, + {failed,{error,{{badmatch,42}, + [{cfg_error_8_SUITE,init_per_group,2}, + {cfg_error_8_SUITE,init_per_group,2}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}, + {?eh,tc_auto_skip, + {cfg_error_8_SUITE,tc1, + {failed,{cfg_error_8_SUITE,init_per_group, + {'EXIT',{{badmatch,42}, + [{cfg_error_8_SUITE,init_per_group,2}, + {cfg_error_8_SUITE,init_per_group,2}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}, + {?eh,test_stats,{4,0,{0,13}}}, + {?eh,tc_auto_skip, + {cfg_error_8_SUITE,end_per_group, + {failed,{cfg_error_8_SUITE,init_per_group, + {'EXIT',{{badmatch,42}, + [{cfg_error_8_SUITE,init_per_group,2}, + {cfg_error_8_SUITE,init_per_group,2}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}], + + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{init_per_group,g4,[]},ok}}, + {?eh,tc_start,{cfg_error_8_SUITE,tc1}}, + {?eh,tc_done,{cfg_error_8_SUITE,tc1,ok}}, + {?eh,test_stats,{5,0,{0,13}}}, + {?eh,tc_start,{cfg_error_8_SUITE,{end_per_group,g4,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{end_per_group,g4,[]},ok}}], + + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_start,{cfg_error_8_SUITE,tc1}}, + {?eh,tc_done,{cfg_error_8_SUITE,tc1,ok}}, + {?eh,test_stats,{6,0,{0,13}}}, + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{init_per_group,g6,[]}, + {failed,{error,{sub_group_failed,g6}}}}}, + {?eh,tc_auto_skip, + {cfg_error_8_SUITE,tc2, + {failed,{cfg_error_8_SUITE,init_per_group, + {'EXIT',{sub_group_failed,g6}}}}}}, + {?eh,test_stats,{6,0,{0,14}}}, + {?eh,tc_auto_skip, + {cfg_error_8_SUITE,end_per_group, + {failed,{cfg_error_8_SUITE,init_per_group, + {'EXIT',{sub_group_failed,g6}}}}}}], + {?eh,tc_start,{cfg_error_8_SUITE,tc3}}, + {?eh,tc_done,{cfg_error_8_SUITE,tc3,ok}}, + {?eh,test_stats,{7,0,{0,14}}}, + {?eh,tc_start,{cfg_error_8_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{end_per_group,g5,[]},ok}}], + + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g11,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{init_per_group,g11,[]},ok}}, + {?eh,tc_start,{cfg_error_8_SUITE,tc1}}, + {?eh,tc_done,{cfg_error_8_SUITE,tc1,ok}}, + {?eh,test_stats,{8,0,{0,14}}}, + {?eh,tc_start,{cfg_error_8_SUITE,{end_per_group,g11,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{end_per_group,g11,[]}, + {failed,{error,{end_per_group_fails,g5}}}}}], + + [{?eh,tc_start,{cfg_error_8_SUITE,{init_per_group,g12,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{init_per_group,g12,[]},ok}}, + {?eh,tc_start,{cfg_error_8_SUITE,tc1}}, + {?eh,tc_done,{cfg_error_8_SUITE,tc1,ok}}, + {?eh,test_stats,{9,0,{0,14}}}, + {?eh,tc_start,{cfg_error_8_SUITE,{end_per_group,g12,[]}}}, + {?eh,tc_done,{cfg_error_8_SUITE,{end_per_group,unknown,[]}, + {failed,{timetrap_timeout,2000}}}}], + + {?eh,tc_start,{cfg_error_8_SUITE,end_per_suite}}, + {?eh,tc_done,{cfg_error_8_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{cfg_error_9_SUITE,init_per_suite}}, + {?eh,tc_done,{cfg_error_9_SUITE,init_per_suite,ok}}, + {?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}}}}}, + {?eh,test_stats,{9,0,{0,15}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc2}}, + {?eh,tc_done,{cfg_error_9_SUITE,tc2, + {skipped,{failed,{cfg_error_9_SUITE,init_per_testcase, + {timetrap_timeout,2000}}}}}}, + {?eh,test_stats,{9,0,{0,16}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc3}}, + {?eh,tc_done,{cfg_error_9_SUITE,tc3, + {skipped,{failed,{cfg_error_9_SUITE,init_per_testcase, + {{badmatch,undefined}, + [{cfg_error_9_SUITE,init_per_testcase,2}, + {test_server,my_apply,3}, + {test_server,init_per_testcase,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}, + {?eh,test_stats,{9,0,{0,17}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc4}}, + {?eh,tc_done, + {cfg_error_9_SUITE,tc4, + {skipped,{failed,{cfg_error_9_SUITE,init_per_testcase,bad_return}}}}}, + {?eh,test_stats,{9,0,{0,18}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc5}}, + {?eh,tc_done, + {cfg_error_9_SUITE,tc5,{failed,{error,fail_this_testcase}}}}, + {?eh,test_stats,{9,1,{0,18}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc6}}, + %%! we get ok with tc_done since it's only afterwards + %%! end_tc failes the testcase + {?eh,tc_done,{cfg_error_9_SUITE,tc6,ok}}, + {?eh,test_stats,{9,2,{0,18}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc11}}, + {?eh,tc_done,{cfg_error_9_SUITE,tc11, + {failed,{cfg_error_9_SUITE,end_per_testcase, + {'EXIT',warning_should_be_printed}}}}}, + {?eh,test_stats,{10,2,{0,18}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc12}}, + {?eh,tc_done,{cfg_error_9_SUITE,tc12, + {failed,{cfg_error_9_SUITE,end_per_testcase, + {timetrap_timeout,2000}}}}}, + {?eh,test_stats,{11,2,{0,18}}}, + {?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,8}]}}}}}}, + {?eh,test_stats,{12,2,{0,18}}}, + {?eh,tc_start,{cfg_error_9_SUITE,tc14}}, + {?eh,tc_done, + {cfg_error_9_SUITE,tc14,{failed,{error,tc14_should_be_failed}}}}, + {?eh,test_stats,{12,3,{0,18}}}, + + {?eh,tc_start,{cfg_error_9_SUITE,end_per_suite}}, + {?eh,tc_done,{cfg_error_9_SUITE,end_per_suite,ok}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(lib_error) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,14}}, + {?eh,tc_start,{lib_error_1_SUITE,init_per_suite}}, + {?eh,tc_done,{lib_error_1_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{lib_error_1_SUITE,lines_error}}, + {?eh,tc_done, + {lib_error_1_SUITE,lines_error,{failed, + {error, + {{badmatch,[1,2]}, + [{lib_lines,do_error,0}, + {lib_error_1_SUITE,lines_error,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}, + {?eh,test_stats,{0,1,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,lines_exit}}, + {?eh,tc_done, + {lib_error_1_SUITE,lines_exit,{failed,{error,byebye}}}}, + {?eh,test_stats,{0,2,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,lines_hang}}, + {?eh,tc_done, + {lib_lines,do_hang,{failed,{timetrap_timeout,3000}}}}, + {?eh,test_stats,{0,3,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,lines_throw}}, + {?eh,tc_done, + {lib_error_1_SUITE,lines_throw, + {failed,{error,{thrown,catch_me_if_u_can}}}}}, + {?eh,test_stats,{0,4,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,no_lines_error}}, + {?eh,tc_done, + {lib_error_1_SUITE,no_lines_error,{failed, + {error, + {{badmatch,[1,2]}, + [{lib_no_lines,do_error,0}, + {lib_error_1_SUITE,no_lines_error,1}, + {test_server,my_apply,3}, + {test_server,ts_tc,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}, + {?eh,test_stats,{0,5,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,no_lines_exit}}, + {?eh,tc_done, + {lib_error_1_SUITE,no_lines_exit,{failed,{error,byebye}}}}, + {?eh,test_stats,{0,6,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,no_lines_hang}}, + {?eh,tc_done, + {lib_error_1_SUITE,no_lines_hang,{failed,{timetrap_timeout,3000}}}}, + {?eh,test_stats,{0,7,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,no_lines_throw}}, + {?eh,tc_done, + {lib_error_1_SUITE,no_lines_throw,{failed,{error,{thrown,catch_me_if_u_can}}}}}, + {?eh,test_stats,{0,8,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,init_tc_error}}, + {?eh,tc_done,{lib_error_1_SUITE,init_tc_error,ok}}, + {?eh,test_stats,{1,8,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,init_tc_exit}}, + {?eh,tc_done,{lib_error_1_SUITE,init_tc_exit,ok}}, + {?eh,test_stats,{2,8,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,init_tc_throw}}, + {?eh,tc_done,{lib_error_1_SUITE,init_tc_throw,ok}}, + {?eh,test_stats,{3,8,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,end_tc_error}}, + {?eh,tc_done,{lib_error_1_SUITE,end_tc_error,ok}}, + {?eh,test_stats,{3,9,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,end_tc_exit}}, + {?eh,tc_done,{lib_error_1_SUITE,end_tc_exit,ok}}, + {?eh,test_stats,{3,10,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,end_tc_throw}}, + {?eh,tc_done,{lib_error_1_SUITE,end_tc_throw,ok}}, + {?eh,test_stats,{3,11,{0,0}}}, + {?eh,tc_start,{lib_error_1_SUITE,end_per_suite}}, + {?eh,tc_done,{lib_error_1_SUITE,end_per_suite,ok}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(no_compile) -> + []. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_1_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_1_SUITE.erl new file mode 100644 index 0000000000..a9649be9e0 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_1_SUITE.erl @@ -0,0 +1,116 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,3}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + exit(init_per_suite_fails), + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_2_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_2_SUITE.erl new file mode 100644 index 0000000000..a02090a5e8 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_2_SUITE.erl @@ -0,0 +1,117 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,3}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + ct:comment(init_per_suite_fails), + ok = lists:seq(1,2), + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_3_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_3_SUITE.erl new file mode 100644 index 0000000000..bf01bb52d9 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_3_SUITE.erl @@ -0,0 +1,116 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_3_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + timer:sleep(5000), + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_4_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_4_SUITE.erl new file mode 100644 index 0000000000..aaf29df65f --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_4_SUITE.erl @@ -0,0 +1,115 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_4_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_5_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_5_SUITE.erl new file mode 100644 index 0000000000..b421f7d809 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_5_SUITE.erl @@ -0,0 +1,115 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_5_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + [bad_data | Config]. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_6_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_6_SUITE.erl new file mode 100644 index 0000000000..370ac0839b --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_6_SUITE.erl @@ -0,0 +1,116 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_6_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(Config) -> + ct:comment("this should fail"), + badmatch = lists:seq(1,2). + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_7_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_7_SUITE.erl new file mode 100644 index 0000000000..9cd5b6ad29 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_7_SUITE.erl @@ -0,0 +1,116 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_7_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(Config) -> + timer:sleep(5000), + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_8_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_8_SUITE.erl new file mode 100644 index 0000000000..25993833d7 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_8_SUITE.erl @@ -0,0 +1,152 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_8_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(g1, Config) -> + exit({init_per_group_fails,g1}), + Config; +init_per_group(g2, Config) -> + ct:comment("init_per_group(g2) timeout"), + timer:sleep(5000), + Config; +init_per_group(g3, _Config) -> + badmatch = 42; +init_per_group(g4, _Config) -> + ok; +init_per_group(g6, Config) -> + exit({sub_group_failed,g6}), + Config; +init_per_group(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(g11, _Config) -> + exit({end_per_group_fails,g5}), + ok; +end_per_group(g12, _Config) -> + ct:comment("end_per_group(g6) timeout"), + timer:sleep(5000), + ok; +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc1]}, + {g2,[],[tc1]}, + {g3,[],[tc1]}, + {g4,[],[tc1]}, + {g5,[],[tc1,{g6,[],[tc2]},tc3]}, + {g11,[],[tc1]}, + {g12,[],[tc1]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [{group,g1}, + {group,g2}, + {group,g3}, + {group,g4}, + {group,g5}, + {group,g11}, + {group,g12} + ]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. + +tc3(_) -> + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_9_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_9_SUITE.erl new file mode 100644 index 0000000000..d73287ad62 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/cfg_error_9_SUITE.erl @@ -0,0 +1,185 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(cfg_error_9_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(tc1, Config) -> + exit(tc1_should_be_skipped), + Config; +init_per_testcase(tc2, Config) -> + ct:comment("init_per_testcase(tc2) timeout"), + timer:sleep(5000), + Config; +init_per_testcase(tc3, Config) -> + badmatch = ?config(void, Config), + Config; +init_per_testcase(tc4, _) -> + ok; +init_per_testcase(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(tc11, _Config) -> + ct:comment("A warning should be printed"), + exit(warning_should_be_printed), + done; +end_per_testcase(tc12, _Config) -> + ct:comment("A warning should be printed"), + timer:sleep(5000), + done; +end_per_testcase(tc13, Config) -> + ct:comment("A warning should be printed"), + badmatch = ?config(void, Config), + done; +end_per_testcase(tc14, Config) -> + ok = ?config(tc_status, Config), + {fail,tc14_should_be_failed}; +end_per_testcase(tc15, Config) -> + {failed,byebye} = ?config(tc_status, Config), + ok; +end_per_testcase(_TestCase, _Config) -> + done. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2,tc3,tc4,tc5,tc6, + tc11,tc12,tc13,tc14]. + +tc1(_) -> + fini. +tc2(_) -> + fini. +tc3(_) -> + fini. +tc4(_) -> + fini. + + +tc5() -> + put('$test_server_framework_test', + fun(init_tc, _Default) -> {fail,fail_this_testcase}; + (_, Default) -> Default + end), + []. + +tc5(_) -> + ct:comment("This one should get failed by init_tc!"), + fini. + +tc6() -> + put('$test_server_framework_test', + fun(end_tc, _Default) -> {fail,fail_this_testcase}; + (_, Default) -> Default + end), + []. + +tc6(_) -> + ct:comment("This one should succeed but then get failed by end_tc!"), + fini. + +tc11(_) -> + fini. +tc12(_) -> + ct:comment("It's ok if this doesn't get printed"), + fini. +tc13(_) -> + fini. +tc14(_) -> + ct:comment("This one should be failed by eptc"), + yes. +tc15(_) -> + exit(byebye). diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/lib_error_1_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/lib_error_1_SUITE.erl new file mode 100644 index 0000000000..6e6f83949d --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/lib_error_1_SUITE.erl @@ -0,0 +1,188 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(lib_error_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,3}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [lines_error, lines_exit, lines_hang, lines_throw, + no_lines_error, no_lines_exit, no_lines_hang, no_lines_throw, + init_tc_error, init_tc_exit, init_tc_throw, + end_tc_error, end_tc_exit, end_tc_throw]. + +lines_error(_) -> + io:format("Calling lib function..."), + lib_lines:do_error(), + ok. + +lines_exit(_) -> + io:format("Calling lib function..."), + lib_lines:do_exit(), + ok. + +lines_hang(_) -> + io:format("Calling lib function..."), + lib_lines:do_hang(), + ok. + +lines_throw(_) -> + io:format("Calling lib function..."), + lib_lines:do_throw(), + ok. + +no_lines_error(_) -> + io:format("Calling lib function..."), + lib_no_lines:do_error(), + ok. + +no_lines_exit(_) -> + io:format("Calling lib function..."), + lib_no_lines:do_exit(), + ok. + +no_lines_hang(_) -> + io:format("Calling lib function..."), + lib_no_lines:do_hang(), + ok. + +no_lines_throw(_) -> + io:format("Calling lib function..."), + lib_no_lines:do_throw(), + ok. + +init_tc_error(_) -> + put('$test_server_framework_test', + fun(init_tc, _Default) -> lib_no_lines:do_error(), ok; + (_, Default) -> Default + end), ok. + +init_tc_exit(_) -> + put('$test_server_framework_test', + fun(init_tc, _Default) -> lib_no_lines:do_exit(), ok; + (_, Default) -> Default + end), ok. + +init_tc_throw(_) -> + put('$test_server_framework_test', + fun(init_tc, _Default) -> lib_no_lines:do_throw(), ok; + (_, Default) -> Default + end), ok. + +end_tc_error(_) -> + put('$test_server_framework_test', + fun(end_tc, _Default) -> lib_no_lines:do_error(), ok; + (_, Default) -> Default + end), ok. + +end_tc_exit(_) -> + put('$test_server_framework_test', + fun(end_tc, _Default) -> lib_no_lines:do_exit(), ok; + (_, Default) -> Default + end), ok. + +end_tc_throw(_) -> + put('$test_server_framework_test', + fun(end_tc, _Default) -> lib_no_lines:do_throw(), ok; + (_, Default) -> Default + end), ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/lib_lines.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/lib_lines.erl new file mode 100644 index 0000000000..b8f5814004 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/lib_lines.erl @@ -0,0 +1,25 @@ +-module(lib_lines). + +-export([do_error/0, do_exit/0, do_hang/0, do_throw/0]). + +-include("ct.hrl"). + +do_error() -> + io:format("Here comes an error...~n"), + [] = lists:seq(1,2), + ok. + +do_exit() -> + io:format("Here comes an exit...~n"), + exit(byebye), + ok. + +do_hang() -> + io:format("Here comes a hang...~n"), + receive after infinity -> ok end, + ok. + +do_throw() -> + io:format("Here comes a throw...~n"), + throw(catch_me_if_u_can), + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/lib_no_lines.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/lib_no_lines.erl new file mode 100644 index 0000000000..4d2b08be03 --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/lib_no_lines.erl @@ -0,0 +1,23 @@ +-module(lib_no_lines). + +-export([do_error/0, do_exit/0, do_hang/0, do_throw/0]). + +do_error() -> + io:format("Here comes a badmatch error...~n"), + [] = lists:seq(1,2), + ok. + +do_exit() -> + io:format("Here comes a byebye exit...~n"), + exit(byebye), + ok. + +do_hang() -> + io:format("Here comes a hang...~n"), + receive after infinity -> ok end, + ok. + +do_throw() -> + io:format("Here comes a throw...~n"), + throw(catch_me_if_u_can), + ok. diff --git a/lib/common_test/test/ct_error_SUITE_data/error/test/no_compile_SUITE.erl b/lib/common_test/test/ct_error_SUITE_data/error/test/no_compile_SUITE.erl new file mode 100644 index 0000000000..534a8f34af --- /dev/null +++ b/lib/common_test/test/ct_error_SUITE_data/error/test/no_compile_SUITE.erl @@ -0,0 +1,115 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(no_compile_SUITE). + +-compile(export_all). + +-include("ct.hrl") + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,{group,g1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_event_handler_SUITE.erl b/lib/common_test/test/ct_event_handler_SUITE.erl new file mode 100644 index 0000000000..bafd32f937 --- /dev/null +++ b/lib/common_test/test/ct_event_handler_SUITE.erl @@ -0,0 +1,170 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2010. 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_event_handler_SUITE.erl +%%% +%%% Description: This suite will install event handlers and run +%%% some simple tests to check that events are generated according +%%% to the specification (see Event Handling in CT User's Guide). +%%%------------------------------------------------------------------- +-module(ct_event_handler_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.hrl"). + +%-include_lib("common_test/include/ct_event.hrl"). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + DataDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + + EH = filename:join(DataDir, "eh_A.erl"), + CResult = compile:file(EH, [verbose,report,{outdir,PrivDir}]), + test_server:format("~s compilation result: ~p~n", [EH,CResult]), + + Config1 = ct_test_support:init_per_suite(Config, 0), + 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). + +all(doc) -> + []; + +all(suite) -> + [start_stop, results]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +start_stop(doc) -> + []; + +start_stop(suite) -> + []; + +start_stop(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + TestObj = filename:join(DataDir, "event_handling_1"), + Suite1 = filename:join(TestObj, "test/eh_11_SUITE"), + Opts0 = ct_test_support:get_opts(Config), + + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + + Opts = Opts0 ++ [{suite,Suite1},{testcase,tc1}, + {event_handler,{eh_A,EvHArgs}}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(start_stop, + ct_test_support:reformat(Events, eh_A), + ?config(priv_dir, Config)), + + TestEvents = + [{eh_A,start_logging,{'DEF','RUNDIR'}}, + {eh_A,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {eh_A,start_info,{1,1,1}}, + {eh_A,tc_start,{eh_11_SUITE,init_per_suite}}, + {eh_A,tc_done,{eh_11_SUITE,init_per_suite,ok}}, + {eh_A,tc_start,{eh_11_SUITE,tc1}}, + {eh_A,tc_done,{eh_11_SUITE,tc1,ok}}, + {eh_A,test_stats,{1,0,{0,0}}}, + {eh_A,tc_start,{eh_11_SUITE,end_per_suite}}, + {eh_A,tc_done,{eh_11_SUITE,end_per_suite,ok}}, + {eh_A,test_done,{'DEF','STOP_TIME'}}, + {eh_A,stop_logging,[]}], + + ok = ct_test_support:verify_events(TestEvents, Events, Config), + {comment,"NOTE! Known problem with test_start event!"}. + + +results(doc) -> + []; + +results(suite) -> + []; + +results(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + TestObj = filename:join(DataDir, "event_handling_1"), + Suite1 = filename:join(TestObj, "test/eh_11_SUITE"), + Opts0 = ct_test_support:get_opts(Config), + + Level = ?config(trace_level, Config), + EvHArgs = [{cbm,ct_test_support},{trace_level,Level}], + + Opts = Opts0 ++ [{suite,Suite1}, + {event_handler,{eh_A,EvHArgs}}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(results, + ct_test_support:reformat(Events, eh_A), + ?config(priv_dir, Config)), + + TestEvents = + [{eh_A,start_logging,{'DEF','RUNDIR'}}, + {eh_A,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {eh_A,start_info,{1,1,3}}, + {eh_A,tc_start,{eh_11_SUITE,init_per_suite}}, + {eh_A,tc_done,{eh_11_SUITE,init_per_suite,ok}}, + {eh_A,tc_start,{eh_11_SUITE,tc1}}, + {eh_A,tc_done,{eh_11_SUITE,tc1,ok}}, + {eh_A,test_stats,{1,0,{0,0}}}, + {eh_A,tc_start,{eh_11_SUITE,tc2}}, + {eh_A,tc_done,{eh_11_SUITE,tc2,{skipped,"Skipped"}}}, + {eh_A,test_stats,{1,0,{1,0}}}, + {eh_A,tc_start,{eh_11_SUITE,tc3}}, + {eh_A,tc_done,{eh_11_SUITE,tc3,{failed,{error,'Failing'}}}}, + {eh_A,test_stats,{1,1,{1,0}}}, + {eh_A,tc_start,{eh_11_SUITE,end_per_suite}}, + {eh_A,tc_done,{eh_11_SUITE,end_per_suite,ok}}, + {eh_A,test_done,{'DEF','STOP_TIME'}}, + {eh_A,stop_logging,[]}], + + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS diff --git a/lib/common_test/test/ct_event_handler_SUITE_data/eh_A.erl b/lib/common_test/test/ct_event_handler_SUITE_data/eh_A.erl new file mode 100644 index 0000000000..6e526f15a2 --- /dev/null +++ b/lib/common_test/test/ct_event_handler_SUITE_data/eh_A.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. 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% +%% + +%%% @doc Event handler module +%%% +%%% <p>This is an event handler module used for testing that +%%% Common Test generates events as expected.</p> +%%% +-module(eh_A). + +-behaviour(gen_event). + +-include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +%% gen_event callbacks +-export([init/1, handle_event/2, handle_call/2, + handle_info/2, terminate/2, code_change/3]). + +-record(state, {cbm=ct_test_support, + trace_level=50}). + +%%==================================================================== +%% gen_event callbacks +%%==================================================================== +%%-------------------------------------------------------------------- +%% Function: init(Args) -> {ok, State} +%% Description: Whenever a new event handler is added to an event manager, +%% this function is called to initialize the event handler. +%%-------------------------------------------------------------------- +init(Args) -> + + S1 = case lists:keysearch(cbm, 1, Args) of + {_,{cbm,CBM}} -> + #state{cbm=CBM}; + _ -> + #state{} + end, + S2 = case lists:keysearch(trace_level, 1, Args) of + {_,{trace_level,Level}} -> + S1#state{trace_level=Level}; + _ -> + S1 + end, + print(S2#state.trace_level, "Event Handler ~w started!~n", [?MODULE]), + {ok,S2}. + +%%-------------------------------------------------------------------- +%% Function: +%% handle_event(Event, State) -> {ok, State} | +%% {swap_handler, Args1, State1, Mod2, Args2} | +%% remove_handler +%% Description:Whenever an event manager receives an event sent using +%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for +%% each installed event handler to handle the event. +%%-------------------------------------------------------------------- +handle_event(Event, State=#state{cbm=CBM, trace_level=_Level}) -> + % print(_Level, "~p: ~p~n", [Event#event.name,Event#event.data]), + CBM:handle_event(?MODULE, Event), + {ok,State}. + +%%-------------------------------------------------------------------- +%% Function: +%% handle_call(Request, State) -> {ok, Reply, State} | +%% {swap_handler, Reply, Args1, State1, +%% Mod2, Args2} | +%% {remove_handler, Reply} +%% Description: Whenever an event manager receives a request sent using +%% gen_event:call/3,4, this function is called for the specified event +%% handler to handle the request. +%%-------------------------------------------------------------------- +handle_call(_Req, State) -> + Reply = ok, + {ok, Reply, State}. + +%%-------------------------------------------------------------------- +%% Function: +%% handle_info(Info, State) -> {ok, State} | +%% {swap_handler, Args1, State1, Mod2, Args2} | +%% remove_handler +%% Description: This function is called for each installed event handler when +%% an event manager receives any other message than an event or a synchronous +%% request (or a system message). +%%-------------------------------------------------------------------- +handle_info(_Info, State) -> + {ok, State}. + +%%-------------------------------------------------------------------- +%% Function: terminate(Reason, State) -> void() +%% Description:Whenever an event handler is deleted from an event manager, +%% this function is called. It should be the opposite of Module:init/1 and +%% do any necessary cleaning up. +%%-------------------------------------------------------------------- +terminate(_Reason, _State) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} +%% Description: Convert process state when code is changed +%%-------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%-------------------------------------------------------------------- +%%% Internal functions +%%-------------------------------------------------------------------- + +print(Level, _Str, _Args) -> + test_server:format(Level, _Str,_Args). + + diff --git a/lib/common_test/test/ct_event_handler_SUITE_data/event_handling_1/test/eh_11_SUITE.erl b/lib/common_test/test/ct_event_handler_SUITE_data/event_handling_1/test/eh_11_SUITE.erl new file mode 100644 index 0000000000..16b7129993 --- /dev/null +++ b/lib/common_test/test/ct_event_handler_SUITE_data/event_handling_1/test/eh_11_SUITE.erl @@ -0,0 +1,141 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2010. 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 : eh_11_SUITE.erl +%%% Description : Used by ct_event_handler_SUITE to test event handling. +%%%------------------------------------------------------------------- +-module(eh_11_SUITE). + +%% Note: This directive should only be used in test suites. +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% COMMON TEST CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% +%% Info = [tuple()] +%% List of key/value pairs. +%% +%% Description: Returns list of tuples to set default properties +%% for the suite. +%% +%% Note: The suite/0 function is only meant to be used to return +%% default data values, not perform any other operations. +%%-------------------------------------------------------------------- +suite() -> + [ + {timetrap,{seconds,10}} + ]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the suite. +%% +%% Description: Initialization before the suite. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after the suite. +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% +%% TestCase = atom() +%% Name of the test case that is about to run. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the test case. +%% +%% Description: Initialization before each test case. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% +%% TestCase = atom() +%% Name of the test case that is finished. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after each test case. +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: all() -> TestCases | {skip,Reason} +%% +%% TestCases = [TestCase | {sequence,SeqName}] +%% TestCase = atom() +%% Name of a test case. +%% SeqName = atom() +%% Name of a test case sequence. +%% Reason = term() +%% The reason for skipping all test cases. +%% +%% Description: Returns the list of test cases that are to be executed. +%%-------------------------------------------------------------------- +all() -> + [tc1, tc2, tc3]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +tc1(_Config) -> + ok. + +tc2(_Config) -> + {skip,"Skipped"}. + +tc3(_Config) -> + exit('Failing'). diff --git a/lib/common_test/test/ct_groups_test_1_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE.erl new file mode 100644 index 0000000000..1761b773f5 --- /dev/null +++ b/lib/common_test/test/ct_groups_test_1_SUITE.erl @@ -0,0 +1,1226 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_test_1_SUITE +%%% +%%% Description: +%%% Test some simple test case group scenarios. +%%% +%%% The suites used for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_groups_test_1_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.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). + +all(doc) -> + ["Run smoke tests of Common Test."]; + +all(suite) -> + [groups_suite_1, groups_suite_2, + groups_suites_1, groups_dir_1, groups_dirs_1]. + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% + +groups_suite_1(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Suite = filename:join(DataDir, "groups_1/test/groups_11_SUITE"), + + {Opts,ERPid} = setup({suite,Suite}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(groups_suite_1, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(groups_suite_1), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% + +groups_suite_2(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Suite = filename:join(DataDir, "groups_1/test/groups_12_SUITE"), + + {Opts,ERPid} = setup({suite,Suite}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(groups_suite_2, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(groups_suite_2), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% + +groups_suites_1(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Suites = [filename:join(DataDir, "groups_1/test/groups_11_SUITE"), + filename:join(DataDir, "groups_1/test/groups_12_SUITE")], + + {Opts,ERPid} = setup({suite,Suites}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(groups_suites_1, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(groups_suites_1), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% + +groups_dir_1(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Dir = filename:join(DataDir, "groups_1"), + + {Opts,ERPid} = setup({dir,Dir}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(groups_dir_1, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(groups_dir_1), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +groups_dirs_1(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Dirs = [filename:join(DataDir, "groups_1"), + filename:join(DataDir, "groups_2")], + + {Opts,ERPid} = setup({dir,Dirs}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(groups_dirs_1, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(groups_dirs_1), + ok = ct_test_support:verify_events(TestEvents, Events, 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 ++ [Test,{event_handler,{?eh,EvHArgs}}], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). +%reformat(Events, _EH) -> +% Events. + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- + +test_events(groups_suite_1) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,15}}, + {?eh,tc_start,{groups_11_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1a,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1a,[]},ok}}], + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1b,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1b,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_2}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_2,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2a,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3a,ok}}, + {?eh,test_stats,{8,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3b,ok}}, + {?eh,test_stats,{9,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{10,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_2,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_3}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3,ok}}, + {?eh,test_stats,{11,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_4,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_5,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_5a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5a,ok}}, + {?eh,test_stats,{12,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_6,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_7,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7a,ok}}, + {?eh,test_stats,{13,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7b,ok}}, + {?eh,test_stats,{14,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_7,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_6,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{15,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_5,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,end_per_suite,init}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]; + +test_events(groups_suite_2) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,unknown}}, + {?eh,tc_start,{groups_12_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,init_per_suite,ok}}, + + {shuffle,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1c}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1c,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]},ok}}]}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,testcase_1}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2a,ok}}, + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]},ok}}], + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[]},ok}}], + + {?eh,tc_start,{groups_12_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{13,0,{0,0}}}, + + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,testcase_3}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3,ok}}, + {?eh,test_stats,{14,0,{0,0}}}, + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_4,[]},ok}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]},ok}}, + + %% the done event could come in during the parallel subgroup + %% and we can't test that, yet... + %% {?eh,tc_start,{groups_12_SUITE,testcase_5a}}, + %% {?eh,tc_done,{groups_12_SUITE,testcase_5a,ok}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]},ok}}, + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]},ok}}], + + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{18,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_12_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,end_per_suite,init}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]; + +test_events(groups_suites_1) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{2,2,unknown}}, + {?eh,tc_start,{groups_11_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1a,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1a,[]},ok}}], + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1b,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1b,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_2}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_2,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2a,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3a,ok}}, + {?eh,test_stats,{8,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3b,ok}}, + {?eh,test_stats,{9,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{10,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_2,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_3}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3,ok}}, + {?eh,test_stats,{11,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_4,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_5,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_5a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5a,ok}}, + {?eh,test_stats,{12,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_6,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_7,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7a,ok}}, + {?eh,test_stats,{13,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7b,ok}}, + {?eh,test_stats,{14,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_7,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_6,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{15,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_5,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,end_per_suite,init}}, + + {?eh,tc_start,{groups_12_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,init_per_suite,ok}}, + + {shuffle,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1c}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1c,ok}}, + {?eh,test_stats,{16,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{17,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{18,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]},ok}}]}, + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{20,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,testcase_1}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1,ok}}, + {?eh,test_stats,{21,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2,ok}}, + {?eh,test_stats,{22,0,{0,0}}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2a,ok}}, + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]},ok}}], + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_12_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{28,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,testcase_3}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3,ok}}, + {?eh,test_stats,{29,0,{0,0}}}, + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_4,[]},ok}}, + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]},ok}}, + + %% the done event could come in during the parallel subgroup + %% and we can't test that, yet... + %% {?eh,tc_start,{groups_12_SUITE,testcase_5a}}, + %% {?eh,tc_done,{groups_12_SUITE,testcase_5a,ok}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]},ok}}, + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]},ok}}], + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{33,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_12_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,end_per_suite,init}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]; + +test_events(groups_dir_1) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,2,unknown}}, + {?eh,tc_start,{groups_11_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1a,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1a,[]},ok}}], + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1b,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1b,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_2}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_2,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2a,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3a,ok}}, + {?eh,test_stats,{8,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3b,ok}}, + {?eh,test_stats,{9,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{10,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_2,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_3}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3,ok}}, + {?eh,test_stats,{11,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_4,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_5,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_5a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5a,ok}}, + {?eh,test_stats,{12,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_6,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_7,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7a,ok}}, + {?eh,test_stats,{13,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7b,ok}}, + {?eh,test_stats,{14,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_7,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_6,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{15,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_5,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,end_per_suite,init}}, + + {?eh,tc_start,{groups_12_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,init_per_suite,ok}}, + + {shuffle,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{16,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1c}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1c,ok}}, + {?eh,test_stats,{17,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{18,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]},ok}}]}, + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{20,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,testcase_1}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1,ok}}, + {?eh,test_stats,{21,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2,ok}}, + {?eh,test_stats,{22,0,{0,0}}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2a,ok}}, + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]},ok}}], + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_12_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{28,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,testcase_3}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3,ok}}, + {?eh,test_stats,{29,0,{0,0}}}, + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_4,[]},ok}}, + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]},ok}}, + + %% the done event could come in during the parallel subgroup + %% and we can't test that, yet... + %% {?eh,tc_start,{groups_12_SUITE,testcase_5a}}, + %% {?eh,tc_done,{groups_12_SUITE,testcase_5a,ok}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]},ok}}, + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]},ok}}], + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{33,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_12_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,end_per_suite,init}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]; + +test_events(groups_dirs_1) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{2,4,unknown}}, + + {?eh,tc_start,{groups_11_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1a,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1a,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1a,[]},ok}}], + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_1b,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_1b,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_1b,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_2}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_2,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2a,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3a,ok}}, + {?eh,test_stats,{8,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3b,ok}}, + {?eh,test_stats,{9,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{10,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_2,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_2,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,testcase_3}}, + {?eh,tc_done,{groups_11_SUITE,testcase_3,ok}}, + {?eh,test_stats,{11,0,{0,0}}}, + + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_4,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_5,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_5a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5a,ok}}, + {?eh,test_stats,{12,0,{0,0}}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_6,[]},ok}}, + [{?eh,tc_start,{groups_11_SUITE,{init_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{init_per_group,test_group_7,[]},ok}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7a,ok}}, + {?eh,test_stats,{13,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_7b,ok}}, + {?eh,test_stats,{14,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_7,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_7,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_6,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_6,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_11_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{15,0,{0,0}}}, + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_5,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_5,[]},ok}}], + {?eh,tc_start,{groups_11_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_11_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_11_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_11_SUITE,end_per_suite,init}}, + + {?eh,tc_start,{groups_12_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,init_per_suite,ok}}, + + {shuffle,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1a,[{shuffle,'_'}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{16,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1c}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1c,ok}}, + {?eh,test_stats,{17,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{18,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1a,[shuffle]},ok}}]}, + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_1b,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{20,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_1b,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,testcase_1}}, + {?eh,tc_done,{groups_12_SUITE,testcase_1,ok}}, + {?eh,test_stats,{21,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2,ok}}, + {?eh,test_stats,{22,0,{0,0}}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_2,[parallel]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2a,ok}}, + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[{repeat,1}]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[{repeat,1}]},ok}}], + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_12_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{28,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_2,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_12_SUITE,testcase_3}}, + {?eh,tc_done,{groups_12_SUITE,testcase_3,ok}}, + {?eh,test_stats,{29,0,{0,0}}}, + + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_4,[]},ok}}, + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_5,[parallel]},ok}}, + + %% the done event could come in during the parallel subgroup + %% and we can't test that, yet... + %% {?eh,tc_start,{groups_12_SUITE,testcase_5a}}, + %% {?eh,tc_done,{groups_12_SUITE,testcase_5a,ok}}, + + {parallel,[{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_6,[parallel]},ok}}, + [{?eh,tc_start,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{init_per_group,test_group_7,[sequence]},ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7a,ok}}, + {?eh,tc_start,{groups_12_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_7b,ok}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_7,[sequence]},ok}}], + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_6,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_12_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{33,0,{0,0}}}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_5,[parallel]},ok}}]}, + {?eh,tc_start,{groups_12_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done,{groups_12_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_12_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_12_SUITE,end_per_suite,init}}, + + {?eh,tc_start,{groups_21_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_21_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_1}}, + {?eh,tc_done,{groups_21_SUITE,testcase_1,ok}}, + {?eh,test_stats,{34,0,{0,0}}}, + + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_1a,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_1a,[]},ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_21_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{35,0,{0,0}}}, + {?eh,tc_start,{groups_21_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_21_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{36,0,{0,0}}}, + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_1a,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_1a,[]},ok}}], + + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_1b,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_1b,[]},ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_21_SUITE,testcase_1a,ok}}, + {?eh,test_stats,{37,0,{0,0}}}, + {?eh,tc_start,{groups_21_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_21_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{38,0,{0,0}}}, + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_1b,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_1b,[]},ok}}], + {?eh,tc_start,{groups_21_SUITE,testcase_2}}, + {?eh,tc_done,{groups_21_SUITE,testcase_2,ok}}, + {?eh,test_stats,{39,0,{0,0}}}, + + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_2,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_2,[]},ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_21_SUITE,testcase_2a,ok}}, + {?eh,test_stats,{40,0,{0,0}}}, + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_21_SUITE,testcase_3a,ok}}, + {?eh,test_stats,{41,0,{0,0}}}, + {?eh,tc_start,{groups_21_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_21_SUITE,testcase_3b,ok}}, + {?eh,test_stats,{42,0,{0,0}}}, + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_21_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_21_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{43,0,{0,0}}}, + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_2,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_2,[]},ok}}], + + {?eh,tc_start,{groups_21_SUITE,testcase_3}}, + {?eh,tc_done,{groups_21_SUITE,testcase_3,ok}}, + {?eh,test_stats,{44,0,{0,0}}}, + + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_4,[]},ok}}, + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_5,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_5,[]},ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_5a}}, + {?eh,tc_done,{groups_21_SUITE,testcase_5a,ok}}, + {?eh,test_stats,{45,0,{0,0}}}, + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_6,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_6,[]},ok}}, + [{?eh,tc_start, + {groups_21_SUITE,{init_per_group,test_group_7,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{init_per_group,test_group_7,[]},ok}}, + {?eh,tc_start,{groups_21_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_21_SUITE,testcase_7a,ok}}, + {?eh,test_stats,{46,0,{0,0}}}, + {?eh,tc_start,{groups_21_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_21_SUITE,testcase_7b,ok}}, + {?eh,test_stats,{47,0,{0,0}}}, + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_7,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_7,[]},ok}}], + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_6,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_6,[]},ok}}], + {?eh,tc_start,{groups_21_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_21_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{48,0,{0,0}}}, + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_5,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_5,[]},ok}}], + {?eh,tc_start, + {groups_21_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done, + {groups_21_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_21_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_21_SUITE,end_per_suite,init}}, + + {?eh,tc_start,{groups_22_SUITE,init_per_suite}}, + {?eh,tc_done,{groups_22_SUITE,init_per_suite,ok}}, + + {shuffle, + [{?eh,tc_start, + {groups_22_SUITE, + {init_per_group,test_group_1a,[{shuffle,'_'}]}}}, + {?eh,tc_done, + {groups_22_SUITE, + {init_per_group,test_group_1a,[{shuffle,'_'}]}, + ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_22_SUITE,testcase_1a,ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_1b,ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_1c}}, + {?eh,tc_done,{groups_22_SUITE,testcase_1c,ok}}, + {?eh,test_stats,{51,0,{0,0}}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_1a,[shuffle]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_1a,[shuffle]},ok}}]}, + + {parallel, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_1b,[parallel]},ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_1a}}, + {?eh,tc_done,{groups_22_SUITE,testcase_1a,ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_1b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_1b,ok}}, + {?eh,test_stats,{53,0,{0,0}}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_1b,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_1b,[parallel]},ok}}]}, + + {?eh,tc_start,{groups_22_SUITE,testcase_1}}, + {?eh,tc_done,{groups_22_SUITE,testcase_1,ok}}, + {?eh,test_stats,{54,0,{0,0}}}, + {?eh,tc_start,{groups_22_SUITE,testcase_2}}, + {?eh,tc_done,{groups_22_SUITE,testcase_2,ok}}, + {?eh,test_stats,{55,0,{0,0}}}, + + {parallel, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_2,[parallel]},ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_2a}}, + {?eh,tc_done,{groups_22_SUITE,testcase_2a,ok}}, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_3,[{repeat,1}]},ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_22_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_3b,ok}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_3,[{repeat,1}]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_3,[{repeat,1}]},ok}}], + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_3,[]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_3,[]},ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_3a}}, + {?eh,tc_done,{groups_22_SUITE,testcase_3a,ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_3b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_3b,ok}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_3,[]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_3,[]},ok}}], + {?eh,tc_start,{groups_22_SUITE,testcase_2b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_2b,ok}}, + {?eh,test_stats,{61,0,{0,0}}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_2,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_2,[parallel]},ok}}]}, + {?eh,tc_start,{groups_22_SUITE,testcase_3}}, + {?eh,tc_done,{groups_22_SUITE,testcase_3,ok}}, + {?eh,test_stats,{62,0,{0,0}}}, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_4,[]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_4,[]},ok}}, + + {parallel, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_5,[parallel]},ok}}, + + %% the done event could come in during the parallel subgroup + %% and we can't test that, yet... + %% {?eh,tc_start,{groups_22_SUITE,testcase_5a}}, + %% {?eh,tc_done,{groups_22_SUITE,testcase_5a,ok}}, + + {parallel, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_6,[parallel]},ok}}, + [{?eh,tc_start, + {groups_22_SUITE,{init_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done, + {groups_22_SUITE,{init_per_group,test_group_7,[sequence]},ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_7a}}, + {?eh,tc_done,{groups_22_SUITE,testcase_7a,ok}}, + {?eh,tc_start,{groups_22_SUITE,testcase_7b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_7b,ok}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_7,[sequence]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_7,[sequence]},ok}}], + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_6,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_6,[parallel]},ok}}]}, + {?eh,tc_start,{groups_22_SUITE,testcase_5b}}, + {?eh,tc_done,{groups_22_SUITE,testcase_5b,ok}}, + {?eh,test_stats,{66,0,{0,0}}}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_5,[parallel]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_5,[parallel]},ok}}]}, + {?eh,tc_start, + {groups_22_SUITE,{end_per_group,test_group_4,[]}}}, + {?eh,tc_done, + {groups_22_SUITE,{end_per_group,test_group_4,[]},ok}}], + + {?eh,tc_start,{groups_22_SUITE,end_per_suite}}, + {?eh,tc_done,{groups_22_SUITE,end_per_suite,init}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]}]. diff --git a/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_1/test/groups_11_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_1/test/groups_11_SUITE.erl new file mode 100644 index 0000000000..c6d50443d0 --- /dev/null +++ b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_1/test/groups_11_SUITE.erl @@ -0,0 +1,280 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_11_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%==================================================================== +%% COMMON TEST CALLBACK FUNCTIONS +%%==================================================================== + +suite() -> + [{timetrap,{minutes,1}}]. + +groups() -> + [ + {test_group_1a, [testcase_1a,testcase_1b]}, + + {test_group_1b, [], [testcase_1a,testcase_1b]}, + + {test_group_2, [], [testcase_2a, + + {test_group_3, [], [testcase_3a, + testcase_3b]}, + testcase_2b]}, + + {test_group_4, [{test_group_5, [], [testcase_5a, + + {group, test_group_6}, + + testcase_5b]}]}, + + {test_group_6, [{group, test_group_7}]}, + + {test_group_7, [testcase_7a,testcase_7b]} + ]. + +all() -> + [testcase_1, + {group, test_group_1a}, + {group, test_group_1b}, + testcase_2, + {group, test_group_2}, + testcase_3, + {group, test_group_4}]. + +%% this func only for internal test purposes +grs_and_tcs() -> + {[ + test_group_1a, test_group_1b, + test_group_2, test_group_3, + test_group_4, test_group_5, + test_group_6, test_group_7 + ], + [ + testcase_1, + testcase_1a, testcase_1b, + testcase_2, + testcase_2a, testcase_2b, + testcase_3a, testcase_3b, + testcase_3, + testcase_5a, testcase_5b, + testcase_7a, testcase_7b + ]}. + +%%-------------------------------------------------------------------- +%% Suite Configuration +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + [{suite,init}|Config]. + +end_per_suite(Config) -> + init = ?config(suite,Config). + +%%-------------------------------------------------------------------- +%% Group Configuration +%%-------------------------------------------------------------------- + +init_per_group(Group, Config) -> + [{name,Group}] = ?config(tc_group_properties,Config), + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + [{Group,Group} | Config]; + false -> + ct:fail({bad_group,Group}) + end. + +end_per_group(Group, Config) -> + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + Group = ?config(Group,Config), + ok; + false -> + ct:fail({bad_group,Group}) + end. + +%%-------------------------------------------------------------------- +%% Testcase Configuration +%%-------------------------------------------------------------------- + +init_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + [{TestCase,TestCase} | Config]; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + +end_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + TestCase = ?config(TestCase,Config), + ok; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + + +%%-------------------------------------------------------------------- +%% Testcases +%%-------------------------------------------------------------------- + +testcase_1() -> + []. +testcase_1(Config) -> + init = ?config(suite,Config), + testcase_1 = ?config(testcase_1,Config), + ok. + +testcase_1a() -> + []. +testcase_1a(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + testcase_1a = ?config(testcase_1a,Config), + ok. +testcase_1b() -> + []. +testcase_1b(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + undefined = ?config(testcase_1a,Config), + testcase_1b = ?config(testcase_1b,Config), + ok. + +testcase_2() -> + []. +testcase_2(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_1a,Config), + undefined = ?config(test_group_1b,Config), + testcase_2 = ?config(testcase_2,Config), + ok. + +testcase_2a() -> + []. +testcase_2a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + testcase_2a = ?config(testcase_2a,Config), + ok. +testcase_2b() -> + []. +testcase_2b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + undefined = ?config(testcase_2a,Config), + testcase_2b = ?config(testcase_2b,Config), + ok. + +testcase_3a() -> + []. +testcase_3a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_2b,Config), + testcase_3a = ?config(testcase_3a,Config), + ok. +testcase_3b() -> + []. +testcase_3b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_3a,Config), + testcase_3b = ?config(testcase_3b,Config), + ok. + +testcase_3() -> + []. +testcase_3(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_2,Config), + undefined = ?config(test_group_3,Config), + testcase_3 = ?config(testcase_3,Config), + ok. + +testcase_5a() -> + []. +testcase_5a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_3,Config), + testcase_5a = ?config(testcase_5a,Config), + ok. +testcase_5b() -> + []. +testcase_5b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_5a,Config), + testcase_5b = ?config(testcase_5b,Config), + ok. + +testcase_7a() -> + []. +testcase_7a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + testcase_7a = ?config(testcase_7a,Config), + ok. +testcase_7b() -> + []. +testcase_7b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + undefined = ?config(testcase_7a,Config), + testcase_7b = ?config(testcase_7b,Config), + ok. diff --git a/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_1/test/groups_12_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_1/test/groups_12_SUITE.erl new file mode 100644 index 0000000000..b261ef581f --- /dev/null +++ b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_1/test/groups_12_SUITE.erl @@ -0,0 +1,310 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_12_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%==================================================================== +%% COMMON TEST CALLBACK FUNCTIONS +%%==================================================================== + +suite() -> + [{timetrap,{minutes,1}}]. + +groups() -> + [ + {test_group_1a, [shuffle], [testcase_1a,testcase_1b,testcase_1c]}, + + {test_group_1b, [parallel], [testcase_1a,testcase_1b]}, + + {test_group_2, [parallel], [testcase_2a, + + {test_group_3, [{repeat,1}], + [testcase_3a, testcase_3b]}, + + testcase_2b]}, + + {test_group_4, [{test_group_5, [parallel], [testcase_5a, + + {group, test_group_6}, + + testcase_5b]}]}, + + {test_group_6, [parallel], [{group, test_group_7}]}, + + {test_group_7, [sequence], [testcase_7a,testcase_7b]} + ]. + +all() -> + [{group, test_group_1a}, + {group, test_group_1b}, + testcase_1, + testcase_2, + {group, test_group_2}, + testcase_3, + {group, test_group_4}]. + +%% this func only for internal test purposes +grs_and_tcs() -> + {[ + test_group_1a, test_group_1b, + test_group_2, test_group_3, + test_group_4, test_group_5, + test_group_6, test_group_7 + ], + [ + testcase_1a, testcase_1b, testcase_1c, + testcase_1, + testcase_2, + testcase_2a, testcase_2b, + testcase_3a, testcase_3b, + testcase_3, + testcase_5a, testcase_5b, + testcase_7a, testcase_7b + ]}. + +%%-------------------------------------------------------------------- +%% Suite Configuration +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + [{suite,init}|Config]. + +end_per_suite(Config) -> + init = ?config(suite,Config). + +%%-------------------------------------------------------------------- +%% Group Configuration +%%-------------------------------------------------------------------- + +init_per_group(Group, Config) -> + Cmt = + case {Group,?config(tc_group_properties,Config)} of + {test_group_1a,[{shuffle,S},{name,test_group_1a}]} -> + io_lib:format("shuffled, ~w", [S]); + {test_group_1b,[{name,test_group_1b},parallel]} -> "parallel"; + {test_group_2,[{name,test_group_2},parallel]} -> "parallel"; + {test_group_3,[{name,test_group_3},{repeat,1}]} -> "repeat 1"; + {test_group_3,[{name,test_group_3}]} -> "repeat 0"; + {test_group_4,[{name,test_group_4}]} -> ok; + {test_group_5,[{name,test_group_5},parallel]} -> "parallel"; + {test_group_6,[{name,test_group_6},parallel]} -> "parallel"; + {test_group_7,[{name,test_group_7},sequence]} -> "sequence" + end, + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + ct:comment(io_lib:format("~w, ~s", [Group,Cmt])), + [{Group,Group} | Config]; + false -> + ct:fail({bad_group,Group}) + end. + +end_per_group(Group, Config) -> + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + Group = ?config(Group,Config), + ok; + false -> + ct:fail({bad_group,Group}) + end. + +%%-------------------------------------------------------------------- +%% Testcase Configuration +%%-------------------------------------------------------------------- + +init_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + [{TestCase,TestCase} | Config]; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + +end_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + TestCase = ?config(TestCase,Config), + ok; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + + +%%-------------------------------------------------------------------- +%% Testcases +%%-------------------------------------------------------------------- + +testcase_1a() -> + []. +testcase_1a(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + testcase_1a = ?config(testcase_1a,Config), + ok. +testcase_1b() -> + []. +testcase_1b(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + undefined = ?config(testcase_1a,Config), + testcase_1b = ?config(testcase_1b,Config), + ok. + +testcase_1c() -> + []. +testcase_1c(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + undefined = ?config(testcase_1b,Config), + testcase_1c = ?config(testcase_1c,Config), + ok. + +testcase_1() -> + []. +testcase_1(Config) -> + init = ?config(suite,Config), + testcase_1 = ?config(testcase_1,Config), + ok. + +testcase_2() -> + []. +testcase_2(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_1a,Config), + undefined = ?config(test_group_1b,Config), + testcase_2 = ?config(testcase_2,Config), + ok. + +testcase_2a() -> + []. +testcase_2a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + testcase_2a = ?config(testcase_2a,Config), + ok. +testcase_2b() -> + []. +testcase_2b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + undefined = ?config(testcase_2a,Config), + testcase_2b = ?config(testcase_2b,Config), + ok. + +testcase_3a() -> + []. +testcase_3a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_2b,Config), + testcase_3a = ?config(testcase_3a,Config), + ok. +testcase_3b() -> + []. +testcase_3b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_3a,Config), + testcase_3b = ?config(testcase_3b,Config), + ok. + +testcase_3() -> + []. +testcase_3(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_2,Config), + undefined = ?config(test_group_3,Config), + testcase_3 = ?config(testcase_3,Config), + ok. + +testcase_5a() -> + []. +testcase_5a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_3,Config), + testcase_5a = ?config(testcase_5a,Config), + ok. +testcase_5b() -> + []. +testcase_5b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_5a,Config), + testcase_5b = ?config(testcase_5b,Config), + ok. + +testcase_7a() -> + []. +testcase_7a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + testcase_7a = ?config(testcase_7a,Config), + ok. +testcase_7b() -> + []. +testcase_7b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + undefined = ?config(testcase_7a,Config), + testcase_7b = ?config(testcase_7b,Config), + ok. diff --git a/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_2/test/groups_21_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_2/test/groups_21_SUITE.erl new file mode 100644 index 0000000000..42b10d1803 --- /dev/null +++ b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_2/test/groups_21_SUITE.erl @@ -0,0 +1,280 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_21_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%==================================================================== +%% COMMON TEST CALLBACK FUNCTIONS +%%==================================================================== + +suite() -> + [{timetrap,{minutes,1}}]. + +groups() -> + [ + {test_group_1a, [testcase_1a,testcase_1b]}, + + {test_group_1b, [], [testcase_1a,testcase_1b]}, + + {test_group_2, [], [testcase_2a, + + {test_group_3, [], [testcase_3a, + testcase_3b]}, + testcase_2b]}, + + {test_group_4, [{test_group_5, [], [testcase_5a, + + {group, test_group_6}, + + testcase_5b]}]}, + + {test_group_6, [{group, test_group_7}]}, + + {test_group_7, [testcase_7a,testcase_7b]} + ]. + +all() -> + [testcase_1, + {group, test_group_1a}, + {group, test_group_1b}, + testcase_2, + {group, test_group_2}, + testcase_3, + {group, test_group_4}]. + +%% this func only for internal test purposes +grs_and_tcs() -> + {[ + test_group_1a, test_group_1b, + test_group_2, test_group_3, + test_group_4, test_group_5, + test_group_6, test_group_7 + ], + [ + testcase_1, + testcase_1a, testcase_1b, + testcase_2, + testcase_2a, testcase_2b, + testcase_3a, testcase_3b, + testcase_3, + testcase_5a, testcase_5b, + testcase_7a, testcase_7b + ]}. + +%%-------------------------------------------------------------------- +%% Suite Configuration +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + [{suite,init}|Config]. + +end_per_suite(Config) -> + init = ?config(suite,Config). + +%%-------------------------------------------------------------------- +%% Group Configuration +%%-------------------------------------------------------------------- + +init_per_group(Group, Config) -> + [{name,Group}] = ?config(tc_group_properties,Config), + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + [{Group,Group} | Config]; + false -> + ct:fail({bad_group,Group}) + end. + +end_per_group(Group, Config) -> + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + Group = ?config(Group,Config), + ok; + false -> + ct:fail({bad_group,Group}) + end. + +%%-------------------------------------------------------------------- +%% Testcase Configuration +%%-------------------------------------------------------------------- + +init_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + [{TestCase,TestCase} | Config]; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + +end_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + TestCase = ?config(TestCase,Config), + ok; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + + +%%-------------------------------------------------------------------- +%% Testcases +%%-------------------------------------------------------------------- + +testcase_1() -> + []. +testcase_1(Config) -> + init = ?config(suite,Config), + testcase_1 = ?config(testcase_1,Config), + ok. + +testcase_1a() -> + []. +testcase_1a(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + testcase_1a = ?config(testcase_1a,Config), + ok. +testcase_1b() -> + []. +testcase_1b(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + undefined = ?config(testcase_1a,Config), + testcase_1b = ?config(testcase_1b,Config), + ok. + +testcase_2() -> + []. +testcase_2(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_1a,Config), + undefined = ?config(test_group_1b,Config), + testcase_2 = ?config(testcase_2,Config), + ok. + +testcase_2a() -> + []. +testcase_2a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + testcase_2a = ?config(testcase_2a,Config), + ok. +testcase_2b() -> + []. +testcase_2b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + undefined = ?config(testcase_2a,Config), + testcase_2b = ?config(testcase_2b,Config), + ok. + +testcase_3a() -> + []. +testcase_3a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_2b,Config), + testcase_3a = ?config(testcase_3a,Config), + ok. +testcase_3b() -> + []. +testcase_3b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_3a,Config), + testcase_3b = ?config(testcase_3b,Config), + ok. + +testcase_3() -> + []. +testcase_3(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_2,Config), + undefined = ?config(test_group_3,Config), + testcase_3 = ?config(testcase_3,Config), + ok. + +testcase_5a() -> + []. +testcase_5a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_3,Config), + testcase_5a = ?config(testcase_5a,Config), + ok. +testcase_5b() -> + []. +testcase_5b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_5a,Config), + testcase_5b = ?config(testcase_5b,Config), + ok. + +testcase_7a() -> + []. +testcase_7a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + testcase_7a = ?config(testcase_7a,Config), + ok. +testcase_7b() -> + []. +testcase_7b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + undefined = ?config(testcase_7a,Config), + testcase_7b = ?config(testcase_7b,Config), + ok. diff --git a/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_2/test/groups_22_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_2/test/groups_22_SUITE.erl new file mode 100644 index 0000000000..2e19cf6310 --- /dev/null +++ b/lib/common_test/test/ct_groups_test_1_SUITE_data/groups_2/test/groups_22_SUITE.erl @@ -0,0 +1,310 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_22_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%==================================================================== +%% COMMON TEST CALLBACK FUNCTIONS +%%==================================================================== + +suite() -> + [{timetrap,{minutes,1}}]. + +groups() -> + [ + {test_group_1a, [shuffle], [testcase_1a,testcase_1b,testcase_1c]}, + + {test_group_1b, [parallel], [testcase_1a,testcase_1b]}, + + {test_group_2, [parallel], [testcase_2a, + + {test_group_3, [{repeat,1}], + [testcase_3a, testcase_3b]}, + + testcase_2b]}, + + {test_group_4, [{test_group_5, [parallel], [testcase_5a, + + {group, test_group_6}, + + testcase_5b]}]}, + + {test_group_6, [parallel], [{group, test_group_7}]}, + + {test_group_7, [sequence], [testcase_7a,testcase_7b]} + ]. + +all() -> + [{group, test_group_1a}, + {group, test_group_1b}, + testcase_1, + testcase_2, + {group, test_group_2}, + testcase_3, + {group, test_group_4}]. + +%% this func only for internal test purposes +grs_and_tcs() -> + {[ + test_group_1a, test_group_1b, + test_group_2, test_group_3, + test_group_4, test_group_5, + test_group_6, test_group_7 + ], + [ + testcase_1a, testcase_1b, testcase_1c, + testcase_1, + testcase_2, + testcase_2a, testcase_2b, + testcase_3a, testcase_3b, + testcase_3, + testcase_5a, testcase_5b, + testcase_7a, testcase_7b + ]}. + +%%-------------------------------------------------------------------- +%% Suite Configuration +%%-------------------------------------------------------------------- + +init_per_suite(Config) -> + [{suite,init}|Config]. + +end_per_suite(Config) -> + init = ?config(suite,Config). + +%%-------------------------------------------------------------------- +%% Group Configuration +%%-------------------------------------------------------------------- + +init_per_group(Group, Config) -> + Cmt = + case {Group,?config(tc_group_properties,Config)} of + {test_group_1a,[{shuffle,S},{name,test_group_1a}]} -> + io_lib:format("shuffled, ~w", [S]); + {test_group_1b,[{name,test_group_1b},parallel]} -> "parallel"; + {test_group_2,[{name,test_group_2},parallel]} -> "parallel"; + {test_group_3,[{name,test_group_3},{repeat,1}]} -> "repeat 1"; + {test_group_3,[{name,test_group_3}]} -> "repeat 0"; + {test_group_4,[{name,test_group_4}]} -> ok; + {test_group_5,[{name,test_group_5},parallel]} -> "parallel"; + {test_group_6,[{name,test_group_6},parallel]} -> "parallel"; + {test_group_7,[{name,test_group_7},sequence]} -> "sequence" + end, + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + ct:comment(io_lib:format("~w, ~s", [Group,Cmt])), + [{Group,Group} | Config]; + false -> + ct:fail({bad_group,Group}) + end. + +end_per_group(Group, Config) -> + {Grs,_} = grs_and_tcs(), + case lists:member(Group, Grs) of + true -> + init = ?config(suite,Config), + Group = ?config(Group,Config), + ok; + false -> + ct:fail({bad_group,Group}) + end. + +%%-------------------------------------------------------------------- +%% Testcase Configuration +%%-------------------------------------------------------------------- + +init_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + [{TestCase,TestCase} | Config]; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + +end_per_testcase(TestCase, Config) -> + {_,TCs} = grs_and_tcs(), + case lists:member(TestCase, TCs) of + true -> + init = ?config(suite,Config), + TestCase = ?config(TestCase,Config), + ok; + false -> + ct:fail({unknown_testcase,TestCase}) + end. + + +%%-------------------------------------------------------------------- +%% Testcases +%%-------------------------------------------------------------------- + +testcase_1a() -> + []. +testcase_1a(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + testcase_1a = ?config(testcase_1a,Config), + ok. +testcase_1b() -> + []. +testcase_1b(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + undefined = ?config(testcase_1a,Config), + testcase_1b = ?config(testcase_1b,Config), + ok. + +testcase_1c() -> + []. +testcase_1c(Config) -> + init = ?config(suite,Config), + case ?config(test_group_1a,Config) of + test_group_1a -> ok; + _ -> + case ?config(test_group_1b,Config) of + test_group_1b -> ok; + _ -> ct:fail(no_group_data) + end + end, + undefined = ?config(testcase_1b,Config), + testcase_1c = ?config(testcase_1c,Config), + ok. + +testcase_1() -> + []. +testcase_1(Config) -> + init = ?config(suite,Config), + testcase_1 = ?config(testcase_1,Config), + ok. + +testcase_2() -> + []. +testcase_2(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_1a,Config), + undefined = ?config(test_group_1b,Config), + testcase_2 = ?config(testcase_2,Config), + ok. + +testcase_2a() -> + []. +testcase_2a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + testcase_2a = ?config(testcase_2a,Config), + ok. +testcase_2b() -> + []. +testcase_2b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + undefined = ?config(testcase_2a,Config), + testcase_2b = ?config(testcase_2b,Config), + ok. + +testcase_3a() -> + []. +testcase_3a(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_2b,Config), + testcase_3a = ?config(testcase_3a,Config), + ok. +testcase_3b() -> + []. +testcase_3b(Config) -> + init = ?config(suite,Config), + test_group_2 = ?config(test_group_2,Config), + test_group_3 = ?config(test_group_3,Config), + undefined = ?config(testcase_3a,Config), + testcase_3b = ?config(testcase_3b,Config), + ok. + +testcase_3() -> + []. +testcase_3(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_2,Config), + undefined = ?config(test_group_3,Config), + testcase_3 = ?config(testcase_3,Config), + ok. + +testcase_5a() -> + []. +testcase_5a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_3,Config), + testcase_5a = ?config(testcase_5a,Config), + ok. +testcase_5b() -> + []. +testcase_5b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + undefined = ?config(testcase_5a,Config), + testcase_5b = ?config(testcase_5b,Config), + ok. + +testcase_7a() -> + []. +testcase_7a(Config) -> + init = ?config(suite,Config), + undefined = ?config(test_group_3,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + testcase_7a = ?config(testcase_7a,Config), + ok. +testcase_7b() -> + []. +testcase_7b(Config) -> + init = ?config(suite,Config), + test_group_4 = ?config(test_group_4,Config), + test_group_5 = ?config(test_group_5,Config), + test_group_6 = ?config(test_group_6,Config), + test_group_7 = ?config(test_group_7,Config), + undefined = ?config(testcase_7a,Config), + testcase_7b = ?config(testcase_7b,Config), + ok. diff --git a/lib/common_test/test/ct_groups_test_2_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE.erl new file mode 100644 index 0000000000..5a60d855b7 --- /dev/null +++ b/lib/common_test/test/ct_groups_test_2_SUITE.erl @@ -0,0 +1,110 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_test_2_SUITE +%%% +%%% Description: +%%% Test some simple test case group scenarios. +%%% +%%% The suites used for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_groups_test_2_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.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). + +all(doc) -> + ["Run smoke tests of Common Test."]; + +all(suite) -> + [missing_conf]. + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% + +missing_conf(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Suite = filename:join(DataDir, "groups_1/missing_conf_SUITE"), + + {Opts,ERPid} = setup({suite,Suite}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(missing_conf_SUITE, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(missing_conf), + ok = ct_test_support:verify_events(TestEvents, Events, 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 ++ [Test,{event_handler,{?eh,EvHArgs}}], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). +%reformat(Events, _EH) -> +% Events. + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- + +test_events(missing_conf) -> + exit(must_handle_this). diff --git a/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_1/missing_conf_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_1/missing_conf_SUITE.erl new file mode 100644 index 0000000000..e7f48daaee --- /dev/null +++ b/lib/common_test/test/ct_groups_test_2_SUITE_data/groups_1/missing_conf_SUITE.erl @@ -0,0 +1,62 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(missing_conf_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{group1,[],[tc1,tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [{group,group1}]. + +tc1(_) -> + ok. + +tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE.erl b/lib/common_test/test/ct_skip_SUITE.erl new file mode 100644 index 0000000000..9f428723f5 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE.erl @@ -0,0 +1,565 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_skip_SUITE +%%% +%%% Description: +%%% Test auto- and user-skip functionality +%%% +%%% The suites used for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_skip_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.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). + +all(doc) -> + [""]; + +all(suite) -> + [ + auto_skip, + user_skip + ]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +auto_skip(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Join = fun(D, S) -> filename:join(D, "skip/test/"++S) end, + Suites = [Join(DataDir, "auto_skip_1_SUITE"), + Join(DataDir, "auto_skip_2_SUITE"), + Join(DataDir, "auto_skip_3_SUITE"), + Join(DataDir, "auto_skip_4_SUITE"), + Join(DataDir, "auto_skip_5_SUITE"), + Join(DataDir, "auto_skip_6_SUITE"), + Join(DataDir, "auto_skip_7_SUITE"), + Join(DataDir, "auto_skip_8_SUITE"), + Join(DataDir, "auto_skip_9_SUITE"), + Join(DataDir, "auto_skip_10_SUITE"), + Join(DataDir, "auto_skip_11_SUITE") + ], + + {Opts,ERPid} = setup({suite,Suites}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(auto_skip, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(auto_skip), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% +user_skip(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + Join = fun(D, S) -> filename:join(D, "skip/test/"++S) end, + Suites = [Join(DataDir, "user_skip_1_SUITE"), + Join(DataDir, "user_skip_2_SUITE"), + Join(DataDir, "user_skip_3_SUITE"), + Join(DataDir, "user_skip_4_SUITE"), + Join(DataDir, "user_skip_5_SUITE")], + + {Opts,ERPid} = setup({suite,Suites}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(user_skip, + reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(user_skip), + ok = ct_test_support:verify_events(TestEvents, Events, 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 ++ [Test,{event_handler,{?eh,EvHArgs}}], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). +%reformat(Events, _EH) -> +% Events. + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +test_events(auto_skip) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{11,11,34}}, + + {?eh,tc_start,{auto_skip_1_SUITE,init_per_suite}}, + {?eh,tc_done, + {auto_skip_1_SUITE,init_per_suite,{failed,{error,init_per_suite_failed}}}}, + {?eh,tc_auto_skip, + {auto_skip_1_SUITE,tc1,{failed,{auto_skip_1_SUITE,init_per_suite, + {'EXIT',init_per_suite_failed}}}}}, + {?eh,test_stats,{0,0,{0,1}}}, + {?eh,tc_auto_skip, + {auto_skip_1_SUITE,tc2,{failed,{auto_skip_1_SUITE,init_per_suite, + {'EXIT',init_per_suite_failed}}}}}, + {?eh,test_stats,{0,0,{0,2}}}, + {?eh,tc_auto_skip, + {auto_skip_1_SUITE,end_per_suite,{failed,{auto_skip_1_SUITE,init_per_suite, + {'EXIT',init_per_suite_failed}}}}}, + + {?eh,tc_start,{auto_skip_2_SUITE,init_per_suite}}, + {?eh,tc_done, + {auto_skip_2_SUITE,init_per_suite,{failed,{error,init_per_suite_failed}}}}, + {?eh,tc_auto_skip, + {auto_skip_2_SUITE,tc1,{failed,{auto_skip_2_SUITE,init_per_suite, + {'EXIT',init_per_suite_failed}}}}}, + {?eh,test_stats,{0,0,{0,3}}}, + {?eh,tc_auto_skip, + {auto_skip_2_SUITE,end_per_suite,{failed,{auto_skip_2_SUITE,init_per_suite, + {'EXIT',init_per_suite_failed}}}}}, + + {?eh,tc_start,{auto_skip_3_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_3_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{auto_skip_3_SUITE,tc1}}, + {?eh,tc_done, + {auto_skip_3_SUITE,tc1, + {skipped,{failed,{auto_skip_3_SUITE,init_per_testcase, + {init_per_testcase,tc1,failed}}}}}}, + {?eh,test_stats,{0,0,{0,4}}}, + {?eh,tc_start,{auto_skip_3_SUITE,tc2}}, + {?eh,tc_done,{auto_skip_3_SUITE,tc2,ok}}, + {?eh,test_stats,{1,0,{0,4}}}, + {?eh,tc_start,{auto_skip_3_SUITE,end_per_suite}}, + {?eh,tc_done,{auto_skip_3_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{auto_skip_4_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_4_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{auto_skip_4_SUITE,tc1}}, + {?eh,tc_done,{auto_skip_4_SUITE,tc1, + {skipped,{failed,{auto_skip_4_SUITE,init_per_testcase, + {timetrap_timeout,1000}}}}}}, + {?eh,test_stats,{1,0,{0,5}}}, + {?eh,tc_start,{auto_skip_4_SUITE,tc2}}, + {?eh,tc_done,{auto_skip_4_SUITE,tc2,ok}}, + {?eh,test_stats,{2,0,{0,5}}}, + {?eh,tc_start,{auto_skip_4_SUITE,end_per_suite}}, + {?eh,tc_done,{auto_skip_4_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{auto_skip_5_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_5_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{auto_skip_5_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done, + {auto_skip_5_SUITE,{init_per_group,g1,[]},{failed,{error,{group,g1,failed}}}}}, + {?eh,tc_auto_skip, + {auto_skip_5_SUITE,tc1,{failed,{auto_skip_5_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}, + {?eh,test_stats,{2,0,{0,6}}}, + {?eh,tc_auto_skip, + {auto_skip_5_SUITE,tc2,{failed,{auto_skip_5_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}, + {?eh,test_stats,{2,0,{0,7}}}, + {?eh,tc_auto_skip, + {auto_skip_5_SUITE,end_per_group,{failed,{auto_skip_5_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}], + + {?eh,tc_start,{auto_skip_5_SUITE,end_per_suite}}, + {?eh,tc_done,{auto_skip_5_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{auto_skip_6_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_6_SUITE,init_per_suite,ok}}, + [{?eh,tc_start,{auto_skip_6_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done, + {auto_skip_6_SUITE,{init_per_group,g1,[]},{failed,{error,{group,g1,failed}}}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,tc1,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}, + {?eh,test_stats,{2,0,{0,8}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,tc3,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}, + {?eh,test_stats,{2,0,{0,9}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,tc4,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}, + {?eh,test_stats,{2,0,{0,10}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,tc2,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}, + {?eh,test_stats,{2,0,{0,11}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,end_per_group,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g1,failed}}}}}}], + + [{?eh,tc_start,{auto_skip_6_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{auto_skip_6_SUITE,{init_per_group,g3,[]},ok}}, + {?eh,tc_start,{auto_skip_6_SUITE,tc1}}, + {?eh,tc_done,{auto_skip_6_SUITE,tc1,ok}}, + {?eh,test_stats,{3,0,{0,11}}}, + [{?eh,tc_start,{auto_skip_6_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{auto_skip_6_SUITE,{init_per_group,g4,[]}, + {failed,{error,{group,g4,failed}}}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,tc3,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g4,failed}}}}}}, + {?eh,test_stats,{3,0,{0,12}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,tc4,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g4,failed}}}}}}, + {?eh,test_stats,{3,0,{0,13}}}, + {?eh,tc_auto_skip, + {auto_skip_6_SUITE,end_per_group,{failed,{auto_skip_6_SUITE,init_per_group, + {'EXIT',{group,g4,failed}}}}}}], + {?eh,tc_start,{auto_skip_6_SUITE,tc2}}, + {?eh,tc_done,{auto_skip_6_SUITE,tc2,ok}}, + {?eh,test_stats,{4,0,{0,13}}}, + {?eh,tc_start,{auto_skip_6_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{auto_skip_6_SUITE,{end_per_group,g3,[]},ok}}], + + {?eh,tc_start,{auto_skip_6_SUITE,end_per_suite}}, + {?eh,tc_done,{auto_skip_6_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{auto_skip_7_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_7_SUITE,init_per_suite,ok}}, + {?eh,tc_auto_skip, + {auto_skip_7_SUITE,tc1,{failed,{auto_skip_7_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{4,0,{0,14}}}, + {?eh,tc_auto_skip, + {auto_skip_7_SUITE,tc2,{failed,{auto_skip_7_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{4,0,{0,15}}}, + {?eh,tc_auto_skip, + {auto_skip_7_SUITE,end_per_suite,{failed,{auto_skip_7_SUITE,init_per_suite,bad_return}}}}, + + {?eh,tc_start,{auto_skip_8_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_8_SUITE,init_per_suite,ok}}, + {?eh,tc_auto_skip, + {auto_skip_8_SUITE,tc1,{failed,{auto_skip_8_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{4,0,{0,16}}}, + {?eh,tc_auto_skip, + {auto_skip_8_SUITE,tc2,{failed,{auto_skip_8_SUITE,init_per_suite,bad_return}}}}, + {?eh,test_stats,{4,0,{0,17}}}, + {?eh,tc_auto_skip, + {auto_skip_8_SUITE,end_per_suite,{failed,{auto_skip_8_SUITE,init_per_suite,bad_return}}}}, + + {?eh,tc_start,{auto_skip_9_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_9_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc1}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc1,ok}}, + {?eh,test_stats,{5,0,{0,17}}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc2}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc2, + {skipped,{failed,{auto_skip_9_SUITE,init_per_testcase,bad_return}}}}}, + {?eh,test_stats,{5,0,{0,18}}}, + + [{?eh,tc_start,{auto_skip_9_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{auto_skip_9_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc3}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc3,ok}}, + {?eh,test_stats,{6,0,{0,18}}}, + {?eh,tc_start,{auto_skip_9_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{auto_skip_9_SUITE,{end_per_group,g1,[]},ok}}], + + [{?eh,tc_start,{auto_skip_9_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{auto_skip_9_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc4}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc4,ok}}, + {?eh,test_stats,{7,0,{0,18}}}, + {?eh,tc_start,{auto_skip_9_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{auto_skip_9_SUITE,{end_per_group,g2,[]},ok}}], + + [{?eh,tc_start,{auto_skip_9_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{auto_skip_9_SUITE,{init_per_group,g3,[]},ok}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc5}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc5, + {skipped,{failed,{auto_skip_9_SUITE,init_per_testcase,bad_return}}}}}, + {?eh,test_stats,{7,0,{0,19}}}, + {?eh,tc_start,{auto_skip_9_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{auto_skip_9_SUITE,{end_per_group,g3,[]},ok}}], + + {parallel, + [{?eh,tc_start, + {auto_skip_9_SUITE,{init_per_group,g4,[parallel]}}}, + {?eh,tc_done, + {auto_skip_9_SUITE,{init_per_group,g4,[parallel]},ok}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc6}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc6,ok}}, + {parallel, + [{?eh,tc_start, + {auto_skip_9_SUITE,{init_per_group,g5,[parallel]}}}, + {?eh,tc_done, + {auto_skip_9_SUITE,{init_per_group,g5,[parallel]},ok}}, + {?eh,tc_start,{auto_skip_9_SUITE,tc8}}, + {?eh,tc_done, + {auto_skip_9_SUITE,tc8, + {skipped,{failed,{auto_skip_9_SUITE,init_per_testcase, + {{badmatch,undefined}, + [{auto_skip_9_SUITE,init_per_testcase,2}, + {test_server,my_apply,3}, + {test_server,init_per_testcase,3}, + {test_server,run_test_case_eval1,6}, + {test_server,run_test_case_eval,8}]}}}}}}, + {?eh,tc_start, + {auto_skip_9_SUITE,{end_per_group,g5,[parallel]}}}, + {?eh,tc_done, + {auto_skip_9_SUITE,{end_per_group,g5,[parallel]},ok}}]}, + + {?eh,tc_start,{auto_skip_9_SUITE,tc7}}, + {?eh,tc_done,{auto_skip_9_SUITE,tc7,ok}}, + {?eh,test_stats,{9,0,{0,20}}}, + {?eh,tc_start, + {auto_skip_9_SUITE,{end_per_group,g4,[parallel]}}}, + {?eh,tc_done, + {auto_skip_9_SUITE,{end_per_group,g4,[parallel]},ok}}]}, + + {?eh,tc_start,{auto_skip_9_SUITE,end_per_suite}}, + {?eh,tc_done,{auto_skip_9_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{auto_skip_10_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_10_SUITE,init_per_suite, + {skipped, + {require_failed_in_suite0, + {not_available,undefined_config_variable}}}}}, + {?eh,tc_auto_skip, + {auto_skip_10_SUITE,tc1, + {require_failed_in_suite0,{not_available,undefined_config_variable}}}}, + {?eh,test_stats,{9,0,{0,21}}}, + {?eh,tc_auto_skip, + {auto_skip_10_SUITE,tc2, + {require_failed_in_suite0,{not_available,undefined_config_variable}}}}, + {?eh,test_stats,{9,0,{0,22}}}, + {?eh,tc_auto_skip, + {auto_skip_10_SUITE,end_per_suite, + {require_failed_in_suite0,{not_available,undefined_config_variable}}}}, + + {?eh,tc_start,{auto_skip_11_SUITE,init_per_suite}}, + {?eh,tc_done,{auto_skip_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{auto_skip_11_SUITE,tc1}}, + {?eh,tc_done,{auto_skip_11_SUITE,tc1, + {skipped,{require_failed,{not_available,undefined_config_variable}}}}}, + {?eh,test_stats,{9,0,{0,23}}}, + {?eh,tc_start,{auto_skip_11_SUITE,tc2}}, + {?eh,tc_done,{auto_skip_11_SUITE,tc2,ok}}, + {?eh,test_stats,{10,0,{0,23}}}, + + {parallel, + [{?eh,tc_start, + {auto_skip_11_SUITE,{init_per_group,g1,[parallel]}}}, + {?eh,tc_done, + {auto_skip_11_SUITE,{init_per_group,g1,[parallel]},ok}}, + {parallel, + [{?eh,tc_start, + {auto_skip_11_SUITE,{init_per_group,g2,[parallel]}}}, + {?eh,tc_done, + {auto_skip_11_SUITE,{init_per_group,g2,[parallel]},ok}}, + {?eh,tc_start,{auto_skip_11_SUITE,tc3}}, + {?eh,tc_done, + {auto_skip_11_SUITE,tc3, + {skipped,{require_failed,{not_available,undefined_config_variable}}}}}, + {?eh,test_stats,{10,0,{0,24}}}, + {?eh,tc_start, + {auto_skip_11_SUITE,{end_per_group,g2,[parallel]}}}, + {?eh,tc_done, + {auto_skip_11_SUITE,{end_per_group,g2,[parallel]},ok}}]}, + {?eh,tc_start, + {auto_skip_11_SUITE,{end_per_group,g1,[parallel]}}}, + {?eh,tc_done, + {auto_skip_11_SUITE,{end_per_group,g1,[parallel]},ok}}]}, + + {?eh,tc_start,{auto_skip_11_SUITE,end_per_suite}}, + {?eh,tc_done,{auto_skip_11_SUITE,end_per_suite,ok}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(user_skip) -> + [{?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{5,5,27}}, + + {?eh,tc_start,{user_skip_1_SUITE,init_per_suite}}, + {?eh,tc_done, + {user_skip_1_SUITE,init_per_suite,{skipped,"Whole suite skipped"}}}, + {?eh,tc_auto_skip, + {user_skip_1_SUITE,tc1,"Whole suite skipped"}}, + {?eh,test_stats,{0,0,{0,1}}}, + {?eh,tc_auto_skip, + {user_skip_1_SUITE,tc2,"Whole suite skipped"}}, + {?eh,test_stats,{0,0,{0,2}}}, + {?eh,tc_auto_skip, + {user_skip_1_SUITE,tc3,"Whole suite skipped"}}, + {?eh,test_stats,{0,0,{0,3}}}, + {?eh,tc_auto_skip, + {user_skip_1_SUITE,tc4,"Whole suite skipped"}}, + {?eh,test_stats,{0,0,{0,4}}}, + {?eh,tc_auto_skip, + {user_skip_1_SUITE,end_per_suite,"Whole suite skipped"}}, + + {?eh,tc_start,{user_skip_2_SUITE,init_per_suite}}, + {?eh,tc_done,{user_skip_2_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{user_skip_2_SUITE,tc1}}, + {?eh,tc_done,{user_skip_2_SUITE,tc1,{skipped,{tc1,skipped}}}}, + {?eh,test_stats,{0,0,{1,4}}}, + + [{?eh,tc_start,{user_skip_2_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{user_skip_2_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_start,{user_skip_2_SUITE,tc2}}, + {?eh,tc_done,{user_skip_2_SUITE,tc2,ok}}, + {?eh,test_stats,{1,0,{1,4}}}, + {?eh,tc_start,{user_skip_2_SUITE,tc3}}, + {?eh,tc_done,{user_skip_2_SUITE,tc3,{skipped,{tc3,skipped}}}}, + {?eh,test_stats,{1,0,{2,4}}}, + {?eh,tc_start,{user_skip_2_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{user_skip_2_SUITE,{end_per_group,g1,[]},ok}}], + + {?eh,tc_start,{user_skip_2_SUITE,tc4}}, + {?eh,tc_done,{user_skip_2_SUITE,tc4,ok}}, + {?eh,test_stats,{2,0,{2,4}}}, + {?eh,tc_start,{user_skip_2_SUITE,end_per_suite}}, + {?eh,tc_done,{user_skip_2_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{user_skip_3_SUITE,init_per_suite}}, + {?eh,tc_done,{user_skip_3_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{user_skip_3_SUITE,tc1}}, + {?eh,tc_done,{user_skip_3_SUITE,tc1,{skipped,"Test case skipped"}}}, + {?eh,test_stats,{2,0,{3,4}}}, + + [{?eh,tc_start,{user_skip_3_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{user_skip_3_SUITE,{init_per_group,g1,[]},ok}}, + {?eh,tc_start,{user_skip_3_SUITE,tc2}}, + {?eh,tc_done,{user_skip_3_SUITE,tc2,ok}}, + {?eh,test_stats,{3,0,{3,4}}}, + {?eh,tc_start,{user_skip_3_SUITE,tc3}}, + {?eh,tc_done,{user_skip_3_SUITE,tc3,{skipped,"Test case skipped"}}}, + {?eh,test_stats,{3,0,{4,4}}}, + {?eh,tc_start,{user_skip_3_SUITE,{end_per_group,g1,[]}}}, + {?eh,tc_done,{user_skip_3_SUITE,{end_per_group,g1,[]},ok}}], + + {?eh,tc_start,{user_skip_3_SUITE,tc4}}, + {?eh,tc_done,{user_skip_3_SUITE,tc4, + {skipped,{proc_info,{{current_function,{user_skip_3_SUITE,tc4,1}}, + {initial_call,{erlang,apply,2}}}}}}}, + {?eh,test_stats,{3,0,{5,4}}}, + {?eh,tc_start,{user_skip_3_SUITE,end_per_suite}}, + {?eh,tc_done,{user_skip_3_SUITE,end_per_suite,ok}}, + + {?eh,tc_start,{user_skip_4_SUITE,init_per_suite}}, + {?eh,tc_done,{user_skip_4_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{user_skip_4_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{init_per_group,g1,[]},{skipped,"Group skipped"}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc1,"Group skipped"}}, + {?eh,test_stats,{3,0,{5,5}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc2,"Group skipped"}}, + {?eh,test_stats,{3,0,{5,6}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,end_per_group,"Group skipped"}}], + + [{?eh,tc_start,{user_skip_4_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_start,{user_skip_4_SUITE,tc3}}, + {?eh,tc_done,{user_skip_4_SUITE,tc3,ok}}, + {?eh,test_stats,{4,0,{5,6}}}, + {?eh,tc_start,{user_skip_4_SUITE,tc4}}, + {?eh,tc_done,{user_skip_4_SUITE,tc4,ok}}, + {?eh,test_stats,{5,0,{5,6}}}, + {?eh,tc_start,{user_skip_4_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{end_per_group,g2,[]},ok}}], + + [{?eh,tc_start,{user_skip_4_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{init_per_group,g3,[]},{skipped,"Group skipped"}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc5,"Group skipped"}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc6,"Group skipped"}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc7,"Group skipped"}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc8,"Group skipped"}}, + {?eh,test_stats,{5,0,{5,10}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,end_per_group,"Group skipped"}}], + + [{?eh,tc_start,{user_skip_4_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_start,{user_skip_4_SUITE,tc9}}, + {?eh,tc_done,{user_skip_4_SUITE,tc9,ok}}, + {?eh,test_stats,{6,0,{5,10}}}, + [{?eh,tc_start,{user_skip_4_SUITE,{init_per_group,g6,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{init_per_group,g6,[]},{skipped,"Group skipped"}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc10,"Group skipped"}}, + {?eh,test_stats,{6,0,{5,11}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,tc11,"Group skipped"}}, + {?eh,test_stats,{6,0,{5,12}}}, + {?eh,tc_auto_skip,{user_skip_4_SUITE,end_per_group,"Group skipped"}}], + {?eh,tc_start,{user_skip_4_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{user_skip_4_SUITE,{end_per_group,g5,[]},ok}}], + + {?eh,tc_start,{user_skip_4_SUITE,end_per_suite}}, + {?eh,tc_done,{user_skip_4_SUITE,end_per_suite,ok}}, + + {ct_test_support_eh,tc_start,{user_skip_5_SUITE,init_per_suite}}, + {?eh,tc_done,{user_skip_5_SUITE,init_per_suite, + {skipped,{bad,'Whole suite skipped'}}}}, + {?eh,tc_auto_skip,{user_skip_5_SUITE,tc1,{bad,'Whole suite skipped'}}}, + {?eh,test_stats,{6,0,{5,13}}}, + {?eh,tc_auto_skip,{user_skip_5_SUITE,tc2,{bad,'Whole suite skipped'}}}, + {?eh,test_stats,{6,0,{5,14}}}, + {?eh,tc_auto_skip,{user_skip_5_SUITE,tc3,{bad,'Whole suite skipped'}}}, + {?eh,test_stats,{6,0,{5,15}}}, + {?eh,tc_auto_skip,{user_skip_5_SUITE,tc4,{bad,'Whole suite skipped'}}}, + {?eh,test_stats,{6,0,{5,16}}}, + {?eh,tc_auto_skip,{user_skip_5_SUITE,end_per_suite,{bad,'Whole suite skipped'}}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_10_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_10_SUITE.erl new file mode 100644 index 0000000000..b93c68e126 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_10_SUITE.erl @@ -0,0 +1,130 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_10_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{require,undefined_config_variable}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_11_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_11_SUITE.erl new file mode 100644 index 0000000000..c0a662f4b2 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_11_SUITE.erl @@ -0,0 +1,136 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_11_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + []. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[parallel],[{g2,[parallel],[tc3]}]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2,{group,g1}]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + [{require,undefined_config_variable}]. + +tc3() -> + [{require,undefined_config_variable}]. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + exit(should_be_auto_skipped). + +tc2(_Config) -> + ok. + +tc3(_Config) -> + exit(should_be_auto_skipped). diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_1_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_1_SUITE.erl new file mode 100644 index 0000000000..247e478fa3 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_1_SUITE.erl @@ -0,0 +1,130 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(_Config) -> + exit(init_per_suite_failed). + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_2_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_2_SUITE.erl new file mode 100644 index 0000000000..3d332d2a28 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_2_SUITE.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(_Config) -> + exit(init_per_suite_failed). + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc1]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [{group,g1}]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_3_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_3_SUITE.erl new file mode 100644 index 0000000000..cb64cb76c5 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_3_SUITE.erl @@ -0,0 +1,132 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_3_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(tc1, _Config) -> + exit({init_per_testcase,tc1,failed}); +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_4_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_4_SUITE.erl new file mode 100644 index 0000000000..825846cd55 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_4_SUITE.erl @@ -0,0 +1,126 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_4_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,1}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(tc1, Config) -> + timer:sleep(5000), + Config; +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2]. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_5_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_5_SUITE.erl new file mode 100644 index 0000000000..2cf07928bb --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_5_SUITE.erl @@ -0,0 +1,123 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_5_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,1}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(GroupName, _Config) -> + exit({group,GroupName,failed}). + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc1,tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [{group,g1}]. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_6_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_6_SUITE.erl new file mode 100644 index 0000000000..c950fed6b7 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_6_SUITE.erl @@ -0,0 +1,136 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_6_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,1}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(g1, _Config) -> + exit({group,g1,failed}); +init_per_group(g2, Config) -> + Config; +init_per_group(g3, Config) -> + Config; +init_per_group(g4, _Config) -> + exit({group,g4,failed}). + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc1,{g2,[],[tc3,tc4]},tc2]}, + {g3,[],[tc1,{g4,[],[tc3,tc4]},tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [{group,g1},{group,g3}]. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. + +tc3(_Config) -> + ok. + +tc4(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_7_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_7_SUITE.erl new file mode 100644 index 0000000000..6146459bf2 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_7_SUITE.erl @@ -0,0 +1,130 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_7_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_8_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_8_SUITE.erl new file mode 100644 index 0000000000..462d6b4e79 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_8_SUITE.erl @@ -0,0 +1,130 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_8_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + [{x,y,z}|Config]. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. + +tc2(_Config) -> + ok. diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_9_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_9_SUITE.erl new file mode 100644 index 0000000000..e2d6bcf7d6 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/auto_skip_9_SUITE.erl @@ -0,0 +1,166 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(auto_skip_9_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(g1, Config) -> + ok; +init_per_group(g2, Config) -> + [{x,y,z}|Config]; +init_per_group(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(tc2, Config) -> + {ok,Config}; +init_per_testcase(tc5, Config) -> + ok; +init_per_testcase(tc8, Config) -> + huh = ?config(void, Config), + Config; +init_per_testcase(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc3]}, + {g2,[],[tc4]}, + {g3,[],[tc5]}, + {g4,[parallel],[tc6,{group,g5},tc7]}, + {g5,[parallel],[tc8]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1,tc2,{group,g1},{group,g2},{group,g3},{group,g4}]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ct:comment("Should be ok"), + true. + +tc2(_Config) -> + exit("Should fail in init_per_testcase"). + +tc3(Config) -> + ?config(data_dir, Config). + +tc4(Config) -> + ?config(data_dir, Config). + +tc5(_Config) -> + exit("Should fail in init_per_testcase"). + +tc6(_Config) -> + done. + +tc7(_Config) -> + done. + +tc8(_Config) -> + exit("Should fail in init_per_testcase"). + + diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_1_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_1_SUITE.erl new file mode 100644 index 0000000000..60fc0f1122 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_1_SUITE.erl @@ -0,0 +1,131 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(user_skip_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(_Config) -> + {skip,"Whole suite skipped"}. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2,tc3]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1, {group,g1}, tc4]. + + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_) -> + ok. + +tc2(_) -> + ok. + +tc3(_) -> + ok. + +tc4(_) -> + ok. + diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_2_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_2_SUITE.erl new file mode 100644 index 0000000000..91a046a531 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_2_SUITE.erl @@ -0,0 +1,135 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(user_skip_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(tc1, _Config) -> + {skip,{tc1,skipped}}; +init_per_testcase(tc3, _Config) -> + {skip,{tc3,skipped}}; +init_per_testcase(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2,tc3]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1, {group,g1}, tc4]. + + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_) -> + ok. + +tc2(_) -> + ok. + +tc3(_) -> + ok. + +tc4(_) -> + ok. + diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_3_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_3_SUITE.erl new file mode 100644 index 0000000000..c362117bba --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_3_SUITE.erl @@ -0,0 +1,132 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(user_skip_3_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2,tc3]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1, {group,g1}, tc4]. + + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_) -> + {skip,"Test case skipped"}. + +tc2(_) -> + ok. + +tc3(_) -> + {skip,"Test case skipped"}. + +tc4(_) -> + {skip,{proc_info,{process_info(self(),current_function), + process_info(self(),initial_call)}}}. + diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_4_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_4_SUITE.erl new file mode 100644 index 0000000000..77fd5a2b5b --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_4_SUITE.erl @@ -0,0 +1,152 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(user_skip_4_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(g1, _Config) -> + {skip,"Group skipped"}; +init_per_group(g3, _Config) -> + {skip,"Group skipped"}; +init_per_group(g6, _Config) -> + {skip,"Group skipped"}; +init_per_group(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc1,tc2]}, + {g2,[],[tc3,tc4]}, + {g3,[],[tc5,{g4,[],[tc6,tc7]},tc8]}, + {g5,[],[tc9,{g6,[],[tc10,tc11]}]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [{group,g1}, {group,g2}, {group,g3}, {group,g5}]. + + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_) -> + ok. +tc2(_) -> + ok. +tc3(_) -> + ok. +tc4(_) -> + ok. +tc5(_) -> + ok. +tc6(_) -> + ok. +tc7(_) -> + ok. +tc8(_) -> + ok. +tc9(_) -> + ok. +tc10(_) -> + ok. +tc11(_) -> + ok. + + diff --git a/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_5_SUITE.erl b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_5_SUITE.erl new file mode 100644 index 0000000000..4bffa202d6 --- /dev/null +++ b/lib/common_test/test/ct_skip_SUITE_data/skip/test/user_skip_5_SUITE.erl @@ -0,0 +1,131 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(user_skip_5_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(_Config) -> + {skip,{bad,'Whole suite skipped'}}. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[tc2,tc3]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1, {group,g1}, tc4]. + + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_) -> + ok. + +tc2(_) -> + ok. + +tc3(_) -> + ok. + +tc4(_) -> + ok. + diff --git a/lib/common_test/test/ct_smoke_test_SUITE.erl b/lib/common_test/test/ct_smoke_test_SUITE.erl new file mode 100644 index 0000000000..f1c695f614 --- /dev/null +++ b/lib/common_test/test/ct_smoke_test_SUITE.erl @@ -0,0 +1,569 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2010. 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_smoke_test_SUITE.erl +%%% +%%% Description: The purpose of this suite is to test that Common Test +%%% can be started properly and that simple dummy test suites are +%%% executed without unexpected crashes or hangings. The suites used +%%% for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_smoke_test_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(eh, ct_test_support_eh). + +%%-------------------------------------------------------------------- +%% TEST SERVER CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> Config1 | {skip,Reason} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the suite. +%% +%% 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. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config) -> void() +%% +%% Config = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after the suite. +%%-------------------------------------------------------------------- +end_per_suite(Config) -> + ct_test_support:end_per_suite(Config). + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> Config1 | +%% {skip,Reason} +%% TestCase = atom() +%% Name of the test case that is about to run. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the test case. +%% +%% Description: Initialization before each test case. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_testcase(TestCase, Config) -> + ct_test_support:init_per_testcase(TestCase, Config). + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config) -> void() +%% +%% TestCase = atom() +%% Name of the test case that is finished. +%% Config = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after each test case. +%%-------------------------------------------------------------------- +end_per_testcase(TestCase, Config) -> + ct_test_support:end_per_testcase(TestCase, Config). + +%%-------------------------------------------------------------------- +%% Function: all(Clause) -> Descr | TestCases | {skip,Reason} +%% +%% Clause = doc | suite +%% Indicates expected return value. +%% Descr = [string()] | [] +%% String that describes the test suite. +%% TestCases = [TestCase] +%% TestCase = atom() +%% Name of a test case. +%% Reason = term() +%% The reason for skipping the test suite. +%% +%% Description: Returns a description of the test suite (doc) and a +%% list of all test cases in the suite (suite). +%%-------------------------------------------------------------------- +all(doc) -> + ["Run smoke tests of Common Test."]; + +all(suite) -> + [dir1, dir2, dir1_2, + suite11, suite21, suite11_21, + tc111, tc211, tc111_112]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Function: TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason} +%% +%% Arg = doc | suite | Config +%% Indicates expected behaviour and return value. +%% Config = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Descr = [string()] | [] +%% String that describes the test case. +%% Spec = [tuple()] | [] +%% A test specification. +%% Reason = term() +%% The reason for skipping the test case. +%% +%% Description: Test case function. Returns a description of the test +%% case (doc), then returns a test specification (suite), +%% or performs the actual test (Config). +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% + +dir1(doc) -> + []; +dir1(suite) -> + []; +dir1(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy1 = filename:join(DataDir, "happy_1"), + Happy1Cfg = filename:join(Happy1, "cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy1Cfg}, {dir,Happy1}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(dir1, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(dir1), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +dir2(doc) -> + []; +dir2(suite) -> + []; +dir2(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy2 = filename:join(DataDir, "happy_2_test"), + Happy2Cfg = filename:join(DataDir, "happy_2_cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy2Cfg}, {dir,Happy2}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(dir2, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(dir2), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +dir1_2(doc) -> + []; +dir1_2(suite) -> + []; +dir1_2(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy1 = filename:join(DataDir, "happy_1"), + Happy2 = filename:join(DataDir, "happy_2_test"), + Happy1Cfg = filename:join(Happy1, "cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy1Cfg}, {dir,[Happy1,Happy2]}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(dir1_2, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(dir1_2), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +suite11(doc) -> + []; +suite11(suite) -> + []; +suite11(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy1 = filename:join(DataDir, "happy_1"), + Suite = filename:join(Happy1, "test/happy_11_SUITE"), + Happy1Cfg = filename:join(Happy1, "cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy1Cfg}, {suite,Suite}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(suite11, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(suite11), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +suite21(doc) -> + []; +suite21(suite) -> + []; +suite21(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Suite = filename:join(DataDir, "happy_2_test/happy_21_SUITE"), + Happy2Cfg = filename:join(DataDir, "happy_2_cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy2Cfg}, {suite,Suite}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(suite21, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(suite21), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +suite11_21(doc) -> + []; +suite11_21(suite) -> + []; +suite11_21(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy1 = filename:join(DataDir, "happy_1"), + Suite11 = filename:join(Happy1, "test/happy_11_SUITE"), + Happy1Cfg = filename:join(Happy1, "cfg/config1.cfg"), + Suite21 = filename:join(DataDir, "happy_2_test/happy_21_SUITE"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy1Cfg}, {suite,[Suite11,Suite21]}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(suite11_21, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(suite11_21), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +tc111(doc) -> + []; +tc111(suite) -> + []; +tc111(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy1 = filename:join(DataDir, "happy_1"), + Suite = filename:join(Happy1, "test/happy_11_SUITE"), + Happy1Cfg = filename:join(Happy1, "cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy1Cfg}, {suite,Suite}, + {testcase,tc1}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(tc111, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(tc111), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +tc211(doc) -> + []; +tc211(suite) -> + []; +tc211(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Suite = filename:join(DataDir, "happy_2_test/happy_21_SUITE"), + Happy2Cfg = filename:join(DataDir, "happy_2_cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy2Cfg}, {suite,Suite}, + {testcase,tc1}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(tc211, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(tc211), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + +%%%----------------------------------------------------------------- +%%% + +tc111_112(doc) -> + []; +tc111_112(suite) -> + []; +tc111_112(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + + Happy1 = filename:join(DataDir, "happy_1"), + Suite = filename:join(Happy1, "test/happy_11_SUITE"), + Happy1Cfg = filename:join(Happy1, "cfg/config1.cfg"), + + Opts0 = ct_test_support:get_opts(Config), + Opts = eh_opts(Config) ++ Opts0 ++ [{config,Happy1Cfg}, {suite,Suite}, + {testcase,[tc1,tc2]}], + + ERPid = ct_test_support:start_event_receiver(Config), + + ok = ct_test_support:run(ct, run_test, [Opts], Config), + + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(tc111_112, + ct_test_support:reformat(Events, ?eh), + ?config(priv_dir, Config)), + + TestEvents = test_events(tc111_112), + ok = ct_test_support:verify_events(TestEvents, Events, Config). + + +%%%----------------------------------------------------------------- +%%% HELP FUNCTIONS +%%%----------------------------------------------------------------- + +eh_opts(Config) -> + Level = ?config(trace_level, Config), + [{event_handler,{?eh,[{cbm,ct_test_support},{trace_level,Level}]}}]. + + +test_events(Test) when Test == dir1 ; Test == dir2 ; + Test == suite11 ; Test == suite21 -> + Suite = if Test == dir1 ; Test == suite11 -> happy_11_SUITE; + true -> happy_21_SUITE + end, + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,8}}, + {?eh,tc_start,{Suite,init_per_suite}}, + {?eh,tc_done,{Suite,init_per_suite,ok}}, + {?eh,tc_start,{Suite,tc1}}, + {?eh,tc_done,{Suite,tc1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{Suite,tc2}}, + {?eh,tc_done,{Suite,tc2,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{Suite,seq1_tc1}}, + {?eh,tc_done,{Suite,seq1_tc1,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{Suite,seq1_tc2}}, + {?eh,tc_done,{Suite,seq1_tc2,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start,{Suite,tc3}}, + {?eh,tc_done,{Suite,tc3,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{Suite,seq2_tc1}}, + {?eh,tc_done,{Suite,seq2_tc1,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + {?eh,tc_start,{Suite,seq2_tc2}}, + {?eh,tc_done,{Suite,seq2_tc2,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + {?eh,tc_start,{Suite,tc4}}, + {?eh,tc_done, + {Suite,tc4,{skipped,"Skipping this one"}}}, + {?eh,test_stats,{7,0,{1,0}}}, + {?eh,tc_start,{Suite,end_per_suite}}, + {?eh,tc_done,{Suite,end_per_suite,ips_data}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; +test_events(Test) when Test == dir1_2 ; Test == suite11_21 -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{2,2,16}}, + {?eh,tc_start,{happy_11_SUITE,init_per_suite}}, + {?eh,tc_done,{happy_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{happy_11_SUITE,tc1}}, + {?eh,tc_done,{happy_11_SUITE,tc1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,tc2}}, + {?eh,tc_done,{happy_11_SUITE,tc2,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,seq1_tc1}}, + {?eh,tc_done,{happy_11_SUITE,seq1_tc1,ok}}, + {?eh,test_stats,{3,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,seq1_tc2}}, + {?eh,tc_done,{happy_11_SUITE,seq1_tc2,ok}}, + {?eh,test_stats,{4,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,tc3}}, + {?eh,tc_done,{happy_11_SUITE,tc3,ok}}, + {?eh,test_stats,{5,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,seq2_tc1}}, + {?eh,tc_done,{happy_11_SUITE,seq2_tc1,ok}}, + {?eh,test_stats,{6,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,seq2_tc2}}, + {?eh,tc_done,{happy_11_SUITE,seq2_tc2,ok}}, + {?eh,test_stats,{7,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,tc4}}, + {?eh,tc_done, + {happy_11_SUITE,tc4,{skipped,"Skipping this one"}}}, + {?eh,test_stats,{7,0,{1,0}}}, + {?eh,tc_start,{happy_11_SUITE,end_per_suite}}, + {?eh,tc_done,{happy_11_SUITE,end_per_suite,ips_data}}, + {?eh,tc_start,{happy_21_SUITE,init_per_suite}}, + {?eh,tc_done,{happy_21_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{happy_21_SUITE,tc1}}, + {?eh,tc_done,{happy_21_SUITE,tc1,ok}}, + {?eh,test_stats,{8,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,tc2}}, + {?eh,tc_done,{happy_21_SUITE,tc2,ok}}, + {?eh,test_stats,{9,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,seq1_tc1}}, + {?eh,tc_done,{happy_21_SUITE,seq1_tc1,ok}}, + {?eh,test_stats,{10,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,seq1_tc2}}, + {?eh,tc_done,{happy_21_SUITE,seq1_tc2,ok}}, + {?eh,test_stats,{11,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,tc3}}, + {?eh,tc_done,{happy_21_SUITE,tc3,ok}}, + {?eh,test_stats,{12,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,seq2_tc1}}, + {?eh,tc_done,{happy_21_SUITE,seq2_tc1,ok}}, + {?eh,test_stats,{13,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,seq2_tc2}}, + {?eh,tc_done,{happy_21_SUITE,seq2_tc2,ok}}, + {?eh,test_stats,{14,0,{1,0}}}, + {?eh,tc_start,{happy_21_SUITE,tc4}}, + {?eh,tc_done, + {happy_21_SUITE,tc4,{skipped,"Skipping this one"}}}, + {?eh,test_stats,{14,0,{2,0}}}, + {?eh,tc_start,{happy_21_SUITE,end_per_suite}}, + {?eh,tc_done,{happy_21_SUITE,end_per_suite,ips_data}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(Test) when Test == tc111 ; Test == tc211 -> + Suite = if Test == tc111 -> happy_11_SUITE; true -> happy_21_SUITE end, + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,1}}, + {?eh,tc_start,{Suite,init_per_suite}}, + {?eh,tc_done,{Suite,init_per_suite,ok}}, + {?eh,tc_start,{Suite,tc1}}, + {?eh,tc_done,{Suite,tc1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{Suite,end_per_suite}}, + {?eh,tc_done,{Suite,end_per_suite,ips_data}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]; + +test_events(tc111_112) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,2}}, + {?eh,tc_start,{happy_11_SUITE,init_per_suite}}, + {?eh,tc_done,{happy_11_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{happy_11_SUITE,tc1}}, + {?eh,tc_done,{happy_11_SUITE,tc1,ok}}, + {?eh,test_stats,{1,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,tc2}}, + {?eh,tc_done,{happy_11_SUITE,tc2,ok}}, + {?eh,test_stats,{2,0,{0,0}}}, + {?eh,tc_start,{happy_11_SUITE,end_per_suite}}, + {?eh,tc_done,{happy_11_SUITE,end_per_suite,ips_data}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. diff --git a/lib/common_test/test/ct_smoke_test_SUITE_data/happy_1/cfg/config1.cfg b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_1/cfg/config1.cfg new file mode 100644 index 0000000000..3d6e5622f5 --- /dev/null +++ b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_1/cfg/config1.cfg @@ -0,0 +1,5 @@ +{v1, apple}. +{v2, plum}. +{v3, [{v31, cherry}, + {v32, banana}, + {v33, coconut}]}. diff --git a/lib/common_test/test/ct_smoke_test_SUITE_data/happy_1/test/happy_11_SUITE.erl b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_1/test/happy_11_SUITE.erl new file mode 100644 index 0000000000..f33f0934cb --- /dev/null +++ b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_1/test/happy_11_SUITE.erl @@ -0,0 +1,196 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2010. 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 : happy_11_SUITE.erl +%%% Description : Happy test of all common_test callback functions. +%%%------------------------------------------------------------------- +-module(happy_11_SUITE). + +%% Note: This directive should only be used in test suites. +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% COMMON TEST CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% +%% Info = [tuple()] +%% List of key/value pairs. +%% +%% Description: Returns list of tuples to set default properties +%% for the suite. +%% +%% Note: The suite/0 function is only meant to be used to return +%% default data values, not perform any other operations. +%%-------------------------------------------------------------------- +suite() -> + [ + {timetrap,{seconds,10}}, + {require, v1}, + {userdata, {info,"Happy test of CT callback functions."}} + ]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the suite. +%% +%% Description: Initialization before the suite. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + [{ips,ips_data} | Config]. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after the suite. +%%-------------------------------------------------------------------- +end_per_suite(Config) -> + ips_data = ?config(ips, Config). + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% +%% TestCase = atom() +%% Name of the test case that is about to run. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the test case. +%% +%% Description: Initialization before each test case. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_testcase(TestCase, Config) -> + [{TestCase,{TestCase,data}} | Config]. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% +%% TestCase = atom() +%% Name of the test case that is finished. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after each test case. +%%-------------------------------------------------------------------- +end_per_testcase(TestCase, Config) -> + {TestCase,data} = ?config(TestCase, Config). + +%%-------------------------------------------------------------------- +%% Function: sequences() -> Sequences +%% +%% Sequences = [{SeqName,TestCases}] +%% SeqName = atom() +%% Name of a sequence. +%% TestCases = [atom()] +%% List of test cases that are part of the sequence +%% +%% Description: Specifies test case sequences. +%%-------------------------------------------------------------------- +sequences() -> + [{seq1,[seq1_tc1, seq1_tc2]}, + {seq2,[seq2_tc1, seq2_tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> TestCases | {skip,Reason} +%% +%% TestCases = [TestCase | {sequence,SeqName}] +%% TestCase = atom() +%% Name of a test case. +%% SeqName = atom() +%% Name of a test case sequence. +%% Reason = term() +%% The reason for skipping all test cases. +%% +%% Description: Returns the list of test cases that are to be executed. +%%-------------------------------------------------------------------- +all() -> + [tc1, + tc2, + seq1, + tc3, + seq2, + tc4]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +tc1() -> + [{userdata,{info, "This is a testcase"}}]. + +tc1(Config) -> + ips_data = ?config(ips, Config), + {tc1,data} = ?config(tc1, Config), + apple = ct:get_config(v1), + ok. + +tc2() -> + [{timetrap,5000}, + {require,v2}]. + +tc2(Config) -> + ips_data = ?config(ips, Config), + undefined = ?config(tc1, Config), + {tc2,data} = ?config(tc2, Config), + plum = ct:get_config(v2), + ok. + +tc3() -> + [{timetrap,{minutes,1}}]. + +tc3(_Config) -> + ok = ct:require(v3), + [{v31, cherry},{v32, banana},{v33, coconut}] = ct:get_config(v3), + banana = ct:get_config({v3,v32}), + ok. + +tc4(Config) -> + {skip,"Skipping this one"}. + +seq1_tc1(_) -> + ok. +seq1_tc2(_) -> + ok. + +seq2_tc1(_) -> + ok. +seq2_tc2(_) -> + ok. diff --git a/lib/common_test/test/ct_smoke_test_SUITE_data/happy_2_cfg/config1.cfg b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_2_cfg/config1.cfg new file mode 100644 index 0000000000..3d6e5622f5 --- /dev/null +++ b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_2_cfg/config1.cfg @@ -0,0 +1,5 @@ +{v1, apple}. +{v2, plum}. +{v3, [{v31, cherry}, + {v32, banana}, + {v33, coconut}]}. diff --git a/lib/common_test/test/ct_smoke_test_SUITE_data/happy_2_test/happy_21_SUITE.erl b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_2_test/happy_21_SUITE.erl new file mode 100644 index 0000000000..33d18006f9 --- /dev/null +++ b/lib/common_test/test/ct_smoke_test_SUITE_data/happy_2_test/happy_21_SUITE.erl @@ -0,0 +1,196 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2010. 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 : happy_21_SUITE.erl +%%% Description : Happy test of all common_test callback functions. +%%%------------------------------------------------------------------- +-module(happy_21_SUITE). + +%% Note: This directive should only be used in test suites. +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% COMMON TEST CALLBACK FUNCTIONS +%%-------------------------------------------------------------------- + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% +%% Info = [tuple()] +%% List of key/value pairs. +%% +%% Description: Returns list of tuples to set default properties +%% for the suite. +%% +%% Note: The suite/0 function is only meant to be used to return +%% default data values, not perform any other operations. +%%-------------------------------------------------------------------- +suite() -> + [ + {timetrap,{seconds,10}}, + {require, v1}, + {userdata, {info,"Happy test of CT callback functions."}} + ]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the suite. +%% +%% Description: Initialization before the suite. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + [{ips,ips_data} | Config]. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after the suite. +%%-------------------------------------------------------------------- +end_per_suite(Config) -> + ips_data = ?config(ips, Config). + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% +%% TestCase = atom() +%% Name of the test case that is about to run. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% Reason = term() +%% The reason for skipping the test case. +%% +%% Description: Initialization before each test case. +%% +%% Note: This function is free to add any key/value pairs to the Config +%% variable, but should NOT alter/remove any existing entries. +%%-------------------------------------------------------------------- +init_per_testcase(TestCase, Config) -> + [{TestCase,{TestCase,data}} | Config]. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% +%% TestCase = atom() +%% Name of the test case that is finished. +%% Config0 = Config1 = [tuple()] +%% A list of key/value pairs, holding the test case configuration. +%% +%% Description: Cleanup after each test case. +%%-------------------------------------------------------------------- +end_per_testcase(TestCase, Config) -> + {TestCase,data} = ?config(TestCase, Config). + +%%-------------------------------------------------------------------- +%% Function: sequences() -> Sequences +%% +%% Sequences = [{SeqName,TestCases}] +%% SeqName = atom() +%% Name of a sequence. +%% TestCases = [atom()] +%% List of test cases that are part of the sequence +%% +%% Description: Specifies test case sequences. +%%-------------------------------------------------------------------- +sequences() -> + [{seq1,[seq1_tc1, seq1_tc2]}, + {seq2,[seq2_tc1, seq2_tc2]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> TestCases | {skip,Reason} +%% +%% TestCases = [TestCase | {sequence,SeqName}] +%% TestCase = atom() +%% Name of a test case. +%% SeqName = atom() +%% Name of a test case sequence. +%% Reason = term() +%% The reason for skipping all test cases. +%% +%% Description: Returns the list of test cases that are to be executed. +%%-------------------------------------------------------------------- +all() -> + [tc1, + tc2, + seq1, + tc3, + seq2, + tc4]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +tc1() -> + [{userdata,{info, "This is a testcase"}}]. + +tc1(Config) -> + ips_data = ?config(ips, Config), + {tc1,data} = ?config(tc1, Config), + apple = ct:get_config(v1), + ok. + +tc2() -> + [{timetrap,5000}, + {require,v2}]. + +tc2(Config) -> + ips_data = ?config(ips, Config), + undefined = ?config(tc1, Config), + {tc2,data} = ?config(tc2, Config), + plum = ct:get_config(v2), + ok. + +tc3() -> + [{timetrap,{minutes,1}}]. + +tc3(_Config) -> + ok = ct:require(v3), + [{v31, cherry},{v32, banana},{v33, coconut}] = ct:get_config(v3), + banana = ct:get_config({v3,v32}), + ok. + +tc4(Config) -> + {skip,"Skipping this one"}. + +seq1_tc1(_) -> + ok. +seq1_tc2(_) -> + ok. + +seq2_tc1(_) -> + ok. +seq2_tc2(_) -> + ok. 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 new file mode 100644 index 0000000000..069f8c75fc --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE.erl @@ -0,0 +1,253 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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_test_server_if_SUITE +%%% +%%% Description: +%%% Test the test_server -> framework interface. +%%% +%%% The suites used for the test are located in the data directory. +%%%------------------------------------------------------------------- +-module(ct_test_server_if_1_SUITE). + +-compile(export_all). + +-include_lib("test_server/include/test_server.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). + +all(doc) -> + [""]; + +all(suite) -> + [ + ts_if_1 + ]. + + +%%-------------------------------------------------------------------- +%% TEST CASES +%%-------------------------------------------------------------------- + +%%%----------------------------------------------------------------- +%%% +ts_if_1(Config) when is_list(Config) -> + DataDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + TODir = filename:join(DataDir, "test_server_if"), + Level = ?config(trace_level, Config), + TestSpec = [ + {event_handler,?eh,[{cbm,ct_test_support},{trace_level,Level}]}, + {suites,TODir,[ts_if_1_SUITE,ts_if_2_SUITE,ts_if_3_SUITE, + ts_if_4_SUITE,ts_if_5_SUITE,ts_if_6_SUITE, + ts_if_7_SUITE,ts_if_8_SUITE]}, + {skip_suites,TODir,[skipped_by_spec_1_SUITE],"should be skipped"}, + {skip_cases,TODir,skipped_by_spec_2_SUITE,[tc1],"should be skipped"} + ], + + TestSpecName = ct_test_support:write_testspec(TestSpec, PrivDir, "ts_if_1_spec"), + {Opts,ERPid} = setup({spec,TestSpecName}, Config), + ok = ct_test_support:run(ct, run_test, [Opts], Config), + Events = ct_test_support:get_events(ERPid, Config), + + ct_test_support:log_events(ts_if_1, + reformat(Events, ?eh), + PrivDir), + + TestEvents = test_events(ts_if_1), + ok = ct_test_support:verify_events(TestEvents, Events, 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 ++ [Test,{event_handler,{?eh,EvHArgs}}], + Opts = [Test | Opts0], + ERPid = ct_test_support:start_event_receiver(Config), + {Opts,ERPid}. + +reformat(Events, EH) -> + ct_test_support:reformat(Events, EH). +%reformat(Events, _EH) -> +% Events. + +%%%----------------------------------------------------------------- +%%% TEST EVENTS +%%%----------------------------------------------------------------- +test_events(ts_if_1) -> + [ + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{10,6,26}}, + {?eh,tc_start,{ts_if_1_SUITE,init_per_suite}}, + {?eh,tc_done,{ts_if_1_SUITE,init_per_suite,ok}}, + {?eh,tc_start,{ts_if_1_SUITE,tc1}}, + {?eh,tc_done,{ts_if_1_SUITE,tc1,{skipped, + {failed, + {ts_if_1_SUITE,init_per_testcase, + {timetrap_timeout,2000}}}}}}, + {?eh,test_stats,{0,0,{0,1}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc2}}, + {?eh,tc_done,{ts_if_1_SUITE,tc2, + {failed,{ts_if_1_SUITE,end_per_testcase,{timetrap_timeout,2000}}}}}, + {?eh,test_stats,{1,0,{0,1}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc3}}, + {?eh,tc_done,{ts_if_1_SUITE,tc3,{failed,{timetrap_timeout,2000}}}}, + {?eh,test_stats,{1,1,{0,1}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc4}}, + {?eh,tc_done,{ts_if_1_SUITE,tc4,{failed,{error,failed_on_purpose}}}}, + {?eh,test_stats,{1,2,{0,1}}}, + {?eh,tc_done,{ts_if_1_SUITE,tc5,{skipped,{sequence_failed,seq1,tc4}}}}, + {?eh,test_stats,{1,2,{1,1}}}, + + [{?eh,tc_start,{ts_if_1_SUITE,{init_per_group,seq2,[sequence]}}}, + {?eh,tc_done,{ts_if_1_SUITE,{init_per_group,seq2,[sequence]},ok}}, + {?eh,tc_start,{ts_if_1_SUITE,tc4}}, + {?eh,tc_done,{ts_if_1_SUITE,tc4,{failed,{error,failed_on_purpose}}}}, + {?eh,test_stats,{1,3,{1,1}}}, + {?eh,tc_auto_skip,{ts_if_1_SUITE,tc5,{failed,{ts_if_1_SUITE,tc4}}}}, + {?eh,test_stats,{1,3,{1,2}}}, + {?eh,tc_start,{ts_if_1_SUITE,{end_per_group,seq2,[sequence]}}}, + {?eh,tc_done,{ts_if_1_SUITE,{end_per_group,seq2,[sequence]},ok}}], + + {?eh,tc_start,{ts_if_1_SUITE,tc6}}, + {?eh,tc_done,{ts_if_1_SUITE,tc6,{skipped,{require_failed,{not_available,void}}}}}, + {?eh,test_stats,{1,3,{1,3}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc7}}, + {?eh,tc_done,{ts_if_1_SUITE,tc7,ok}}, + {?eh,test_stats,{2,3,{1,3}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc8}}, + {?eh,tc_done,{ts_if_1_SUITE,tc8,{skipped,"tc8 skipped"}}}, + {?eh,test_stats,{2,3,{2,3}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc9}}, + {?eh,tc_done,{ts_if_1_SUITE,tc9,{skipped,'tc9 skipped'}}}, + {?eh,test_stats,{2,3,{3,3}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc10}}, + {?eh,tc_done,{ts_if_1_SUITE,tc10,{failed,{error,{function_clause,'_'}}}}}, + {?eh,test_stats,{2,4,{3,3}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc11}}, + {?eh,tc_done,{ts_if_1_SUITE,tc11, + {skipped,{failed,{ts_if_1_SUITE,init_per_testcase,bad_return}}}}}, + {?eh,test_stats,{2,4,{3,4}}}, + + [{?eh,tc_start,{ts_if_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{ts_if_1_SUITE,{init_per_group,g1,[]},{skipped,g1_got_skipped}}}, + {?eh,tc_auto_skip,{ts_if_1_SUITE,gtc1,g1_got_skipped}}, + {?eh,test_stats,{2,4,{3,5}}}, + {?eh,tc_auto_skip,{ts_if_1_SUITE,end_per_group,g1_got_skipped}}], + + {parallel, + [{?eh,tc_start,{ts_if_1_SUITE,{init_per_group,g2,[parallel]}}}, + {?eh,tc_done,{ts_if_1_SUITE,{init_per_group,g2,[parallel]},ok}}, + [{?eh,tc_start,{ts_if_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{ts_if_1_SUITE,{init_per_group,g3,[]},{skipped,g3_got_skipped}}}, + {?eh,tc_auto_skip,{ts_if_1_SUITE,gtc2,g3_got_skipped}}, + {?eh,test_stats,{2,4,{3,6}}}, + {?eh,tc_auto_skip,{ts_if_1_SUITE,end_per_group,g3_got_skipped}}], + {?eh,tc_start,{ts_if_1_SUITE,{end_per_group,g2,[parallel]}}}, + {?eh,tc_done,{ts_if_1_SUITE,{end_per_group,g2,[parallel]},ok}}]}, + + {?eh,tc_start,{ts_if_1_SUITE,tc12}}, + {?eh,tc_done,{undefined,undefined,{testcase_aborted,{abort_current_testcase,tc12},'_'}}}, + {?eh,test_stats,{2,5,{3,6}}}, + {?eh,tc_start,{ts_if_1_SUITE,tc13}}, + {?eh,tc_done,{ts_if_1_SUITE,tc13,ok}}, + {?eh,test_stats,{3,5,{3,6}}}, + {?eh,tc_start,{ts_if_1_SUITE,end_per_suite}}, + {?eh,tc_done,{ts_if_1_SUITE,end_per_suite,ok}}, +%%! + {?eh,tc_start,{ts_if_2_SUITE,init_per_suite}}, + {?eh,tc_done,{ts_if_2_SUITE,init_per_suite, + {failed,{error,{suite0_failed,{exited,suite0_goes_boom}}}}}}, + {?eh,tc_auto_skip,{ts_if_2_SUITE,my_test_case, + {failed,{error,{suite0_failed,{exited,suite0_goes_boom}}}}}}, + {?eh,test_stats,{3,5,{3,7}}}, + {?eh,tc_auto_skip,{ts_if_2_SUITE,end_per_suite, + {failed,{error,{suite0_failed,{exited,suite0_goes_boom}}}}}}, + + {?eh,tc_start,{ct_framework,error_in_suite}}, + {?eh,test_stats,{3,6,{3,7}}}, + + {?eh,tc_start,{ct_framework,error_in_suite}}, + {?eh,test_stats,{3,7,{3,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,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,tc_start,{ts_if_7_SUITE,tc1}}, + {?eh,tc_done,{ts_if_7_SUITE,tc1,ok}}, + {?eh,test_stats,{4,7,{4,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,tc_user_skip,{skipped_by_spec_1_SUITE,all,"should be skipped"}}, + {?eh,test_stats,{4,8,{5,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,tc_start,{skipped_by_spec_2_SUITE,end_per_suite}}, + {?eh,tc_done,{skipped_by_spec_2_SUITE,end_per_suite,ok}}, + + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. + diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/skipped_by_spec_1_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/skipped_by_spec_1_SUITE.erl new file mode 100644 index 0000000000..e77e304834 --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/skipped_by_spec_1_SUITE.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(skipped_by_spec_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/skipped_by_spec_2_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/skipped_by_spec_2_SUITE.erl new file mode 100644 index 0000000000..384182e778 --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/skipped_by_spec_2_SUITE.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(skipped_by_spec_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_1_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_1_SUITE.erl new file mode 100644 index 0000000000..8e90df21ce --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_1_SUITE.erl @@ -0,0 +1,191 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,2}}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(g1, _Config) -> + {skip,g1_got_skipped}; +init_per_group(g3, _Config) -> + {skip,g3_got_skipped}; +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(tc1, Config) -> + timer:sleep(5000), + Config; +init_per_testcase(tc8, _Config) -> + {skip,"tc8 skipped"}; +init_per_testcase(tc11, Config) -> + bad_format; +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(tc2, Config) -> + timer:sleep(5000); +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + [{g1,[],[gtc1]}, + {g2,[parallel],[{g3,[],[gtc2]}]}, + + {seq2,[sequence],[tc4,tc5]}]. + +sequences() -> + [{seq1,[tc4,tc5]}]. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1, tc2, tc3, + {sequence,seq1}, + {group,seq2}, + tc6, tc7, + tc8, tc9, tc10, + tc11, + {group,g1}, + {group,g2}, + tc12, tc13]. + +tc1(_) -> + exit(should_have_been_skipped). + +tc2(_) -> + exit(should_have_been_skipped). + +tc3(_) -> + timer:sleep(5000). + +tc4(_) -> + exit(failed_on_purpose). + +tc5(_) -> + exit(should_have_been_skipped). + +tc6() -> + [{require,void}]. +tc6(_) -> + exit(should_have_been_skipped). + +tc7() -> + bad_format. +tc7(_) -> + done. + +tc8(_) -> + exit(should_have_been_skipped). + +tc9(_) -> + {skip,'tc9 skipped'}. + +tc10(config) -> + done. + +tc11(_) -> + exit(should_have_been_skipped). + + +gtc1(_) -> + exit(should_have_been_skipped). + +gtc2(_) -> + exit(should_have_been_skipped). + +tc12(_) -> + F = fun() -> ct:abort_current_testcase({abort_current_testcase,tc12}) end, + spawn(F), + timer:sleep(500), + exit(should_have_been_aborted). + +tc13(_) -> + success. + + diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_2_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_2_SUITE.erl new file mode 100644 index 0000000000..386b4402e6 --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_2_SUITE.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_2_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + exit(suite0_goes_boom). + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [my_test_case]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +my_test_case() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +my_test_case(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_3_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_3_SUITE.erl new file mode 100644 index 0000000000..70191d31ed --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_3_SUITE.erl @@ -0,0 +1,128 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_3_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + []. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +%% No all/0!! +%%all() -> +%% []. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +my_test_case() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +my_test_case(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_4_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_4_SUITE.erl new file mode 100644 index 0000000000..4b566fea5d --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_4_SUITE.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_4_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + []. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + bad_format. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +my_test_case() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +my_test_case(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_5_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_5_SUITE.erl new file mode 100644 index 0000000000..c7b6b054fb --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_5_SUITE.erl @@ -0,0 +1,128 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_5_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + [{timetrap,{seconds,30}}, + {require,undef_variable}]. + +%%-------------------------------------------------------------------- +%% Function: init_per_suite(Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_suite(Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_suite(Config0) -> void() | {save_config,Config1} +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_suite(_Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [my_test_case]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +my_test_case() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +my_test_case(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_6_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_6_SUITE.erl new file mode 100644 index 0000000000..43440386e6 --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_6_SUITE.erl @@ -0,0 +1,111 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_6_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: suite() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +suite() -> + exit(suite0_byebye). + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1]. + +%%-------------------------------------------------------------------- +%% Function: TestCase() -> Info +%% Info = [tuple()] +%%-------------------------------------------------------------------- +tc1() -> + []. + +%%-------------------------------------------------------------------- +%% Function: TestCase(Config0) -> +%% ok | exit() | {skip,Reason} | {comment,Comment} | +%% {save_config,Config1} | {skip_and_save,Reason,Config1} +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%% Comment = term() +%%-------------------------------------------------------------------- +tc1(_Config) -> + ok. diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_7_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_7_SUITE.erl new file mode 100644 index 0000000000..a2254848d0 --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_7_SUITE.erl @@ -0,0 +1,93 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_7_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: init_per_group(GroupName, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_group(_GroupName, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_group(GroupName, Config0) -> +%% void() | {save_config,Config1} +%% GroupName = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_group(_GroupName, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: init_per_testcase(TestCase, Config0) -> +%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%% Reason = term() +%%-------------------------------------------------------------------- +init_per_testcase(_TestCase, Config) -> + Config. + +%%-------------------------------------------------------------------- +%% Function: end_per_testcase(TestCase, Config0) -> +%% void() | {save_config,Config1} +%% TestCase = atom() +%% Config0 = Config1 = [tuple()] +%%-------------------------------------------------------------------- +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1]. + +tc1() -> + exit(tc1_byebye). + +tc1(_) -> + done. + diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_8_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_8_SUITE.erl new file mode 100644 index 0000000000..990669cd4c --- /dev/null +++ b/lib/common_test/test/ct_test_server_if_1_SUITE_data/test_server_if/test/ts_if_8_SUITE.erl @@ -0,0 +1,52 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2010. 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(ts_if_8_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%-------------------------------------------------------------------- +%% Function: groups() -> [Group] +%% Group = {GroupName,Properties,GroupsAndTestCases} +%% GroupName = atom() +%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] +%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] +%% TestCase = atom() +%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} +%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | +%% repeat_until_any_ok | repeat_until_any_fail +%% N = integer() | forever +%%-------------------------------------------------------------------- +groups() -> + []. + +%%-------------------------------------------------------------------- +%% Function: all() -> GroupsAndTestCases | {skip,Reason} +%% GroupsAndTestCases = [{group,GroupName} | TestCase] +%% GroupName = atom() +%% TestCase = atom() +%% Reason = term() +%%-------------------------------------------------------------------- +all() -> + [tc1]. + +tc1(_) -> + exit(failed_on_purpose). + diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl new file mode 100644 index 0000000000..6148e3280e --- /dev/null +++ b/lib/common_test/test/ct_test_support.erl @@ -0,0 +1,976 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2008-2009. 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% +%% + +%%% @doc Test support functions +%%% +%%% <p>This is a support module for testing the Common Test Framework.</p> +%%% +-module(ct_test_support). + +-include("test_server.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-export([init_per_suite/1, init_per_suite/2, end_per_suite/1, + init_per_testcase/2, end_per_testcase/2, write_testspec/3, + run/4, get_opts/1, wait_for_ct_stop/1]). + +-export([handle_event/2, start_event_receiver/1, get_events/2, + verify_events/3, reformat/2, log_events/3]). + +-include_lib("kernel/include/file.hrl"). + +%%%----------------------------------------------------------------- +%%% init_per_suite/1 + +init_per_suite(Config) -> + init_per_suite(Config, 50). + +init_per_suite(Config, Level) -> + case delete_old_logs(os:type(), Config) of + {'EXIT',DelLogsReason} -> + test_server:format(0, "Failed to delete old log directories: ~p~n", + [DelLogsReason]); + _ -> + ok + end, + [_,Host] = string:tokens(atom_to_list(node()), "@"), + case slave:start(Host, ct, []) of + {error,Reason} -> + test_server:fail(Reason); + {ok,CTNode} -> + test_server:format(0, "Node ~p started~n", [CTNode]), + DataDir = ?config(data_dir, Config), + PrivDir = ?config(priv_dir, Config), + + %% PrivDir as well as directory of Test Server suites + %% have to be in code path on Common Test node. + true = rpc:call(CTNode, code, add_patha, [PrivDir]), + [_ | Parts] = lists:reverse(filename:split(DataDir)), + TSDir = filename:join(lists:reverse(Parts)), + true = rpc:call(CTNode, code, add_patha, [TSDir]), + test_server:format(Level, "Dirs added to code path (on ~w):~n" + "~s~n~s~n", [CTNode,TSDir,PrivDir]), + + TraceFile = filename:join(DataDir, "ct.trace"), + case file:read_file_info(TraceFile) of + {ok,_} -> + [{trace_level,0}, + {ct_opts,[{ct_trace,TraceFile}]}, + {ct_node,CTNode} | Config]; + _ -> + [{trace_level,Level}, + {ct_opts,[]}, + {ct_node,CTNode} | Config] + end + end. + +%%%----------------------------------------------------------------- +%%% end_per_suite/1 + +end_per_suite(Config) -> + CTNode = ?config(ct_node, Config), + PrivDir = ?config(priv_dir, Config), + true = rpc:call(CTNode, code, del_path, [filename:join(PrivDir,"")]), + slave:stop(CTNode), + ok. + +%%%----------------------------------------------------------------- +%%% init_per_testcase/2 + +init_per_testcase(_TestCase, Config) -> + {_,{_,LogDir}} = lists:keysearch(logdir, 1, get_opts(Config)), + test_server:format("See Common Test logs here:\n" + "<a href=\"file://~s/all_runs.html\">~s/all_runs.html</a>", + [LogDir,LogDir]), + Config. + +%%%----------------------------------------------------------------- +%%% end_per_testcase/2 + +end_per_testcase(_TestCase, Config) -> + CTNode = ?config(ct_node, Config), + wait_for_ct_stop(CTNode), + ok. + + +%%%----------------------------------------------------------------- +%%% + +write_testspec(TestSpec, Dir, Name) -> + TSFile = filename:join(Dir, Name), + {ok,Dev} = file:open(TSFile, [write]), + [io:format(Dev, "~p.~n", [Entry]) || Entry <- TestSpec], + file:close(Dev), + io:format("Test specification written to: ~p~n", [TSFile]), + io:format(user, "Test specification written to: ~p~n", [TSFile]), + TSFile. + + +%%%----------------------------------------------------------------- +%%% + +get_opts(Config) -> + PrivDir = ?config(priv_dir, Config), + TempDir = case os:getenv("TMP") of + false -> + case os:getenv("TEMP") of + false -> + undefined; + Tmp -> + create_tmp_logdir(Tmp) + end; + Tmp -> + create_tmp_logdir(Tmp) + end, + LogDir = + case os:getenv("CT_USE_TMP_DIR") of + false -> + case os:type() of + {win32,_} -> + if TempDir == undefined -> PrivDir; + true -> TempDir + end; + _ -> + PrivDir + end; + _ -> + TempDir + end, + InitOpts = ?config(ct_opts, Config), + [{logdir,LogDir} | InitOpts]. + + +%%%----------------------------------------------------------------- +%%% +run(M, F, A, Config) -> + CTNode = ?config(ct_node, Config), + Level = ?config(trace_level, Config), + test_server:format(Level, "Calling ~w:~w(~p) on ~p~n", + [M, F, A, CTNode]), + rpc:call(CTNode, M, F, A). + + +%%%----------------------------------------------------------------- +%%% wait_for_ct_stop/1 + +wait_for_ct_stop(CTNode) -> + %% Give CT at least 15 sec to stop (in case of bad make). + wait_for_ct_stop(5, CTNode). + +wait_for_ct_stop(0, CTNode) -> + test_server:format(0, "Giving up! Stopping ~p.", [CTNode]), + ok; +wait_for_ct_stop(Retries, CTNode) -> + case rpc:call(CTNode, erlang, whereis, [ct_util_server]) of + undefined -> + ok; + Pid -> + test_server:format(0, "Waiting for CT (~p) to finish (~p)...", + [Pid,Retries]), + timer:sleep(5000), + wait_for_ct_stop(Retries-1, CTNode) + end. + +%%%----------------------------------------------------------------- +%%% EVENT HANDLING + +handle_event(EH, Event) -> + event_receiver ! {self(),{event,EH,Event}}, + receive {event_receiver,ok} -> ok end, + ok. + +start_event_receiver(Config) -> + CTNode = ?config(ct_node, Config), + spawn_link(CTNode, fun() -> er() end). + +get_events(_, Config) -> + CTNode = ?config(ct_node, Config), + {event_receiver,CTNode} ! {self(),get_events}, + Events = receive {event_receiver,Evs} -> Evs end, + {event_receiver,CTNode} ! stop, + Events. + +er() -> + register(event_receiver, self()), + er_loop([]). + +er_loop(Evs) -> + receive + {From,{event,EH,Ev}} -> + From ! {event_receiver,ok}, + er_loop([{EH,Ev} | Evs]); + {From,get_events} -> + From ! {event_receiver,lists:reverse(Evs)}, + er_loop(Evs); + stop -> + ok + end. + +verify_events(TEvs, Evs, Config) -> + Node = ?config(ct_node, Config), + case catch verify_events1(TEvs, Evs, Node, Config) of + {'EXIT',Reason} -> + Reason; + _ -> + ok + end. + +verify_events1(TEvs = [TestEv | TestEvs], Evs = [_|Events], Node, Config) -> +%% test_server:format("Next expected event: ~p~n", [TestEv]), + case catch locate(TestEv, Node, Evs, Config) of + nomatch -> + verify_events1(TEvs, Events, Node, Config); + {'EXIT',Reason} -> + test_server:format("Failed to find ~p in ~p~n" + "Reason: ~p~n", [TestEv,Evs,Reason]), + exit(Reason); + {Config1,Events1} -> + if is_list(TestEv) -> + ok; + element(1,TestEv) == parallel ; element(1,TestEv) == shuffle -> + ok; + true -> + test_server:format("Found ~p!", [TestEv]) + end, + verify_events1(TestEvs, Events1, Node, Config1) + end; + +verify_events1([TestEv|_], [], _, _) -> + test_server:format("Failed to find ~p in the list of events!~n", [TestEv]), + exit({event_not_found,TestEv}); + +verify_events1([], Evs, _, Config) -> + {Config,Evs}. + +%%%---------------------------------------------------------------------------- +%%% locate({TEHandler,TEName,TEData}, TENode, Events, Config) -> {Config1,Evs1} +%%% +%%% A group is represented as either: +%%% {parallel,ListOfCasesAndGroups}, +%%% {shuffle,ListOfCasesAndGroups}, or +%%% ListOfCasesAndGroups. +%%% +%%% The two first and two last events in a group *may* be tc_start and tc_done +%%% for init_per_group and end_per_group. + +%% group (not parallel or shuffle) +locate(TEvs, Node, Evs, Config) when is_list(TEvs) -> + case TEvs of + [InitStart = {TEH,tc_start,{M,{init_per_group,GroupName,Props}}}, + InitDone = {TEH,tc_done,{M,{init_per_group,GroupName,Props},R}} | TEvs1] -> + case Evs of + [{TEH,#event{name=tc_start, + node=Node, + data={M,{init_per_group,GroupName,Props}}}}, + {TEH,#event{name=tc_done, + node=Node, + data={M,{init_per_group,GroupName,Props},R}}} | Evs1] -> + test_server:format("Found ~p!", [InitStart]), + test_server:format("Found ~p!", [InitDone]), + verify_events1(TEvs1, Evs1, Node, Config); + _ -> + nomatch + end; + _ -> + verify_events1(TEvs, Evs, Node, Config) + end; + +%% Parallel events: Each test case in the group should be specified in a list +%% with the tc_start, followed by the tc_done event. The order of the cases +%% is irrelevant, but it must be checked that every test case exists and +%% that tc_done comes after tc_start. +locate({parallel,TEvs}, Node, Evs, Config) -> + Start = + case TEvs of + [InitStart = {TEH,tc_start,{M,{init_per_group,GroupName,Props}}}, + InitDone = {TEH,tc_done,{M,{init_per_group,GroupName,Props},R}} | TEs] -> + case Evs of + [{TEH,#event{name=tc_start, + node=Node, + data={M,{init_per_group,GroupName,Props}}}}, + {TEH,#event{name=tc_done, + node=Node, + data={M,{init_per_group,GroupName,Props},R}}} | Es] -> + test_server:format("Found ~p!", [InitStart]), + test_server:format("Found ~p!", [InitDone]), + {TEs,Es}; + _ -> + nomatch + end; + _ -> + {TEvs,Evs} + end, + case Start of + nomatch -> + nomatch; + {TEvs1,Evs1} -> + {TcDoneEvs,RemainEvs,_} = + lists:foldl( + %% tc_start event for a parallel test case + fun(TEv={TEH,tc_start,{M,F}}, {Done,RemEvs,RemSize}) -> + %% drop events until TEv is found + Evs2 = lists:dropwhile( + fun({EH,#event{name=tc_start, + node=EvNode, + data={Mod,Func}}}) when + EH == TEH, EvNode == Node, + Mod == M, Func == F -> + false; + (_) -> + true + end, Evs1), + %% split the list at the tc_done event and record the smallest + %% list of remaining events (Evs) as possible + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_done, + node=EvNode, + data={Mod,Func,_}}}) when + EH == TEH, EvNode == Node, + Mod == M, Func == F -> + false; + (_) -> + true + end, Evs2), + case RemEvs1 of + [] when Evs2 == [] -> + exit({unmatched,TEv}); + [] -> + test_server:format("Found ~p!", [TEv]), + exit({tc_done_not_found,TEv}); + [TcDone|Evs3] -> + test_server:format("Found ~p!", [TEv]), + RemSize1 = length(Evs3), + if RemSize1 < RemSize -> + {[TcDone|Done],Evs3,RemSize1}; + true -> + {[TcDone|Done],RemEvs,RemSize} + end + end; + %% tc_done event for a parallel test case + (TEv={TEH,tc_done,{M,F,R}}, {Done,RemEvs,RemSize}) -> + case [E || E={EH,#event{name=tc_done, + node=EvNode, + data={Mod,Func,Result}}} <- Done, + EH == TEH, EvNode == Node, Mod == M, + Func == F, Result == R] of + [TcDone|_] -> + test_server:format("Found ~p!", [TEv]), + {lists:delete(TcDone, Done),RemEvs,RemSize}; + [] -> + exit({unmatched,TEv}) + end; + %% tc_start event for end_per_group + (TEv={TEH,tc_start,{M,{end_per_group,GroupName,Props}}}, + {Done,RemEvs,_RemSize}) -> + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_start, + node=EvNode, + data={Mod,{end_per_group, + EvGName,EvProps}}}}) when + EH == TEH, EvNode == Node, Mod == M, + EvGName == GroupName, EvProps == Props -> + false; + (_) -> + true + end, RemEvs), + case RemEvs1 of + [] -> + exit({end_per_group_not_found,TEv}); + [_ | RemEvs2] -> + test_server:format("Found ~p!", [TEv]), + {Done,RemEvs2,length(RemEvs2)} + end; + %% tc_done event for end_per_group + (TEv={TEH,tc_done,{M,{end_per_group,GroupName,Props},R}}, + {Done,RemEvs,_RemSize}) -> + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_done, + node=EvNode, + data={Mod,{end_per_group, + EvGName,EvProps},Res}}}) when + EH == TEH, EvNode == Node, Mod == M, + EvGName == GroupName, EvProps == Props, Res == R -> + false; + (_) -> + true + end, RemEvs), + case RemEvs1 of + [] -> + exit({end_per_group_not_found,TEv}); + [_ | RemEvs2] -> + test_server:format("Found ~p!", [TEv]), + {Done,RemEvs2,length(RemEvs2)} + end; + %% end_per_group auto skipped + (TEv={TEH,tc_auto_skip,{M,end_per_group,R}}, {Done,RemEvs,_RemSize}) -> + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_auto_skip, + node=EvNode, + data={Mod,end_per_group,Reason}}}) when + EH == TEH, EvNode == Node, Mod == M, Reason == R -> + false; + (_) -> + true + end, RemEvs), + case RemEvs1 of + [] -> + exit({end_per_group_not_found,TEv}); + [_AutoSkip | RemEvs2] -> + {Done,RemEvs2,length(RemEvs2)} + end; + %% match other event than test case + (TEv={TEH,N,D}, Acc) when D == '_' -> + case [E || E={EH,#event{name=Name, + node=EvNode, + data=_}} <- Evs1, + EH == TEH, EvNode == Node, Name == N] of + [] -> + exit({unmatched,TEv}); + _ -> + test_server:format("Found ~p!", [TEv]), + Acc + end; + (TEv={TEH,N,D}, Acc) -> + case [E || E={EH,#event{name=Name, + node=EvNode, + data=Data}} <- Evs1, + EH == TEH, EvNode == Node, Name == N, Data == D] of + [] -> + exit({unmatched,TEv}); + _ -> + test_server:format("Found ~p!", [TEv]), + Acc + end; + %% start of a sub-group + (SubGroupTEvs, Acc) when is_list(SubGroupTEvs) -> + verify_events1(SubGroupTEvs, Evs1, Node, Config), + Acc; + (TEv={Prop,_SubGroupTEvs}, Acc) when + Prop == shuffle ; Prop == parallel -> + verify_events1([TEv], Evs1, Node, Config), + Acc + end, {[],Evs1,length(Evs1)}, TEvs1), + case TcDoneEvs of + [] -> + test_server:format("Found all parallel events!", []), + {Config,RemainEvs}; + _ -> + exit({unexpected_events,TcDoneEvs}) + end + end; + +%% Shuffled events: Each test case in the group should be specified in a list +%% with the tc_start, followed by the tc_done event. The order of the cases +%% is irrelevant, but it must be checked that every test case exists and +%% that the tc_done event follows the tc_start. +locate({shuffle,TEvs}, Node, Evs, Config) -> + Start = + case TEvs of + [InitStart = {TEH,tc_start,{M,{init_per_group,GroupName,Props}}}, + InitDone = {TEH,tc_done,{M,{init_per_group,GroupName,Props},R}} | TEs] -> + case Evs of + [{TEH,#event{name=tc_start, + node=Node, + data={M,{init_per_group,GroupName,EvProps}}}}, + {TEH,#event{name=tc_done, + node=Node, + data={M,{init_per_group,GroupName,EvProps},R}}} | Es] -> + case proplists:get_value(shuffle, Props) of + '_' -> + case proplists:get_value(shuffle, EvProps) of + false -> + exit({no_shuffle_prop_found,{M,init_per_group, + GroupName,EvProps}}); + _ -> + PropsCmp = proplists:delete(shuffle, EvProps), + PropsCmp = proplists:delete(shuffle, Props) + end; + _ -> + Props = EvProps + end, + test_server:format("Found ~p!", [InitStart]), + test_server:format("Found ~p!", [InitDone]), + {TEs,Es}; + _ -> + nomatch + end; + _ -> + {TEvs,Evs} + end, + case Start of + nomatch -> + nomatch; + {TEvs1,Evs1} -> + {TcDoneEvs,RemainEvs,_} = + lists:foldl( + %% tc_start event for a test case + fun(TEv={TEH,tc_start,{M,F}}, {Done,RemEvs,RemSize}) -> + %% drop events until TEv is found + Evs2 = lists:dropwhile( + fun({EH,#event{name=tc_start, + node=EvNode, + data={Mod,Func}}}) when + EH == TEH, EvNode == Node, + Mod == M, Func == F -> + false; + (_) -> + true + end, Evs1), + %% verify the tc_done event comes next in Evs + case Evs2 of + [] -> + exit({unmatched,TEv}); + [_TcStart, TcDone={TEH,#event{name=tc_done, + node=Node, + data={M,F,_}}} | Evs3] -> + test_server:format("Found ~p!", [TEv]), + RemSize1 = length(Evs3), + if RemSize1 < RemSize -> + {[TcDone|Done],Evs3,RemSize1}; + true -> + {[TcDone|Done],RemEvs,RemSize} + end + end; + %% tc_done event for a test case + (TEv={TEH,tc_done,{M,F,R}}, {Done,RemEvs,RemSize}) -> + case [E || E={EH,#event{name=tc_done, + node=EvNode, + data={Mod,Func,Result}}} <- Done, + EH == TEH, EvNode == Node, Mod == M, + Func == F, Result == R] of + [TcDone|_] -> + test_server:format("Found ~p!", [TEv]), + {lists:delete(TcDone, Done),RemEvs,RemSize}; + [] -> + exit({unmatched,TEv}) + end; + %% tc_start event for end_per_group + (TEv={TEH,tc_start,{M,{end_per_group,GroupName,Props}}}, + {Done,RemEvs,_RemSize}) -> + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_start, + node=EvNode, + data={Mod,{end_per_group, + EvGName,_}}}}) when + EH == TEH, EvNode == Node, Mod == M, + EvGName == GroupName -> + false; + (_) -> + true + end, RemEvs), + case RemEvs1 of + [] -> + exit({end_per_group_not_found,TEv}); + [{_,#event{data={_,{_,_,EvProps1}}}} | RemEvs2] -> + case proplists:get_value(shuffle, Props) of + '_' -> + case proplists:get_value(shuffle, EvProps1) of + false -> + exit({no_shuffle_prop_found, + {M,end_per_group,GroupName,EvProps1}}); + _ -> + PropsCmp1 = proplists:delete(shuffle, EvProps1), + PropsCmp1 = proplists:delete(shuffle, Props) + end; + _ -> + Props = EvProps1 + end, + test_server:format("Found ~p!", [TEv]), + {Done,RemEvs2,length(RemEvs2)} + end; + %% tc_done event for end_per_group + (TEv={TEH,tc_done,{M,{end_per_group,GroupName,Props},R}}, + {Done,RemEvs,_RemSize}) -> + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_done, + node=EvNode, + data={Mod,{end_per_group, + EvGName,_},Res}}}) when + EH == TEH, EvNode == Node, Mod == M, + EvGName == GroupName, Res == R -> + false; + (_) -> + true + end, RemEvs), + case RemEvs1 of + [] -> + exit({end_per_group_not_found,TEv}); + [{_,#event{data={_,{_,_,EvProps1},_}}} | RemEvs2] -> + case proplists:get_value(shuffle, Props) of + '_' -> + case proplists:get_value(shuffle, EvProps1) of + false -> + exit({no_shuffle_prop_found, + {M,end_per_group,GroupName,EvProps1}}); + _ -> + PropsCmp1 = proplists:delete(shuffle, EvProps1), + PropsCmp1 = proplists:delete(shuffle, Props) + end; + _ -> + Props = EvProps1 + end, + test_server:format("Found ~p!", [TEv]), + {Done,RemEvs2,length(RemEvs2)} + end; + %% end_per_group auto skipped + (TEv={TEH,tc_auto_skip,{M,end_per_group,R}}, {Done,RemEvs,_RemSize}) -> + RemEvs1 = + lists:dropwhile( + fun({EH,#event{name=tc_auto_skip, + node=EvNode, + data={Mod,end_per_group,Reason}}}) when + EH == TEH, EvNode == Node, Mod == M, Reason == R -> + false; + (_) -> + true + end, RemEvs), + case RemEvs1 of + [] -> + exit({end_per_group_not_found,TEv}); + [_AutoSkip | RemEvs2] -> + {Done,RemEvs2,length(RemEvs2)} + end; + %% match other event than test case + (TEv={TEH,N,D}, Acc) when D == '_' -> + case [E || E={EH,#event{name=Name, + node=EvNode, + data=_}} <- Evs1, + EH == TEH, EvNode == Node, Name == N] of + [] -> + exit({unmatched,TEv}); + _ -> + test_server:format("Found ~p!", [TEv]), + Acc + end; + (TEv={TEH,N,D}, Acc) -> + case [E || E={EH,#event{name=Name, + node=EvNode, + data=Data}} <- Evs1, + EH == TEH, EvNode == Node, Name == N, Data == D] of + [] -> + exit({unmatched,TEv}); + _ -> + test_server:format("Found ~p!", [TEv]), + Acc + end; + %% start of a sub-group + (SubGroupTEvs, Acc) when is_list(SubGroupTEvs) -> + verify_events1(SubGroupTEvs, Evs1, Node, Config), + Acc; + (TEv={Prop,_SubGroupTEvs}, Acc) when + Prop == shuffle ; Prop == parallel -> + verify_events1([TEv], Evs1, Node, Config), + Acc + end, {[],Evs1,length(Evs1)}, TEvs1), + case TcDoneEvs of + [] -> + test_server:format("Found all shuffled events!", []), + {Config,RemainEvs}; + _ -> + exit({unexpected_events,TcDoneEvs}) + end + end; + +locate({TEH,Name,{'DEF','RUNDIR'}}, Node, [Ev|Evs], Config) -> + case Ev of + {TEH,#event{name=Name, node=Node, data=EvData}} -> + {_,{_,LogDir}} = lists:keysearch(logdir, 1, get_opts(Config)), + D = filename:join(LogDir, "ct_run." ++ atom_to_list(Node)), + case string:str(EvData, D) of + 0 -> exit({badmatch,EvData}); + _ -> ok + end, + {Config,Evs}; + _ -> + nomatch + end; + +locate({TEH,Name,{'DEF',{'START_TIME','LOGDIR'}}}, Node, [Ev|Evs], Config) -> + case Ev of + {TEH,#event{name=Name, node=Node, data=EvData}} -> + case EvData of + {DT={{_,_,_},{_,_,_}},Dir} when is_list(Dir) -> + {_,{_,LogDir}} = lists:keysearch(logdir, 1, get_opts(Config)), + D = filename:join(LogDir, "ct_run." ++ atom_to_list(Node)), + case string:str(Dir, D) of + 0 -> exit({badmatch,Dir}); + _ -> ok + end, + {[{start_time,DT}|Config],Evs}; + Data -> + exit({badmatch,Data}) + end; + _ -> + nomatch + end; + +locate({TEH,Name,{'DEF','STOP_TIME'}}, Node, [Ev|Evs], Config) -> + case Ev of + {TEH,#event{name=Name, node=Node, data=EvData}} -> + case EvData of + DT={{_,_,_},{_,_,_}} -> + {[{stop_time,DT}|Config],Evs}; + Data -> + exit({badmatch,Data}) + end; + _ -> + nomatch + end; + +%% to match variable data as a result of a failed test case +locate({TEH,tc_done,{Mod,Func,{failed,{error,{Slogan,'_'}}}}}, Node, [Ev|Evs], Config) -> + case Ev of + {TEH,#event{name=tc_done, node=Node, + data={Mod,Func,{failed,{error,{Slogan,_}}}}}} -> + {Config,Evs}; + _ -> + nomatch + end; + +%% to match variable data as a result of an aborted test case +locate({TEH,tc_done,{undefined,undefined,{testcase_aborted, + {abort_current_testcase,Func},'_'}}}, + Node, [Ev|Evs], Config) -> + case Ev of + {TEH,#event{name=tc_done, node=Node, + data={undefined,undefined, + {testcase_aborted,{abort_current_testcase,Func},_}}}} -> + {Config,Evs}; + _ -> + nomatch + end; + +%% matches any event of type Name +locate({TEH,Name,Data}, Node, [Ev|Evs], Config) when Data == '_' -> + case Ev of + {TEH,#event{name=Name, node=Node}} -> + {Config,Evs}; + _ -> + nomatch + end; + +locate({TEH,Name,Data}, Node, [Ev|Evs], Config) -> + case Ev of + {TEH,#event{name=Name, node=Node, data=Data}} -> + {Config,Evs}; + _ -> + nomatch + end. + +log_events(TC, Events, PrivDir) -> + LogFile = filename:join(PrivDir, atom_to_list(TC)++".events"), + {ok,Dev} = file:open(LogFile, [write]), + io:format(Dev, "[~n", []), + log_events1(Events, Dev, " "), + file:close(Dev), + io:format("Events written to logfile: ~p~n", [LogFile]), + io:format(user, "Events written to logfile: ~p~n", [LogFile]). + +log_events1(Evs, Dev, "") -> + log_events1(Evs, Dev, " "); +log_events1([E={_EH,tc_start,{_M,{init_per_group,_GrName,Props}}} | Evs], Dev, Ind) -> + case get_prop(Props) of + undefined -> + io:format(Dev, "~s[~p,~n", [Ind,E]), + log_events1(Evs, Dev, Ind++" "); + Prop -> + io:format(Dev, "~s{~w,~n~s[~p,~n", [Ind,Prop,Ind++" ",E]), + log_events1(Evs, Dev, Ind++" ") + end; +log_events1([E={_EH,tc_done,{_M,{init_per_group,_GrName,_Props},_R}} | Evs], Dev, Ind) -> + io:format(Dev, "~s~p,~n", [Ind,E]), + log_events1(Evs, Dev, Ind++" "); +log_events1([E={_EH,tc_start,{_M,{end_per_group,_GrName,_Props}}} | Evs], Dev, Ind) -> + Ind1 = Ind -- " ", + io:format(Dev, "~s~p,~n", [Ind1,E]), + log_events1(Evs, Dev, Ind1); +log_events1([E={_EH,tc_done,{_M,{end_per_group,_GrName,Props},_R}} | Evs], Dev, Ind) -> + case get_prop(Props) of + undefined -> + io:format(Dev, "~s~p],~n", [Ind,E]), + log_events1(Evs, Dev, Ind--" "); + _Prop -> + io:format(Dev, "~s~p]},~n", [Ind,E]), + log_events1(Evs, Dev, Ind--" ") + end; +log_events1([E={_EH,tc_auto_skip,{_M,end_per_group,_Reason}} | Evs], Dev, Ind) -> + io:format(Dev, "~s~p],~n", [Ind,E]), + log_events1(Evs, Dev, Ind--" "); +log_events1([E], Dev, Ind) -> + io:format(Dev, "~s~p~n].~n", [Ind,E]), + ok; +log_events1([E | Evs], Dev, Ind) -> + io:format(Dev, "~s~p,~n", [Ind,E]), + log_events1(Evs, Dev, Ind); +log_events1([], _Dev, _Ind) -> + ok. + +get_prop(Props) -> + case lists:member(parallel, Props) of + true -> parallel; + false -> case lists:member(shuffle, Props) of + true -> shuffle; + false -> case lists:keysearch(shuffle, 1, Props) of + {value,_} -> shuffle; + _ -> undefined + end + end + end. + +reformat([{_EH,#event{name=start_write_file,data=_}} | Events], EH) -> + reformat(Events, EH); +reformat([{_EH,#event{name=finished_write_file,data=_}} | Events], EH) -> + reformat(Events, EH); +reformat([{_EH,#event{name=start_make,data=_}} | Events], EH) -> + reformat(Events, EH); +reformat([{_EH,#event{name=finished_make,data=_}} | Events], EH) -> + reformat(Events, EH); +reformat([{_EH,#event{name=start_logging,data=_}} | Events], EH) -> + [{EH,start_logging,{'DEF','RUNDIR'}} | reformat(Events, EH)]; +reformat([{_EH,#event{name=test_start,data=_}} | Events], EH) -> + [{EH,test_start,{'DEF',{'START_TIME','LOGDIR'}}} | reformat(Events, EH)]; +reformat([{_EH,#event{name=test_done,data=_}} | Events], EH) -> + [{EH,test_done,{'DEF','STOP_TIME'}} | reformat(Events, EH)]; +reformat([{_EH,#event{name=test_stats,data=Data}} | Events], EH) -> + [{EH,test_stats,Data} | reformat(Events, EH)]; +%% use this to only print the last test_stats event: +%% case [N || {_,#event{name=N}} <- Events, N == test_stats] of +%% [] -> % last stats event +%% [{EH,test_stats,Data} | reformat(Events, EH)]; +%% _ -> +%% reformat(Events, EH) +%% end; +reformat([{_EH,#event{name=Name,data=Data}} | Events], EH) -> + [{EH,Name,Data} | reformat(Events, EH)]; +reformat([], _EH) -> + []. + + +%%%----------------------------------------------------------------- +%%% MISC HELP FUNCTIONS + +create_tmp_logdir(Tmp) -> + LogDir = filename:join(Tmp,"ct"), + file:make_dir(LogDir), + LogDir. + +delete_old_logs({win32,_}, Config) -> + case {?config(priv_dir, Config),?config(logdir, get_opts(Config))} of + {LogDir,LogDir} -> + ignore; + {_,LogDir} -> % using tmp for logs + catch delete_dirs(LogDir) + end; + +delete_old_logs(_, Config) -> + case os:getenv("CT_USE_TMP_DIR") of + false -> + ignore; + _ -> + catch delete_dirs(?config(logdir, get_opts(Config))) + end. + +delete_dirs(LogDir) -> + Now = calendar:datetime_to_gregorian_seconds(calendar:local_time()), + SaveTime = case os:getenv("CT_SAVE_OLD_LOGS") of + false -> + 28800; + SaveTime0 -> + list_to_integer(SaveTime0) + end, + Deadline = Now - SaveTime, + Dirs = filelib:wildcard(filename:join(LogDir,"ct_run*")), + Dirs2Del = + lists:foldl(fun(Dir, Del) -> + [S,Mi,H,D,Mo,Y|_] = + lists:reverse(string:tokens(Dir, [$.,$-,$_])), + S2I = fun(Str) -> list_to_integer(Str) end, + DT = {{S2I(Y),S2I(Mo),S2I(D)}, {S2I(H),S2I(Mi),S2I(S)}}, + Then = calendar:datetime_to_gregorian_seconds(DT), + if Then > Deadline -> + Del; + true -> + [Dir | Del] + end + end, [], Dirs), + case length(Dirs2Del) of + 0 -> + test_server:format(0, "No log directories older than ~w secs.", [SaveTime]); + N -> + test_server:format(0, "Deleting ~w directories older than ~w secs.", [N,SaveTime]) + end, + delete_dirs(LogDir, Dirs2Del). + +delete_dirs(_, []) -> + ok; +delete_dirs(LogDir, [Dir | Dirs]) -> + test_server:format(0, "Removing old log directory: ~s", [Dir]), + case catch rm_rec(Dir) of + {_,Reason} -> + test_server:format(0, "Delete failed! (~p)", [Reason]); + ok -> + ok + end, + delete_dirs(LogDir, Dirs). + +rm_rec(Dir) -> + %% ensure we're removing the ct_run directory + case lists:reverse(filename:split(Dir)) of + [[$c,$t,$_,$r,$u,$n,$.|_]|_] -> + rm_dir(filename:absname(Dir)); + _ -> + {error,{invalid_logdir,Dir}} + end. + +rm_dir(Dir) -> + case file:list_dir(Dir) of + {error,Errno} -> + exit({ls_failed,Dir,Errno}); + {ok,Files} -> + rm_files([filename:join(Dir, F) || F <- Files]), + file:del_dir(Dir) + end. + +rm_files([F | Fs]) -> + Base = filename:basename(F), + if Base == "." ; Base == ".." -> + rm_files(Fs); + true -> + case file:read_file_info(F) of + {ok,#file_info{type=directory}} -> + rm_dir(F), + rm_files(Fs); + {ok,_Regular} -> + case file:delete(F) of + ok -> + rm_files(Fs); + {error,Errno} -> + exit({del_failed,F,Errno}) + end + end + end; +rm_files([]) -> + ok. + diff --git a/lib/common_test/test/ct_test_support_eh.erl b/lib/common_test/test/ct_test_support_eh.erl new file mode 100644 index 0000000000..fd3ae18746 --- /dev/null +++ b/lib/common_test/test/ct_test_support_eh.erl @@ -0,0 +1,127 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009. 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% +%% + +%%% @doc Event handler module +%%% +%%% <p>This is an event handler module used for testing that +%%% Common Test generates events as expected.</p> +%%% +-module(ct_test_support_eh). + +-behaviour(gen_event). + +-include_lib("test_server/include/test_server.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +%% gen_event callbacks +-export([init/1, handle_event/2, handle_call/2, + handle_info/2, terminate/2, code_change/3]). + +-record(state, {cbm=ct_test_support, + trace_level=50}). + +%%==================================================================== +%% gen_event callbacks +%%==================================================================== +%%-------------------------------------------------------------------- +%% Function: init(Args) -> {ok, State} +%% Description: Whenever a new event handler is added to an event manager, +%% this function is called to initialize the event handler. +%%-------------------------------------------------------------------- +init(Args) -> + + S1 = case lists:keysearch(cbm, 1, Args) of + {_,{cbm,CBM}} -> + #state{cbm=CBM}; + _ -> + #state{} + end, + S2 = case lists:keysearch(trace_level, 1, Args) of + {_,{trace_level,Level}} -> + S1#state{trace_level=Level}; + _ -> + S1 + end, + print(S2#state.trace_level, "Event Handler ~w started!~n", [?MODULE]), + {ok,S2}. + +%%-------------------------------------------------------------------- +%% Function: +%% handle_event(Event, State) -> {ok, State} | +%% {swap_handler, Args1, State1, Mod2, Args2} | +%% remove_handler +%% Description:Whenever an event manager receives an event sent using +%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for +%% each installed event handler to handle the event. +%%-------------------------------------------------------------------- +handle_event(Event, State=#state{cbm=CBM, trace_level=_Level}) -> + % print(_Level, "~p: ~p~n", [Event#event.name,Event#event.data]), + CBM:handle_event(?MODULE, Event), + {ok,State}. + +%%-------------------------------------------------------------------- +%% Function: +%% handle_call(Request, State) -> {ok, Reply, State} | +%% {swap_handler, Reply, Args1, State1, +%% Mod2, Args2} | +%% {remove_handler, Reply} +%% Description: Whenever an event manager receives a request sent using +%% gen_event:call/3,4, this function is called for the specified event +%% handler to handle the request. +%%-------------------------------------------------------------------- +handle_call(_Req, State) -> + Reply = ok, + {ok, Reply, State}. + +%%-------------------------------------------------------------------- +%% Function: +%% handle_info(Info, State) -> {ok, State} | +%% {swap_handler, Args1, State1, Mod2, Args2} | +%% remove_handler +%% Description: This function is called for each installed event handler when +%% an event manager receives any other message than an event or a synchronous +%% request (or a system message). +%%-------------------------------------------------------------------- +handle_info(_Info, State) -> + {ok, State}. + +%%-------------------------------------------------------------------- +%% Function: terminate(Reason, State) -> void() +%% Description:Whenever an event handler is deleted from an event manager, +%% this function is called. It should be the opposite of Module:init/1 and +%% do any necessary cleaning up. +%%-------------------------------------------------------------------- +terminate(_Reason, _State) -> + ok. + +%%-------------------------------------------------------------------- +%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} +%% Description: Convert process state when code is changed +%%-------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%-------------------------------------------------------------------- +%%% Internal functions +%%-------------------------------------------------------------------- + +print(Level, _Str, _Args) -> + test_server:format(Level, _Str,_Args). + + |