diff options
author | Peter Andersson <[email protected]> | 2011-12-05 15:45:45 +0100 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2011-12-07 15:30:22 +0100 |
commit | 093cfddf405754c1027839746ba93a6ac512d313 (patch) | |
tree | fd56e479ba4ab8eca9fe1bcf6ca77dcb3e22d457 | |
parent | e0138e0284ccba8d633aa31c4cfa8ff3073d985f (diff) | |
download | otp-093cfddf405754c1027839746ba93a6ac512d313.tar.gz otp-093cfddf405754c1027839746ba93a6ac512d313.tar.bz2 otp-093cfddf405754c1027839746ba93a6ac512d313.zip |
Add config info suite
-rw-r--r-- | lib/common_test/test/ct_config_info_SUITE.erl | 81 | ||||
-rw-r--r-- | lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl | 158 |
2 files changed, 226 insertions, 13 deletions
diff --git a/lib/common_test/test/ct_config_info_SUITE.erl b/lib/common_test/test/ct_config_info_SUITE.erl index df8fff7701..b217b80dd7 100644 --- a/lib/common_test/test/ct_config_info_SUITE.erl +++ b/lib/common_test/test/ct_config_info_SUITE.erl @@ -18,9 +18,10 @@ %% %%%------------------------------------------------------------------- -%%% File: +%%% File: ct_config_info_SUITE %%% -%%% Description: +%%% Description: Test how Common Test handles info functions +%%% for the config functions. %%% %%%------------------------------------------------------------------- -module(ct_config_info_SUITE). @@ -58,11 +59,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [ - timetrap_all, - timetrap_group, - timetrap_group_case, - require, - require_default + config_info ]. %%-------------------------------------------------------------------- @@ -71,12 +68,12 @@ all() -> %%%----------------------------------------------------------------- %%% -timetrap_all(Config) when is_list(Config) -> +config_info(Config) when is_list(Config) -> DataDir = ?config(data_dir, Config), - Suite = filename:join(DataDir, "group_timetrap_1_SUITE"), + Suite = filename:join(DataDir, "config_info_1_SUITE"), {Opts,ERPid} = setup([{suite,Suite}, - {label,timetrap_all}], Config), - ok = execute(timetrap_all, Opts, ERPid, Config). + {label,config_info}], Config), + ok = execute(config_info, Opts, ERPid, Config). %%%----------------------------------------------------------------- %%% HELP FUNCTIONS @@ -118,6 +115,64 @@ events_to_check(Test, N) -> test_events(Test) ++ events_to_check(Test, N-1). -test_events(timetrap_all) -> +test_events(config_info) -> [ - ]; + {?eh,start_logging,{'DEF','RUNDIR'}}, + {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}}, + {?eh,start_info,{1,1,6}}, + {?eh,tc_done,{config_info_1_SUITE,init_per_suite,ok}}, + + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g1,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {init_per_group,unknown,[]}, + {failed,{timetrap_timeout,400}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,t11, + {failed,{config_info_1_SUITE,init_per_group,{timetrap_timeout,400}}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,end_per_group, + {failed,{config_info_1_SUITE,init_per_group, + {timetrap_timeout,400}}}}}], + + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g2,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{init_per_group,g2,[]},ok}}, + {?eh,tc_done,{config_info_1_SUITE,t21,ok}}, + {?eh,tc_start,{config_info_1_SUITE,{end_per_group,g2,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {end_per_group,unknown,[]}, + {failed,{timetrap_timeout,350}}}}], + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g3,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{init_per_group,g3,[]},ok}}, + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g4,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {init_per_group,unknown,[]}, + {failed,{timetrap_timeout,400}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,t41, + {failed,{config_info_1_SUITE,init_per_group, + {timetrap_timeout,400}}}}}, + {?eh,tc_auto_skip,{config_info_1_SUITE,end_per_group, + {failed,{config_info_1_SUITE,init_per_group, + {timetrap_timeout,400}}}}}], + {?eh,tc_start,{config_info_1_SUITE,t31}}, + {?eh,tc_done,{config_info_1_SUITE,t31, + {skipped,{failed,{config_info_1_SUITE,init_per_testcase, + {timetrap_timeout,750}}}}}}, + {?eh,tc_start,{config_info_1_SUITE,t32}}, + {?eh,tc_done,{config_info_1_SUITE,t32, + {failed,{config_info_1_SUITE,end_per_testcase, + {timetrap_timeout,600}}}}}, + + [{?eh,tc_start,{config_info_1_SUITE,{init_per_group,g5,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{init_per_group,g5,[]},ok}}, + {?eh,tc_done,{config_info_1_SUITE,t51,ok}}, + {?eh,tc_start,{config_info_1_SUITE,{end_per_group,g5,[]}}}, + {?eh,tc_done,{config_info_1_SUITE, + {end_per_group,unknown,[]}, + {failed,{timetrap_timeout,350}}}}], + {?eh,tc_start,{config_info_1_SUITE,{end_per_group,g3,[]}}}, + {?eh,tc_done,{config_info_1_SUITE,{end_per_group,g3,[]},ok}}], + + {?eh,tc_start,{config_info_1_SUITE,end_per_suite}}, + {?eh,tc_done,{config_info_1_SUITE,end_per_suite, + {failed,{timetrap_timeout,300}}}}, + {?eh,test_done,{'DEF','STOP_TIME'}}, + {?eh,stop_logging,[]} + ]. diff --git a/lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl b/lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl new file mode 100644 index 0000000000..1ec5592e6a --- /dev/null +++ b/lib/common_test/test/ct_config_info_SUITE_data/config_info_1_SUITE.erl @@ -0,0 +1,158 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2009-2011. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +-module(config_info_1_SUITE). + +-compile(export_all). + +-include_lib("common_test/include/ct.hrl"). + +%%%----------------------------------------------------------------- + +suite() -> + [{timetrap,500}]. + +%%%----------------------------------------------------------------- + +group(_) -> + [{timetrap,250}]. + +%%%----------------------------------------------------------------- + +init_per_suite() -> + [{timetrap,1000}, + {require,suite_data}, + {default_config,suite_data,suite_data_val}]. + +init_per_suite(Config) -> + suite_data_val = ct:get_config(suite_data), + ct:sleep(750), + Config. + +%%%----------------------------------------------------------------- + +end_per_suite() -> + [{timetrap,300}, + {require,suite_data2}, + {default_config,suite_data2,suite_data2_val}]. + +end_per_suite(_Config) -> + suite_data2_val = ct:get_config(suite_data2), + ct:sleep(500), + ok. + +%%%----------------------------------------------------------------- + +init_per_group() -> + [{timetrap,400}]. + +init_per_group(g1, Config) -> + ct:sleep(1000); +init_per_group(g4, Config) -> + ct:sleep(1000); +init_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("init( ~w ): ~p", [G, GrProps1])), + ct:pal("init( ~w ): ~p", [G, GrProps1]), + Config. + +%%%----------------------------------------------------------------- + +end_per_group() -> + [{timetrap,350}]. + +end_per_group(g2, Config) -> + ct:sleep(1000); +end_per_group(g5, Config) -> + ct:sleep(1000); +end_per_group(G, Config) -> + GrProps = proplists:get_value(tc_group_properties, Config), + GrProps1 = proplists:delete(name, GrProps), + ct:comment(io_lib:format("end( ~w ): ~p", [G, GrProps1])), + ct:pal("end( ~w ): ~p", [G, GrProps1]), + ok. + +%%%----------------------------------------------------------------- +init_per_testcase() -> + [{timetrap,750}]. + +init_per_testcase(t1, Config) -> + ct:sleep(1000); +init_per_testcase(t31, Config) -> + ct:sleep(1000); +init_per_testcase(_TestCase, Config) -> + Config. + +%%%----------------------------------------------------------------- + +end_per_testcase() -> + [{timetrap,600}]. + +end_per_testcase(t2, Config) -> + ct:sleep(1000); +end_per_testcase(t32, Config) -> + ct:sleep(1000); +end_per_testcase(_TestCase, _Config) -> + ok. + +%%-------------------------------------------------------------------- +%% TEST DECLARATIONS +%%-------------------------------------------------------------------- + +groups() -> + [ + {g1,[],[t11]}, + {g2,[],[t21]}, + {g3,[],[{g4,[],[t41]}, t31, t32, {g5,[],[t51]}]} + ]. + +all() -> + [ + {group,g1}, + {group,g2}, + {group,g3} + ]. + +%%----------------------------------------------------------------- +%% TEST CASES +%%----------------------------------------------------------------- + +t1(_) -> + exit(should_not_execute). + +t2(_) -> + ok. + +t11(_) -> + exit(should_not_execute). + +t21(_) -> + ok. + +t31(_) -> + exit(should_not_execute). + +t32(_) -> + ok. + +t41(_) -> + exit(should_not_execute). + +t51(_) -> + ok. |