aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-02-09 13:59:50 +0100
committerLukas Larsson <[email protected]>2011-02-17 16:59:39 +0100
commite34cd721545915266a00b1ec55a9a5867c8459a4 (patch)
tree8de64f1bc8b139c60d5a0e66f49427bbd78de717 /lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests
parent15e8dd20b5ba2c82e683e87254f18c9af3625481 (diff)
downloadotp-e34cd721545915266a00b1ec55a9a5867c8459a4.tar.gz
otp-e34cd721545915266a00b1ec55a9a5867c8459a4.tar.bz2
otp-e34cd721545915266a00b1ec55a9a5867c8459a4.zip
Update SCBs to use a specific id/1 function for SCb overriding instead of returning it from init/1.
Diffstat (limited to 'lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests')
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl34
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl6
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl26
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl32
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl6
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl9
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl6
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl4
14 files changed, 112 insertions, 35 deletions
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl
new file mode 100644
index 0000000000..2c256c46df
--- /dev/null
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_id_scb.erl
@@ -0,0 +1,34 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(crash_id_scb).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% Suite Callbacks
+-export([id/1]).
+
+id(Opts) ->
+ empty_scb:id(Opts),
+ exit(diediedie).
+
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl
index 683459853f..c4138bbcef 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/crash_init_scb.erl
@@ -26,9 +26,9 @@
%% Suite Callbacks
--export([init/1]).
+-export([init/2]).
-init(Opts) ->
- empty_scb:init(Opts),
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts),
exit(diediedie).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl
index d9aa1e77e4..a82ca02d04 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl
@@ -35,7 +35,8 @@
-module(empty_scb).
%% Suite Callbacks
--export([init/1]).
+-export([id/1]).
+-export([init/2]).
-export([pre_init_per_suite/3]).
-export([post_init_per_suite/4]).
@@ -68,16 +69,23 @@
-record(state, { id = ?MODULE :: term()}).
%% @doc Always called before any other callback function. Use this to initiate
-%% any common state. It should return an ID for this SCB and a state. The ID
-%% is used to uniquly identify an SCB instance, if two SCB's return the same
-%% ID the seconds SCB is ignored. This function should NOT have any side
-%% effects as it might be called multiple times by common test.
--spec init(Opts :: proplist()) ->
+%% any common state. It should return an ID for this SCB and a state.
+-spec init(Id :: term(), Opts :: proplist()) ->
{Id :: term(), State :: #state{}}.
-init(Opts) ->
+init(Id, Opts) ->
gen_event:notify(?CT_EVMGR_REF, #event{ name = scb, node = node(),
- data = {?MODULE, init, [Opts]}}),
- {now(), Opts}.
+ data = {?MODULE, init, [Id, Opts]}}),
+ Opts.
+
+%% @doc The ID is used to uniquly identify an SCB instance, if two SCB's
+%% return the same ID the seconds SCB is ignored. This function should NOT
+%% have any side effects as it might be called multiple times by common test.
+-spec id(Opts :: proplist()) ->
+ Id :: term().
+id(Opts) ->
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ data = {?MODULE, id, [Opts]}}),
+ now().
%% @doc Called before init_per_suite is called. Note that this callback is
%% only called if the SCB is added before init_per_suite is run (eg. in a test
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl
index b3a3a5f94c..44c72f6795 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_post_suite_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl
index d49387ff8c..90f10d7531 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/fail_pre_suite_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State),
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl
new file mode 100644
index 0000000000..11fb8d739f
--- /dev/null
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/id_no_init_scb.erl
@@ -0,0 +1,32 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 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(id_no_init_scb).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% Suite Callbacks
+-export([id/1]).
+
+id(Opts) ->
+ empty_scb:id(Opts).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl
index e5fdbfb8a0..b3feb1383c 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl
@@ -26,8 +26,8 @@
%% Suite Callbacks
--export([init/1]).
+-export([init/2]).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl
index 864a09e3d0..26468f0789 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/recover_post_suite_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl
index 6853aa52e8..0fa708d5b6 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/same_id_scb.erl
@@ -28,9 +28,12 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- {_,State} = empty_scb:init(Opts),
- {?MODULE,State}.
+id(Opts) ->
+ empty_scb:id(Opts),
+ ?MODULE.
+
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl
index a2e0578814..bb93ebee0f 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_post_suite_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl
index 4a0725ce2f..9818964e7f 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/skip_pre_suite_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl
index 1da0f7a6e4..13c50cf1a1 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/state_update_scb.erl
@@ -27,9 +27,9 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- {Id,State} = empty_scb:init(Opts),
- {Id,[init|State]}.
+init(Id, Opts) ->
+ State = empty_scb:init(Id, Opts),
+ [init|State].
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State),
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl
index 9479f9d937..1cb64574c3 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(_Suite, _Config, _State) ->
lists:flaten([1,2,[3,4]]).
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl
index 6f21e49656..46a027403d 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/update_config_scb.erl
@@ -28,8 +28,8 @@
%% Suite Callbacks
-compile(export_all).
-init(Opts) ->
- empty_scb:init(Opts).
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
pre_init_per_suite(Suite, Config, State) ->
empty_scb:pre_init_per_suite(Suite,Config,State),