aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl
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/empty_scb.erl
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/empty_scb.erl')
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/empty_scb.erl26
1 files changed, 17 insertions, 9 deletions
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