aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-02-09 14:01:39 +0100
committerLukas Larsson <[email protected]>2011-02-17 16:59:39 +0100
commitff8d3f0f39b0d1347cd94e1d0d3ab422ad7b06d7 (patch)
tree026e7d50511f663cbfa301b746e80672d51d715e /lib/common_test
parente34cd721545915266a00b1ec55a9a5867c8459a4 (diff)
downloadotp-ff8d3f0f39b0d1347cd94e1d0d3ab422ad7b06d7.tar.gz
otp-ff8d3f0f39b0d1347cd94e1d0d3ab422ad7b06d7.tar.bz2
otp-ff8d3f0f39b0d1347cd94e1d0d3ab422ad7b06d7.zip
Fix bug where the state of an SCB was altered when no on_tc_* existed
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/src/ct_suite_callback.erl4
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE.erl21
-rw-r--r--lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl38
3 files changed, 57 insertions, 6 deletions
diff --git a/lib/common_test/src/ct_suite_callback.erl b/lib/common_test/src/ct_suite_callback.erl
index 947fa0c716..a93b05b1d2 100644
--- a/lib/common_test/src/ct_suite_callback.erl
+++ b/lib/common_test/src/ct_suite_callback.erl
@@ -34,8 +34,6 @@
-type proplist() :: [{atom(),term()}].
-define(config_name, suite_callbacks).
--define(LOCK_STATE_TIMEOUT, 500).
--define(LOCK_NAME, '$ct_suite_callback_lock').
%% -------------------------------------------------------------------------
%% API Functions
@@ -146,7 +144,7 @@ call_terminate({Mod, State}, _, _) ->
call_cleanup({Mod, State}, Reason, [Function | Args]) ->
NewState = catch_apply(Mod,Function, Args ++ [Reason, State],
- {Reason,State}),
+ State),
{Reason, {Mod, NewState}}.
call_generic({Mod, State}, Value, [Function | Args]) ->
diff --git a/lib/common_test/test/ct_suite_callback_SUITE.erl b/lib/common_test/test/ct_suite_callback_SUITE.erl
index 19feacad1d..67f3cf430a 100644
--- a/lib/common_test/test/ct_suite_callback_SUITE.erl
+++ b/lib/common_test/test/ct_suite_callback_SUITE.erl
@@ -81,7 +81,8 @@ all(suite) ->
scope_suite_state_scb,
fail_pre_suite_scb, fail_post_suite_scb, skip_pre_suite_scb,
skip_post_suite_scb, recover_post_suite_scb, update_config_scb,
- state_update_scb, options_scb, same_id_scb
+ state_update_scb, options_scb, same_id_scb,
+ fail_n_skip_with_minimal_scb
]
)
.
@@ -197,7 +198,10 @@ options_scb(Config) when is_list(Config) ->
same_id_scb(Config) when is_list(Config) ->
do_test(same_id_scb, "ct_scb_empty_SUITE.erl",
[same_id_scb,same_id_scb],Config).
-
+
+fail_n_skip_with_minimal_scb(Config) when is_list(Config) ->
+ do_test(fail_n_skip_with_minimal_scb, "ct_scb_fail_one_skip_one_SUITE.erl",
+ [minimal_terminate_scb],Config).
%%%-----------------------------------------------------------------
%%% HELP FUNCTIONS
@@ -963,6 +967,17 @@ test_events(same_id_scb) ->
{?eh,stop_logging,[]}
];
+test_events(fail_n_skip_with_minimal_scb) ->
+ [{?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,scb,{'_',init,['_',[]]}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,tc_start,{'_',init_per_suite}},
+
+ {?eh,tc_done,{'_',end_per_suite,ok}},
+ {?eh,scb,{'_',terminate,[[]]}},
+ {?eh,stop_logging,[]}
+ ];
+
test_events(ok) ->
ok.
@@ -995,7 +1010,7 @@ contains([],_) ->
contains_parallel([Key | T], Elems) ->
contains([Key],Elems),
contains_parallel(T,Elems);
-contains_parallel([],Elems) ->
+contains_parallel([],_Elems) ->
match.
not_contains(List) ->
diff --git a/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl
new file mode 100644
index 0000000000..3f76d2f47d
--- /dev/null
+++ b/lib/common_test/test/ct_suite_callback_SUITE_data/scb/tests/minimal_terminate_scb.erl
@@ -0,0 +1,38 @@
+%%
+%% %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_terminate_scb).
+
+
+-include_lib("common_test/src/ct_util.hrl").
+-include_lib("common_test/include/ct_event.hrl").
+
+
+%% Suite Callbacks
+-export([init/2]).
+-export([terminate/1]).
+
+init(Id, Opts) ->
+ empty_scb:init(Id, Opts).
+
+terminate(State) ->
+ empty_scb:terminate(State).
+
+