aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common_test/test')
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE.erl77
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl35
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl39
3 files changed, 150 insertions, 1 deletions
diff --git a/lib/common_test/test/ct_suite_callback_SUITE.erl b/lib/common_test/test/ct_suite_callback_SUITE.erl
index f8a111d28c..b45d395849 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE.erl
@@ -71,7 +71,8 @@ all() ->
all(suite) ->
[
- one_scb, two_scb, faulty_scb_no_init
+ one_scb, two_scb, faulty_scb_no_init, minimal_scb,
+ minimal_and_maximal_scb, faulty_scb_undef
].
@@ -92,6 +93,18 @@ faulty_scb_no_init(Config) when is_list(Config) ->
do_test(faulty_scb_no_init, "ct_scb_empty_SUITE.erl",[askjhdkljashdkaj],
Config).
+minimal_scb(Config) when is_list(Config) ->
+ do_test(minimal_scb, "ct_scb_empty_SUITE.erl",[minimal_scb],Config).
+
+minimal_and_maximal_scb(Config) when is_list(Config) ->
+ do_test(minimal_and_maximal_scb, "ct_scb_empty_SUITE.erl",
+ [minimal_scb, empty_scb],Config).
+
+faulty_scb_undef(Config) when is_list(Config) ->
+ do_test(faulty_scb_undef, "ct_scb_empty_SUITE.erl",
+ [undef_scb],Config).
+
+
%%%-----------------------------------------------------------------
%%% HELP FUNCTIONS
%%%-----------------------------------------------------------------
@@ -210,5 +223,67 @@ test_events(faulty_scb_no_init) ->
{?eh,stop_logging,[]}
];
+test_events(minimal_scb) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,scb,{minimal_scb,init,[[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(minimal_and_maximal_scb) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,scb,{minimal_scb,init,[[]]}},
+ {?eh,scb,{empty_scb,init,[[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
+ {?eh,scb,{empty_scb,pre_init_per_suite,[ct_scb_empty_SUITE,[]]}},
+ {?eh,scb,{empty_scb,post_init_per_suite,[ct_scb_empty_SUITE,[]]}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,ok}},
+
+ {?eh,tc_start,{ct_scb_empty_SUITE,test_case}},
+ {?eh,scb,{empty_scb,pre_init_per_testcase,[test_case,[]]}},
+ {?eh,scb,{empty_scb,post_end_per_testcase,[test_case,[]]}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,test_case,ok}},
+
+ {?eh,tc_start,{ct_scb_empty_SUITE,end_per_suite}},
+ {?eh,scb,{empty_scb,pre_end_per_suite,[ct_scb_empty_SUITE,[]]}},
+ {?eh,scb,{empty_scb,post_end_per_suite,[ct_scb_empty_SUITE,[]]}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,scb,{empty_scb,terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
+test_events(faulty_scb_undef) ->
+ FailReasonStr = "undef_scb:pre_init_per_suite/3 SCB call failed",
+ FailReason = {ct_scb_empty_SUITE,init_per_suite,
+ {failed,FailReasonStr}},
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,scb,{undef_scb,init,[[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{ct_scb_empty_SUITE,init_per_suite}},
+ {?eh,tc_done,{ct_scb_empty_SUITE,init_per_suite,
+ {fail, FailReasonStr}}},
+
+ {?eh,tc_auto_skip,{ct_scb_empty_SUITE,test_case,
+ {failed, FailReason}}},
+ {?eh,tc_auto_skip,{ct_scb_empty_SUITE,end_per_suite,
+ {failed, FailReason}}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ];
+
test_events(ok) ->
ok.
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
new file mode 100644
index 0000000000..c08f1aba4a
--- /dev/null
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_scb.erl
@@ -0,0 +1,35 @@
+%%
+%% %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(minimal_scb).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% Suite Callbacks
+-export([init/1]).
+
+init(Opts) ->
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ data = {?MODULE, init, [Opts]}}),
+ {now(), Opts}.
+
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
new file mode 100644
index 0000000000..cc0651d3dd
--- /dev/null
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/undef_scb.erl
@@ -0,0 +1,39 @@
+%%
+%% %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(undef_scb).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% Suite Callbacks
+-export([init/1]).
+-export([pre_init_per_suite/3]).
+
+init(Opts) ->
+ gen_event:notify(?CT_EVMGR_REF, #event{ name = scb, node = node(),
+ data = {?MODULE, init, [Opts]}}),
+ {now(), Opts}.
+
+
+pre_init_per_suite(Suite, Config, State) ->
+ lists:flaten([1,2,[3,4]]).