~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/common_test/test/ct_error_SUITE_data/error/test/timetrap_1_SUITE.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%%
 
4
%% Copyright Ericsson AB 2010. All Rights Reserved.
 
5
%%
 
6
%% The contents of this file are subject to the Erlang Public License,
 
7
%% Version 1.1, (the "License"); you may not use this file except in
 
8
%% compliance with the License. You should have received a copy of the
 
9
%% Erlang Public License along with this software. If not, it can be
 
10
%% retrieved online at http://www.erlang.org/.
 
11
%%
 
12
%% Software distributed under the License is distributed on an "AS IS"
 
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
14
%% the License for the specific language governing rights and limitations
 
15
%% under the License.
 
16
%%
 
17
%% %CopyrightEnd%
 
18
%%
 
19
-module(timetrap_1_SUITE).
 
20
 
 
21
-compile(export_all).
 
22
 
 
23
-include_lib("common_test/include/ct.hrl").
 
24
 
 
25
%%--------------------------------------------------------------------
 
26
%% Function: suite() -> Info
 
27
%% Info = [tuple()]
 
28
%%--------------------------------------------------------------------
 
29
suite() ->
 
30
    [{timetrap,{seconds,1}}].
 
31
 
 
32
%%--------------------------------------------------------------------
 
33
%% Function: init_per_suite(Config0) ->
 
34
%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
 
35
%% Config0 = Config1 = [tuple()]
 
36
%% Reason = term()
 
37
%%--------------------------------------------------------------------
 
38
init_per_suite(Config) ->
 
39
    TabPid = spawn(fun() ->
 
40
                           ets:new(?MODULE, [named_table, set, public]),
 
41
                           ets:insert(?MODULE, {last_case,ok}),
 
42
                           receive _ -> ok end
 
43
                   end),
 
44
    [{tab,TabPid} | Config].
 
45
 
 
46
%%--------------------------------------------------------------------
 
47
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
 
48
%% Config0 = Config1 = [tuple()]
 
49
%%--------------------------------------------------------------------
 
50
end_per_suite(Config) ->
 
51
    exit(?config(tab, Config), kill),
 
52
    ok.
 
53
 
 
54
%%--------------------------------------------------------------------
 
55
%% Function: init_per_group(GroupName, Config0) ->
 
56
%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
 
57
%% GroupName = atom()
 
58
%% Config0 = Config1 = [tuple()]
 
59
%% Reason = term()
 
60
%%--------------------------------------------------------------------
 
61
init_per_group(_GroupName, Config) ->
 
62
    Config.
 
63
 
 
64
%%--------------------------------------------------------------------
 
65
%% Function: end_per_group(GroupName, Config0) ->
 
66
%%               void() | {save_config,Config1}
 
67
%% GroupName = atom()
 
68
%% Config0 = Config1 = [tuple()]
 
69
%%--------------------------------------------------------------------
 
70
end_per_group(_GroupName, _Config) ->
 
71
    ok.
 
72
 
 
73
%%--------------------------------------------------------------------
 
74
%% Function: init_per_testcase(TestCase, Config0) ->
 
75
%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
 
76
%% TestCase = atom()
 
77
%% Config0 = Config1 = [tuple()]
 
78
%% Reason = term()
 
79
%%--------------------------------------------------------------------
 
80
init_per_testcase(TC, Config) ->
 
81
    {_,_} = process_info(?config(tab, Config), priority),
 
82
    [{_,ok}] = ets:lookup(?MODULE, last_case),
 
83
    ets:insert(?MODULE, {last_case,fail}),
 
84
    init_per_testcase1(TC, Config).
 
85
 
 
86
init_per_testcase1(tc1, Config) ->
 
87
    [{tc,tc1}|Config];
 
88
 
 
89
init_per_testcase1(tc2, Config) ->
 
90
    [{tc,tc2}|Config];
 
91
 
 
92
init_per_testcase1(tc3, Config) ->
 
93
    [{tc,tc3}|Config];
 
94
 
 
95
init_per_testcase1(tc4, Config) ->
 
96
    [{tc,tc4},{default_timeout,5000}|Config];
 
97
 
 
98
init_per_testcase1(tc5, Config) ->
 
99
    [{tc,tc5}|Config];
 
100
 
 
101
init_per_testcase1(tc6, Config) ->
 
102
    [{tc,tc6}|Config].
 
103
 
 
104
%%--------------------------------------------------------------------
 
105
%% Function: end_per_testcase(TestCase, Config0) ->
 
106
%%               void() | {save_config,Config1}
 
107
%% TestCase = atom()
 
108
%% Config0 = Config1 = [tuple()]
 
109
%%--------------------------------------------------------------------
 
110
end_per_testcase(TC, Config) ->
 
111
    {_,_} = process_info(?config(tab, Config), priority),
 
112
    [{_,fail}] = ets:lookup(?MODULE, last_case),
 
113
    ets:insert(?MODULE, {last_case,ok}),
 
114
    end_per_testcase1(TC, Config).
 
115
 
 
116
end_per_testcase1(tc1, Config) ->
 
117
    ct:pal("end_per_testcase(tc1): ~p", [Config]),
 
118
    tc1 = ?config(tc, Config),
 
119
    {failed,timetrap_timeout} = ?config(tc_status, Config),
 
120
    ok;
 
121
 
 
122
end_per_testcase1(tc2, Config) ->
 
123
    ct:pal("end_per_testcase(tc2): ~p", [Config]),
 
124
    tc2 = ?config(tc, Config),
 
125
    {failed,timetrap_timeout} = ?config(tc_status, Config),
 
126
    timer:sleep(2000);
 
127
 
 
128
end_per_testcase1(tc3, Config) ->
 
129
    ct:pal("end_per_testcase(tc3): ~p", [Config]),
 
130
    tc3 = ?config(tc, Config),
 
131
    {failed,{testcase_aborted,testing_end_conf}} = ?config(tc_status, Config),
 
132
    ok;
 
133
 
 
134
end_per_testcase1(tc4, Config) ->
 
135
    ct:pal("end_per_testcase(tc4): ~p", [Config]),
 
136
    tc4 = ?config(tc, Config),
 
137
    {failed,{testcase_aborted,testing_end_conf}} = ?config(tc_status, Config),
 
138
    timer:sleep(2000);
 
139
 
 
140
end_per_testcase1(tc5, Config) ->
 
141
    ct:pal("end_per_testcase(tc5): ~p", [Config]),
 
142
    tc5 = ?config(tc, Config),
 
143
    exit(end_per_tc_fail_after_timeout);
 
144
 
 
145
end_per_testcase1(tc6, Config) ->
 
146
    ct:pal("end_per_testcase(tc6): ~p", [Config]),
 
147
    tc6 = ?config(tc, Config),
 
148
    exit(end_per_tc_fail_after_abort).
 
149
 
 
150
%%--------------------------------------------------------------------
 
151
%% Function: groups() -> [Group]
 
152
%% Group = {GroupName,Properties,GroupsAndTestCases}
 
153
%% GroupName = atom()
 
154
%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]
 
155
%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]
 
156
%% TestCase = atom()
 
157
%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}
 
158
%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
 
159
%%              repeat_until_any_ok | repeat_until_any_fail
 
160
%% N = integer() | forever
 
161
%%--------------------------------------------------------------------
 
162
groups() ->
 
163
    [].
 
164
 
 
165
%%--------------------------------------------------------------------
 
166
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
 
167
%% GroupsAndTestCases = [{group,GroupName} | TestCase]
 
168
%% GroupName = atom()
 
169
%% TestCase = atom()
 
170
%% Reason = term()
 
171
%%--------------------------------------------------------------------
 
172
all() ->
 
173
    [tc1, tc2, tc3, tc4, tc5, tc6].
 
174
 
 
175
tc1(_) ->
 
176
    timer:sleep(2000).
 
177
 
 
178
tc2(_) ->
 
179
    timer:sleep(2000).
 
180
 
 
181
tc3(_) ->
 
182
    spawn(ct, abort_current_testcase, [testing_end_conf]),
 
183
    timer:sleep(2000).
 
184
 
 
185
tc4(_) ->
 
186
    spawn(ct, abort_current_testcase, [testing_end_conf]),
 
187
    timer:sleep(2000).
 
188
 
 
189
tc5(_) ->
 
190
    timer:sleep(2000).
 
191
 
 
192
tc6(_) ->
 
193
    spawn(ct, abort_current_testcase, [testing_end_conf]),
 
194
    timer:sleep(2000).