From a99c84bf251e21f23c77f1026e32e63cf552143e Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Mon, 29 Feb 2016 15:42:08 +0100 Subject: Update ct_hooks test suites --- .../cth/tests/crash_init_cth.erl | 48 ++-- .../cth/tests/ct_cth_empty_SUITE.erl | 75 ++++--- .../ct_hooks_SUITE_data/cth/tests/empty_cth.erl | 36 ++- .../cth/tests/fail_pre_suite_cth.erl | 130 +++++------ .../ct_hooks_SUITE_data/cth/tests/minimal_cth.erl | 46 ++-- .../cth/tests/minimal_terminate_cth.erl | 64 +++--- .../ct_hooks_SUITE_data/cth/tests/prio_cth.erl | 134 +++++------ .../cth/tests/recover_post_suite_cth.erl | 134 +++++------ .../ct_hooks_SUITE_data/cth/tests/same_id_cth.erl | 136 +++++------ .../cth/tests/skip_post_suite_cth.erl | 130 +++++------ .../cth/tests/skip_pre_end_cth.erl | 134 +++++------ .../cth/tests/skip_pre_suite_cth.erl | 132 +++++------ .../cth/tests/state_update_cth.erl | 154 +++++++------ .../ct_hooks_SUITE_data/cth/tests/undef_cth.erl | 128 ++++++----- .../cth/tests/update_config_cth.erl | 154 +++++++------ .../cth/tests/verify_config_cth.erl | 248 +++++++++++---------- .../cth/tests/verify_data_dir_cth.erl | 178 ++++++++------- 17 files changed, 1086 insertions(+), 975 deletions(-) (limited to 'lib/common_test') diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl index 3b2fd4b3c0..023f6440c2 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/crash_init_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,22 +14,22 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(crash_init_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --export([init/2]). - -init(Id, Opts) -> - empty_cth:init(Id, Opts), - exit(diediedie). - +%% +%% %CopyrightEnd% +%% + + +-module(crash_init_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-export([init/2]). + +init(Id, Opts) -> + empty_cth:init(Id, Opts), + exit(diediedie). + diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl index be2ade0715..c443700dde 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_empty_SUITE.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,35 +14,36 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(ct_cth_empty_SUITE). - --suite_defaults([{timetrap, {minutes, 10}}]). - -%% Note: This directive should only be used in test suites. --compile(export_all). - --include("ct.hrl"). - -%% Test server callback functions -init_per_suite(Config) -> - Config. - -end_per_suite(_Config) -> - ok. - -init_per_testcase(_TestCase, Config) -> - Config. - -end_per_testcase(_TestCase, _Config) -> - ok. - -all() -> - [test_case]. - -%% Test cases starts here. -test_case(Config) when is_list(Config) -> - ok. +%% +%% %CopyrightEnd% +%% + +-module(ct_cth_empty_SUITE). + +-suite_defaults([{timetrap, {minutes, 10}}]). + +%% Note: This directive should only be used in test suites. +-compile(export_all). + +-include("ct.hrl"). + +%% Test server callback functions +init_per_suite(Config) -> + Config. + +end_per_suite(_Config) -> + ok. + +init_per_testcase(_TestCase, Config) -> + Config. + +end_per_testcase(_TestCase, _Config) -> + ok. + +all() -> + [test_case]. + +%% Test cases starts here. +test_case(Config) when is_list(Config) -> + ok. + diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl index f223f031d7..e5bb4f3ef6 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl @@ -50,6 +50,8 @@ -export([post_end_per_group/4]). -export([pre_init_per_testcase/3]). +-export([post_init_per_testcase/4]). +-export([pre_end_per_testcase/3]). -export([post_end_per_testcase/4]). -export([on_tc_fail/3]). @@ -208,7 +210,7 @@ post_end_per_group(Group,Config,Return,State) -> ct:log("~w:post_end_per_group(~w) called", [?MODULE,Group]), {Return, State}. -%% @doc Called before each test case. +%% @doc Called before init_per_testcase/2 for each test case. %% You can change the config in this function. -spec pre_init_per_testcase(TC :: atom(), Config :: config(), @@ -222,8 +224,36 @@ pre_init_per_testcase(TC,Config,State) -> ct:log("~w:pre_init_per_testcase(~w) called", [?MODULE,TC]), {Config, State}. -%% @doc Called after each test case. Note that the config cannot be -%% changed here, only the status of the test case. +%% @doc Called after init_per_testcase/2, and before the test case. +-spec post_init_per_testcase(TC :: atom(), + Config :: config(), + Return :: config() | skip_or_fail(), + State :: #state{}) -> + {config() | skip_or_fail(), NewState :: #state{}}. +post_init_per_testcase(TC,Config,Return,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, post_init_per_testcase, + [TC,Config,Return,State]}}), + ct:log("~w:post_init_per_testcase(~w) called", [?MODULE,TC]), + {Return, State}. + +%% @doc Called before end_per_testacse/2. No skip or fail allowed here, +%% only config additions. +-spec pre_end_per_testcase(TC :: atom(), + Config :: config(), + State :: #state{}) -> + {config(), NewState :: #state{}}. +pre_end_per_testcase(TC,Config,State) -> + gen_event:notify( + ?CT_EVMGR_REF, #event{ name = cth, node = node(), + data = {?MODULE, pre_end_per_testcase, + [TC,Config,State]}}), + ct:log("~w:pre_end_per_testcase(~w) called", [?MODULE,TC]), + {Config, State}. + +%% @doc Called after end_per_testcase/2 for each test case. Note that +%% the config cannot be changed here, only the status of the test case. -spec post_end_per_testcase(TC :: atom(), Config :: config(), Return :: term(), diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl index 98e4548864..a79f4d4541 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/fail_pre_suite_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,60 +14,66 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(fail_pre_suite_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State), - {{fail, "Test failure"}, State}. - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(fail_pre_suite_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State), + {{fail, "Test failure"}, State}. + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl index 8898a54b8d..a084423cf3 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,21 +14,21 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(minimal_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --export([init/2]). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - +%% +%% %CopyrightEnd% +%% + + +-module(minimal_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-export([init/2]). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl index 2414da0683..7895c43aeb 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/minimal_terminate_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,30 +14,30 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(minimal_terminate_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --export([init/2]). --export([terminate/1]). --export([on_tc_skip/3]). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). - - +%% +%% %CopyrightEnd% +%% + + +-module(minimal_terminate_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-export([init/2]). +-export([terminate/1]). +-export([on_tc_skip/3]). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). + + diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/prio_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/prio_cth.erl index 0f6ef7c596..72d6d186ed 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/prio_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/prio_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,62 +14,68 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(prio_cth). - - --include_lib("common_test/src/ct_util.hrl"). - - -%% CT Hooks --compile(export_all). - -id(Opts) -> - empty_cth:id(Opts). - -init(Id, Opts) -> - {ok, [Prio|_] = State} = empty_cth:init(Id, Opts), - {ok, State, Prio}. - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State). - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(prio_cth). + + +-include_lib("common_test/src/ct_util.hrl"). + + +%% CT Hooks +-compile(export_all). + +id(Opts) -> + empty_cth:id(Opts). + +init(Id, Opts) -> + {ok, [Prio|_] = State} = empty_cth:init(Id, Opts), + {ok, State, Prio}. + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State). + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl index dfb696bcb9..cf484d3cd7 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/recover_post_suite_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,62 +14,68 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(recover_post_suite_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State). - -post_init_per_suite(Suite,Config,{'EXIT',Reason} = Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State), - {lists:keydelete(tc_status,1,Config),State}; -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(recover_post_suite_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State). + +post_init_per_suite(Suite,Config,{'EXIT',Reason} = Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State), + {lists:keydelete(tc_status,1,Config),State}; +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl index 50b220d093..60615d97fc 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/same_id_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,63 +14,69 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(same_id_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -id(Opts) -> - empty_cth:id(Opts), - ?MODULE. - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State). - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(same_id_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +id(Opts) -> + empty_cth:id(Opts), + ?MODULE. + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State). + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl index d8332f77f6..56163e730c 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_post_suite_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,60 +14,66 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(skip_post_suite_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State). - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State), - {{skip, "Test skip"}, State}. - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(skip_post_suite_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State). + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State), + {{skip, "Test skip"}, State}. + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_end_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_end_cth.erl index 3c490c9fea..deb622b316 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_end_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_end_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,62 +14,68 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(skip_pre_end_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State). - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State), - {{skip, "Test skip"}, State}. - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State), - {{skip, "Test skip"}, State}. - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(skip_pre_end_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State). + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State), + {{skip, "Test skip"}, State}. + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State), + {{skip, "Test skip"}, State}. + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl index 3ef08ff4e1..ea1d485700 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/skip_pre_suite_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,61 +14,67 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(skip_pre_suite_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State), - {{skip, "Test skip"}, State}. - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(skip_pre_suite_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State), + {{skip, "Test skip"}, State}. + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl index 338336a140..c2135bbbee 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/state_update_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,71 +14,79 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(state_update_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - State = empty_cth:init(Id, Opts), - {ok, [init|State]}. - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State), - {Config, [pre_init_per_suite|State]}. - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State), - {Config, [post_init_per_suite|State]}. - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State), - {Config, [pre_end_per_suite|State]}. - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State), - {Return, [post_end_per_suite|State]}. - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State), - {Config, [pre_init_per_group|State]}. - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State), - {Return, [post_init_per_group|State]}. - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State), - {Config, [pre_end_per_group|State]}. - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State), - {Return, [post_end_per_group|State]}. - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State), - {Config, [pre_init_per_testcase|State]}. - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State), - {Return, [post_end_per_testcase|State]}. - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State), - [on_tc_fail|State]. - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State), - [on_tc_skip|State]. - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(state_update_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + State = empty_cth:init(Id, Opts), + {ok, [init|State]}. + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State), + {Config, [pre_init_per_suite|State]}. + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State), + {Config, [post_init_per_suite|State]}. + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State), + {Config, [pre_end_per_suite|State]}. + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State), + {Return, [post_end_per_suite|State]}. + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State), + {Config, [pre_init_per_group|State]}. + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State), + {Return, [post_init_per_group|State]}. + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State), + {Config, [pre_end_per_group|State]}. + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State), + {Return, [post_end_per_group|State]}. + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State), + {Config, [pre_init_per_testcase|State]}. + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State), + {Return, [post_init_per_testcase|State]}. + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State), + {Config, [pre_end_per_testcase|State]}. + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State), + {Return, [post_end_per_testcase|State]}. + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State), + [on_tc_fail|State]. + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State), + [on_tc_skip|State]. + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl index da43d56c12..5ac4bdddf8 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/undef_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,59 +14,65 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(undef_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -pre_init_per_suite(_Suite, _Config, _State) -> - lists:flaten([1,2,[3,4]]). - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(undef_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +pre_init_per_suite(_Suite, _Config, _State) -> + lists:flaten([1,2,[3,4]]). + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl index 0202201eed..5503bf85ae 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/update_config_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2011. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,71 +14,79 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - - --module(update_config_cth). - - --include_lib("common_test/src/ct_util.hrl"). --include_lib("common_test/include/ct_event.hrl"). - --define(now, os:timestamp()). - -%% CT Hooks --compile(export_all). - -init(Id, Opts) -> - empty_cth:init(Id, Opts). - -pre_init_per_suite(Suite, Config, State) -> - empty_cth:pre_init_per_suite(Suite,Config,State), - {[{pre_init_per_suite,?now}|Config],State}. - -post_init_per_suite(Suite,Config,Return,State) -> - empty_cth:post_init_per_suite(Suite,Config,Return,State), - {[{post_init_per_suite,?now}|Return],State}. - -pre_end_per_suite(Suite,Config,State) -> - empty_cth:pre_end_per_suite(Suite,Config,State), - {[{pre_end_per_suite,?now}|Config],State}. - -post_end_per_suite(Suite,Config,Return,State) -> - empty_cth:post_end_per_suite(Suite,Config,Return,State), - NewConfig = [{post_end_per_suite,?now}|Config], - {NewConfig,NewConfig}. - -pre_init_per_group(Group,Config,State) -> - empty_cth:pre_init_per_group(Group,Config,State), - {[{pre_init_per_group,?now}|Config],State}. - -post_init_per_group(Group,Config,Return,State) -> - empty_cth:post_init_per_group(Group,Config,Return,State), - {[{post_init_per_group,?now}|Return],State}. - -pre_end_per_group(Group,Config,State) -> - empty_cth:pre_end_per_group(Group,Config,State), - {[{pre_end_per_group,?now}|Config],State}. - -post_end_per_group(Group,Config,Return,State) -> - empty_cth:post_end_per_group(Group,Config,Return,State), - {[{post_end_per_group,?now}|Config],State}. - -pre_init_per_testcase(TC,Config,State) -> - empty_cth:pre_init_per_testcase(TC,Config,State), - {[{pre_init_per_testcase,?now}|Config],State}. - -post_end_per_testcase(TC,Config,Return,State) -> - empty_cth:post_end_per_testcase(TC,Config,Return,State), - {[{post_end_per_testcase,?now}|Config],State}. - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + + +-module(update_config_cth). + + +-include_lib("common_test/src/ct_util.hrl"). +-include_lib("common_test/include/ct_event.hrl"). + +-define(now, os:timestamp()). + +%% CT Hooks +-compile(export_all). + +init(Id, Opts) -> + empty_cth:init(Id, Opts). + +pre_init_per_suite(Suite, Config, State) -> + empty_cth:pre_init_per_suite(Suite,Config,State), + {[{pre_init_per_suite,?now}|Config],State}. + +post_init_per_suite(Suite,Config,Return,State) -> + empty_cth:post_init_per_suite(Suite,Config,Return,State), + {[{post_init_per_suite,?now}|Return],State}. + +pre_end_per_suite(Suite,Config,State) -> + empty_cth:pre_end_per_suite(Suite,Config,State), + {[{pre_end_per_suite,?now}|Config],State}. + +post_end_per_suite(Suite,Config,Return,State) -> + empty_cth:post_end_per_suite(Suite,Config,Return,State), + NewConfig = [{post_end_per_suite,?now}|Config], + {NewConfig,NewConfig}. + +pre_init_per_group(Group,Config,State) -> + empty_cth:pre_init_per_group(Group,Config,State), + {[{pre_init_per_group,?now}|Config],State}. + +post_init_per_group(Group,Config,Return,State) -> + empty_cth:post_init_per_group(Group,Config,Return,State), + {[{post_init_per_group,?now}|Return],State}. + +pre_end_per_group(Group,Config,State) -> + empty_cth:pre_end_per_group(Group,Config,State), + {[{pre_end_per_group,?now}|Config],State}. + +post_end_per_group(Group,Config,Return,State) -> + empty_cth:post_end_per_group(Group,Config,Return,State), + {[{post_end_per_group,?now}|Config],State}. + +pre_init_per_testcase(TC,Config,State) -> + empty_cth:pre_init_per_testcase(TC,Config,State), + {[{pre_init_per_testcase,?now}|Config],State}. + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State), + {[{post_init_per_testcase,?now}|Config],State}. + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State), + {[{pre_end_per_testcase,?now}|Config],State}. + +post_end_per_testcase(TC,Config,Return,State) -> + empty_cth:post_end_per_testcase(TC,Config,Return,State), + {[{post_end_per_testcase,?now}|Config],State}. + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl index 754163abae..1df212f266 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_config_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,118 +14,126 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(verify_config_cth). - --include_lib("common_test/src/ct_util.hrl"). - -%% CT Hooks --compile(export_all). - --define(val(K, L), proplists:get_value(K, L)). - -id(Opts) -> - ?MODULE. - -init(Id, Opts) -> - {ok, State} = empty_cth:init(Id, Opts), - {ok, State}. - -pre_init_per_suite(Suite, Config, State) -> - ct_no_config_SUITE = ct:get_config(suite_cfg), - empty_cth:pre_init_per_suite(Suite, - [{pre_init_per_suite,true} | Config], - State). - -post_init_per_suite(Suite,Config,Return,State) -> - true = ?val(pre_init_per_suite, Return), - ct_no_config_SUITE = ct:get_config(suite_cfg), - empty_cth:post_init_per_suite(Suite, - Config, - [{post_init_per_suite,true} | Return], - State). - -pre_end_per_suite(Suite,Config,State) -> - true = ?val(post_init_per_suite, Config), - ct_no_config_SUITE = ct:get_config(suite_cfg), - empty_cth:pre_end_per_suite(Suite, - [{pre_end_per_suite,true} | Config], - State). - -post_end_per_suite(Suite,Config,Return,State) -> - true = ?val(pre_end_per_suite, Config), - ct_no_config_SUITE = ct:get_config(suite_cfg), - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - true = ?val(post_init_per_suite, Config), - ct_no_config_SUITE = ct:get_config(suite_cfg), - test_group = ct:get_config(group_cfg), - empty_cth:pre_init_per_group(Group, - [{pre_init_per_group,true} | Config], - State). - -post_init_per_group(Group,Config,Return,State) -> - true = ?val(pre_init_per_group, Return), - test_group = ct:get_config(group_cfg), - empty_cth:post_init_per_group(Group, - Config, - [{post_init_per_group,true} | Return], - State). - -pre_end_per_group(Group,Config,State) -> - true = ?val(post_init_per_group, Config), - ct_no_config_SUITE = ct:get_config(suite_cfg), - test_group = ct:get_config(group_cfg), - empty_cth:pre_end_per_group(Group, - [{pre_end_per_group,true} | Config], - State). - -post_end_per_group(Group,Config,Return,State) -> - true = ?val(pre_end_per_group, Config), - ct_no_config_SUITE = ct:get_config(suite_cfg), - test_group = ct:get_config(group_cfg), - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - true = ?val(post_init_per_suite, Config), - case ?val(name, ?val(tc_group_properties, Config)) of - undefined -> - ok; - _ -> - true = ?val(post_init_per_group, Config), - test_group = ct:get_config(group_cfg) - end, - ct_no_config_SUITE = ct:get_config(suite_cfg), - CfgKey = list_to_atom(atom_to_list(TC) ++ "_cfg"), - TC = ct:get_config(CfgKey), - empty_cth:pre_init_per_testcase(TC, - [{pre_init_per_testcase,true} | Config], - State). - -post_end_per_testcase(TC,Config,Return,State) -> - true = ?val(post_init_per_suite, Config), - true = ?val(pre_init_per_testcase, Config), - case ?val(name, ?val(tc_group_properties, Config)) of - undefined -> - ok; - _ -> - true = ?val(post_init_per_group, Config), - test_group = ct:get_config(group_cfg) - end, - ct_no_config_SUITE = ct:get_config(suite_cfg), - CfgKey = list_to_atom(atom_to_list(TC) ++ "_cfg"), - TC = ct:get_config(CfgKey), - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + +-module(verify_config_cth). + +-include_lib("common_test/src/ct_util.hrl"). + +%% CT Hooks +-compile(export_all). + +-define(val(K, L), proplists:get_value(K, L)). + +id(Opts) -> + ?MODULE. + +init(Id, Opts) -> + {ok, State} = empty_cth:init(Id, Opts), + {ok, State}. + +pre_init_per_suite(Suite, Config, State) -> + ct_no_config_SUITE = ct:get_config(suite_cfg), + empty_cth:pre_init_per_suite(Suite, + [{pre_init_per_suite,true} | Config], + State). + +post_init_per_suite(Suite,Config,Return,State) -> + true = ?val(pre_init_per_suite, Return), + ct_no_config_SUITE = ct:get_config(suite_cfg), + empty_cth:post_init_per_suite(Suite, + Config, + [{post_init_per_suite,true} | Return], + State). + +pre_end_per_suite(Suite,Config,State) -> + true = ?val(post_init_per_suite, Config), + ct_no_config_SUITE = ct:get_config(suite_cfg), + empty_cth:pre_end_per_suite(Suite, + [{pre_end_per_suite,true} | Config], + State). + +post_end_per_suite(Suite,Config,Return,State) -> + true = ?val(pre_end_per_suite, Config), + ct_no_config_SUITE = ct:get_config(suite_cfg), + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + true = ?val(post_init_per_suite, Config), + ct_no_config_SUITE = ct:get_config(suite_cfg), + test_group = ct:get_config(group_cfg), + empty_cth:pre_init_per_group(Group, + [{pre_init_per_group,true} | Config], + State). + +post_init_per_group(Group,Config,Return,State) -> + true = ?val(pre_init_per_group, Return), + test_group = ct:get_config(group_cfg), + empty_cth:post_init_per_group(Group, + Config, + [{post_init_per_group,true} | Return], + State). + +pre_end_per_group(Group,Config,State) -> + true = ?val(post_init_per_group, Config), + ct_no_config_SUITE = ct:get_config(suite_cfg), + test_group = ct:get_config(group_cfg), + empty_cth:pre_end_per_group(Group, + [{pre_end_per_group,true} | Config], + State). + +post_end_per_group(Group,Config,Return,State) -> + true = ?val(pre_end_per_group, Config), + ct_no_config_SUITE = ct:get_config(suite_cfg), + test_group = ct:get_config(group_cfg), + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + true = ?val(post_init_per_suite, Config), + case ?val(name, ?val(tc_group_properties, Config)) of + undefined -> + ok; + _ -> + true = ?val(post_init_per_group, Config), + test_group = ct:get_config(group_cfg) + end, + ct_no_config_SUITE = ct:get_config(suite_cfg), + CfgKey = list_to_atom(atom_to_list(TC) ++ "_cfg"), + TC = ct:get_config(CfgKey), + empty_cth:pre_init_per_testcase(TC, + [{pre_init_per_testcase,true} | Config], + State). + +%%! TODO: Verify Config also in post_init and pre_end! + +post_init_per_testcase(TC,Config,Return,State) -> + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + true = ?val(post_init_per_suite, Config), + true = ?val(pre_init_per_testcase, Config), + case ?val(name, ?val(tc_group_properties, Config)) of + undefined -> + ok; + _ -> + true = ?val(post_init_per_group, Config), + test_group = ct:get_config(group_cfg) + end, + ct_no_config_SUITE = ct:get_config(suite_cfg), + CfgKey = list_to_atom(atom_to_list(TC) ++ "_cfg"), + TC = ct:get_config(CfgKey), + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). diff --git a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_data_dir_cth.erl b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_data_dir_cth.erl index 2c8f7a50aa..7abcea4393 100644 --- a/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_data_dir_cth.erl +++ b/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/verify_data_dir_cth.erl @@ -1,8 +1,8 @@ -%% -%% %CopyrightBegin% -%% -%% Copyright Ericsson AB 2010-2012. All Rights Reserved. -%% +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2012. All Rights Reserved. +%% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. %% You may obtain a copy of the License at @@ -14,83 +14,91 @@ %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %% See the License for the specific language governing permissions and %% limitations under the License. -%% -%% %CopyrightEnd% -%% - --module(verify_data_dir_cth). - --include_lib("common_test/src/ct_util.hrl"). - -%% CT Hooks --compile(export_all). - --define(val(K, L), proplists:get_value(K, L)). - -check_dirs(State,Config) -> - DataDirName = ?val(data_dir_name, State), - %% check priv_dir - PrivDir = proplists:get_value(priv_dir, Config), - "log_private" = filename:basename(PrivDir), - {ok,_} = file:list_dir(PrivDir), - - %% check data_dir - DataDir = proplists:get_value(data_dir, Config), - DataDirName = filename:basename(DataDir), - ok. - -id(_Opts) -> - ?MODULE. - -init(Id, _Opts) -> - {ok, _State} = empty_cth:init(Id, []), - {ok, [{data_dir_name,"ct_data_dir_SUITE_data"}]}. - -pre_init_per_suite(Suite,Config,State) -> - check_dirs(State,Config), - empty_cth:pre_init_per_suite(Suite,Config,State). - -post_init_per_suite(Suite,Config,Return,State) -> - check_dirs(State,Return), - empty_cth:post_init_per_suite(Suite,Config,Return,State). - -pre_end_per_suite(Suite,Config,State) -> - check_dirs(State,Config), - empty_cth:pre_end_per_suite(Suite,Config,State). - -post_end_per_suite(Suite,Config,Return,State) -> - check_dirs(State,Config), - empty_cth:post_end_per_suite(Suite,Config,Return,State). - -pre_init_per_group(Group,Config,State) -> - check_dirs(State,Config), - empty_cth:pre_init_per_group(Group,Config,State). - -post_init_per_group(Group,Config,Return,State) -> - check_dirs(State,Return), - empty_cth:post_init_per_group(Group,Config,Return,State). - -pre_end_per_group(Group,Config,State) -> - check_dirs(State,Config), - empty_cth:pre_end_per_group(Group,Config,State). - -post_end_per_group(Group,Config,Return,State) -> - check_dirs(State,Config), - empty_cth:post_end_per_group(Group,Config,Return,State). - -pre_init_per_testcase(TC,Config,State) -> - check_dirs(State,Config), - empty_cth:pre_init_per_testcase(TC,Config,State). - -post_end_per_testcase(TC,Config,Return,State) -> - check_dirs(State,Config), - empty_cth:post_end_per_testcase(TC,Config,Return,State). - -on_tc_fail(TC, Reason, State) -> - empty_cth:on_tc_fail(TC,Reason,State). - -on_tc_skip(TC, Reason, State) -> - empty_cth:on_tc_skip(TC,Reason,State). - -terminate(State) -> - empty_cth:terminate(State). +%% +%% %CopyrightEnd% +%% + +-module(verify_data_dir_cth). + +-include_lib("common_test/src/ct_util.hrl"). + +%% CT Hooks +-compile(export_all). + +-define(val(K, L), proplists:get_value(K, L)). + +check_dirs(State,Config) -> + DataDirName = ?val(data_dir_name, State), + %% check priv_dir + PrivDir = proplists:get_value(priv_dir, Config), + "log_private" = filename:basename(PrivDir), + {ok,_} = file:list_dir(PrivDir), + + %% check data_dir + DataDir = proplists:get_value(data_dir, Config), + DataDirName = filename:basename(DataDir), + ok. + +id(_Opts) -> + ?MODULE. + +init(Id, _Opts) -> + {ok, _State} = empty_cth:init(Id, []), + {ok, [{data_dir_name,"ct_data_dir_SUITE_data"}]}. + +pre_init_per_suite(Suite,Config,State) -> + check_dirs(State,Config), + empty_cth:pre_init_per_suite(Suite,Config,State). + +post_init_per_suite(Suite,Config,Return,State) -> + check_dirs(State,Return), + empty_cth:post_init_per_suite(Suite,Config,Return,State). + +pre_end_per_suite(Suite,Config,State) -> + check_dirs(State,Config), + empty_cth:pre_end_per_suite(Suite,Config,State). + +post_end_per_suite(Suite,Config,Return,State) -> + check_dirs(State,Config), + empty_cth:post_end_per_suite(Suite,Config,Return,State). + +pre_init_per_group(Group,Config,State) -> + check_dirs(State,Config), + empty_cth:pre_init_per_group(Group,Config,State). + +post_init_per_group(Group,Config,Return,State) -> + check_dirs(State,Return), + empty_cth:post_init_per_group(Group,Config,Return,State). + +pre_end_per_group(Group,Config,State) -> + check_dirs(State,Config), + empty_cth:pre_end_per_group(Group,Config,State). + +post_end_per_group(Group,Config,Return,State) -> + check_dirs(State,Config), + empty_cth:post_end_per_group(Group,Config,Return,State). + +pre_init_per_testcase(TC,Config,State) -> + check_dirs(State,Config), + empty_cth:pre_init_per_testcase(TC,Config,State). + +post_init_per_testcase(TC,Config,Return,State) -> + check_dirs(State,Config), + empty_cth:post_init_per_testcase(TC,Config,Return,State). + +pre_end_per_testcase(TC,Config,State) -> + check_dirs(State,Config), + empty_cth:pre_end_per_testcase(TC,Config,State). + +post_end_per_testcase(TC,Config,Return,State) -> + check_dirs(State,Config), + empty_cth:post_end_per_testcase(TC,Config,Return,State). + +on_tc_fail(TC, Reason, State) -> + empty_cth:on_tc_fail(TC,Reason,State). + +on_tc_skip(TC, Reason, State) -> + empty_cth:on_tc_skip(TC,Reason,State). + +terminate(State) -> + empty_cth:terminate(State). -- cgit v1.2.3