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

« back to all changes in this revision

Viewing changes to lib/common_test/test/ct_groups_test_2_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 2009-2011. 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
 
 
20
%%%-------------------------------------------------------------------
 
21
%%% File: ct_groups_test_2_SUITE
 
22
%%%
 
23
%%% Description: 
 
24
%%% Test some simple test case group scenarios.
 
25
%%%
 
26
%%% The suites used for the test are located in the data directory.
 
27
%%%-------------------------------------------------------------------
 
28
-module(ct_groups_test_2_SUITE).
 
29
 
 
30
-compile(export_all).
 
31
 
 
32
-include_lib("common_test/include/ct.hrl").
 
33
-include_lib("common_test/include/ct_event.hrl").
 
34
 
 
35
-define(eh, ct_test_support_eh).
 
36
 
 
37
%%--------------------------------------------------------------------
 
38
%% TEST SERVER CALLBACK FUNCTIONS
 
39
%%--------------------------------------------------------------------
 
40
 
 
41
%%--------------------------------------------------------------------
 
42
%% Description: Since Common Test starts another Test Server
 
43
%% instance, the tests need to be performed on a separate node (or
 
44
%% there will be clashes with logging processes etc).
 
45
%%--------------------------------------------------------------------
 
46
init_per_suite(Config) ->
 
47
    Config1 = ct_test_support:init_per_suite(Config),
 
48
    Config1.
 
49
 
 
50
end_per_suite(Config) ->
 
51
    ct_test_support:end_per_suite(Config).
 
52
 
 
53
init_per_testcase(TestCase, Config) ->
 
54
    ct_test_support:init_per_testcase(TestCase, Config).
 
55
 
 
56
end_per_testcase(TestCase, Config) ->
 
57
    ct_test_support:end_per_testcase(TestCase, Config).
 
58
 
 
59
suite() -> [{ct_hooks,[ts_install_cth]}].
 
60
 
 
61
all() -> 
 
62
    [missing_conf, repeat_1].
 
63
 
 
64
groups() -> 
 
65
    [].
 
66
 
 
67
init_per_group(_GroupName, Config) ->
 
68
    Config.
 
69
 
 
70
end_per_group(_GroupName, Config) ->
 
71
    Config.
 
72
 
 
73
 
 
74
%%--------------------------------------------------------------------
 
75
%% TEST CASES
 
76
%%--------------------------------------------------------------------
 
77
 
 
78
%%%-----------------------------------------------------------------
 
79
%%% 
 
80
 
 
81
missing_conf(Config) when is_list(Config) -> 
 
82
    DataDir = ?config(data_dir, Config),
 
83
 
 
84
    Suite = filename:join(DataDir, "groups_1/missing_conf_SUITE"),
 
85
 
 
86
    {Opts,ERPid} = setup({suite,Suite}, Config),
 
87
    ok = ct_test_support:run(Opts, Config),
 
88
    Events = ct_test_support:get_events(ERPid, Config),
 
89
 
 
90
    ct_test_support:log_events(missing_conf_SUITE, 
 
91
                               reformat(Events, ?eh), 
 
92
                               ?config(priv_dir, Config)),
 
93
 
 
94
    TestEvents = events_to_check(missing_conf),
 
95
    ok = ct_test_support:verify_events(TestEvents, Events, Config).
 
96
 
 
97
%%%-----------------------------------------------------------------
 
98
%%%
 
99
 
 
100
repeat_1(Config) when is_list(Config) ->
 
101
    DataDir = ?config(data_dir, Config),
 
102
 
 
103
    Suite = filename:join(DataDir, "groups_1/repeat_1_SUITE"),
 
104
 
 
105
    {Opts,ERPid} = setup({suite,Suite}, Config),
 
106
    ok = ct_test_support:run(Opts, Config),
 
107
    Events = ct_test_support:get_events(ERPid, Config),
 
108
 
 
109
    ct_test_support:log_events(repeat_1,
 
110
                               reformat(Events, ?eh),
 
111
                               ?config(priv_dir, Config)),
 
112
 
 
113
    TestEvents = events_to_check(repeat_1),
 
114
    ok = ct_test_support:verify_events(TestEvents, Events, Config).
 
115
 
 
116
%%%-----------------------------------------------------------------
 
117
%%% HELP FUNCTIONS
 
118
%%%-----------------------------------------------------------------
 
119
 
 
120
setup(Test, Config) ->
 
121
    Opts0 = ct_test_support:get_opts(Config),
 
122
    Level = ?config(trace_level, Config),
 
123
    EvHArgs = [{cbm,ct_test_support},{trace_level,Level}],
 
124
    Opts = Opts0 ++ [Test,{event_handler,{?eh,EvHArgs}}],
 
125
    ERPid = ct_test_support:start_event_receiver(Config),
 
126
    {Opts,ERPid}.
 
127
 
 
128
reformat(Events, EH) ->
 
129
    ct_test_support:reformat(Events, EH).
 
130
%reformat(Events, _EH) ->
 
131
%    Events.
 
132
 
 
133
%%%-----------------------------------------------------------------
 
134
%%% TEST EVENTS
 
135
%%%-----------------------------------------------------------------
 
136
events_to_check(Test) ->
 
137
    %% 2 tests (ct:run_test + script_start) is default
 
138
    events_to_check(Test, 2).
 
139
 
 
140
events_to_check(_, 0) ->
 
141
    [];
 
142
events_to_check(Test, N) ->
 
143
    test_events(Test) ++ events_to_check(Test, N-1).
 
144
 
 
145
test_events(missing_conf) ->
 
146
    [
 
147
     {?eh,start_logging,{'DEF','RUNDIR'}},
 
148
     {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
 
149
     {?eh,start_info,{1,1,2}},
 
150
     {?eh,tc_start,{ct_framework,ct_init_per_group}},
 
151
     {?eh,tc_done,{ct_framework,ct_init_per_group,ok}},
 
152
     {?eh,test_stats,{1,0,{0,0}}},
 
153
     {?eh,tc_start,{missing_conf_SUITE,tc1}},
 
154
     {?eh,tc_done,{missing_conf_SUITE,tc1,ok}},
 
155
     {?eh,test_stats,{2,0,{0,0}}},
 
156
     {?eh,tc_start,{missing_conf_SUITE,tc2}},
 
157
     {?eh,tc_done,{missing_conf_SUITE,tc2,ok}},
 
158
     {?eh,test_stats,{3,0,{0,0}}},
 
159
     {?eh,tc_start,{ct_framework,ct_end_per_group}},
 
160
     {?eh,tc_done,{ct_framework,ct_end_per_group,ok}},
 
161
     {?eh,test_stats,{4,0,{0,0}}},
 
162
     {?eh,test_done,{'DEF','STOP_TIME'}},
 
163
     {?eh,stop_logging,[]}
 
164
    ];
 
165
 
 
166
test_events(repeat_1) ->
 
167
    [
 
168
     {?eh,start_logging,{'DEF','RUNDIR'}},
 
169
     {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
 
170
     {?eh,start_info,{1,1,unknown}},
 
171
     {?eh,tc_start,{repeat_1_SUITE,init_per_suite}},
 
172
     {?eh,tc_done,{repeat_1_SUITE,init_per_suite,ok}},
 
173
     [{?eh,tc_start,
 
174
       {repeat_1_SUITE,{init_per_group,test_group_1,[{repeat,2}]}}},
 
175
      {?eh,tc_done,
 
176
       {repeat_1_SUITE,{init_per_group,test_group_1,[{repeat,2}]},ok}},
 
177
      {?eh,tc_start,{repeat_1_SUITE,testcase_1a}},
 
178
      {?eh,tc_done,{repeat_1_SUITE,testcase_1a,ok}},
 
179
      {?eh,test_stats,{1,0,{0,0}}},
 
180
      {?eh,tc_start,{repeat_1_SUITE,testcase_1b}},
 
181
      {?eh,tc_done,{repeat_1_SUITE,testcase_1b,ok}},
 
182
      {?eh,test_stats,{2,0,{0,0}}},
 
183
      {?eh,tc_start,
 
184
       {repeat_1_SUITE,{end_per_group,test_group_1,[{repeat,2}]}}},
 
185
      {?eh,tc_done,
 
186
       {repeat_1_SUITE,{end_per_group,test_group_1,[{repeat,2}]},ok}}],
 
187
     [{?eh,tc_start,
 
188
       {repeat_1_SUITE,{init_per_group,test_group_1,[]}}},
 
189
      {?eh,tc_done,
 
190
       {repeat_1_SUITE,{init_per_group,test_group_1,[]},ok}},
 
191
      {?eh,tc_start,{repeat_1_SUITE,testcase_1a}},
 
192
      {?eh,tc_done,{repeat_1_SUITE,testcase_1a,ok}},
 
193
      {?eh,test_stats,{3,0,{0,0}}},
 
194
      {?eh,tc_start,{repeat_1_SUITE,testcase_1b}},
 
195
      {?eh,tc_done,{repeat_1_SUITE,testcase_1b,ok}},
 
196
      {?eh,test_stats,{4,0,{0,0}}},
 
197
      {?eh,tc_start,
 
198
       {repeat_1_SUITE,{end_per_group,test_group_1,[]}}},
 
199
      {?eh,tc_done,
 
200
       {repeat_1_SUITE,{end_per_group,test_group_1,[]},ok}}],
 
201
     [{?eh,tc_start,
 
202
       {repeat_1_SUITE,{init_per_group,test_group_2,[]}}},
 
203
      {?eh,tc_done,
 
204
       {repeat_1_SUITE,{init_per_group,test_group_2,[]},ok}},
 
205
      {?eh,tc_start,{repeat_1_SUITE,testcase_2a}},
 
206
      {?eh,tc_done,{repeat_1_SUITE,testcase_2a,ok}},
 
207
      {?eh,test_stats,{5,0,{0,0}}},
 
208
      {?eh,tc_start,{repeat_1_SUITE,testcase_2b}},
 
209
      {?eh,tc_done,{repeat_1_SUITE,testcase_2b,ok}},
 
210
      {?eh,test_stats,{6,0,{0,0}}},
 
211
      {?eh,tc_start,
 
212
       {repeat_1_SUITE,{end_per_group,test_group_2,[]}}},
 
213
      {?eh,tc_done,
 
214
       {repeat_1_SUITE,{end_per_group,test_group_2,[]},ok}}],
 
215
     [{?eh,tc_start,
 
216
       {repeat_1_SUITE,
 
217
        {init_per_group,test_group_3,[]}}},
 
218
      {?eh,tc_done,
 
219
       {repeat_1_SUITE,
 
220
        {init_per_group,test_group_3,[]},
 
221
        ok}},
 
222
      {?eh,tc_start,{repeat_1_SUITE,testcase_3a}},
 
223
      {?eh,tc_done,{repeat_1_SUITE,testcase_3a,ok}},
 
224
      {?eh,test_stats,{7,0,{0,0}}},
 
225
      [{?eh,tc_start,
 
226
        {repeat_1_SUITE,
 
227
         {init_per_group,test_group_4,[]}}},
 
228
       {?eh,tc_done,
 
229
        {repeat_1_SUITE,
 
230
         {init_per_group,test_group_4,[]},
 
231
         ok}},
 
232
       {?eh,tc_start,{repeat_1_SUITE,testcase_4a}},
 
233
       {?eh,tc_done,{repeat_1_SUITE,testcase_4a,ok}},
 
234
       {?eh,test_stats,{8,0,{0,0}}},
 
235
       {?eh,tc_start,{repeat_1_SUITE,testcase_4b}},
 
236
       {?eh,tc_done,{repeat_1_SUITE,testcase_4b,ok}},
 
237
       {?eh,test_stats,{9,0,{0,0}}},
 
238
       {?eh,tc_start,
 
239
        {repeat_1_SUITE,
 
240
         {end_per_group,test_group_4,[]}}},
 
241
       {?eh,tc_done,
 
242
        {repeat_1_SUITE,
 
243
         {end_per_group,test_group_4,[]},
 
244
         ok}}],
 
245
      {?eh,tc_start,{repeat_1_SUITE,testcase_3b}},
 
246
      {?eh,tc_done,{repeat_1_SUITE,testcase_3b,ok}},
 
247
      {?eh,test_stats,{10,0,{0,0}}},
 
248
      {?eh,tc_start,
 
249
       {repeat_1_SUITE,
 
250
        {end_per_group,test_group_3,[]}}},
 
251
      {?eh,tc_done,
 
252
       {repeat_1_SUITE,
 
253
        {end_per_group,test_group_3,[]},
 
254
        ok}}],
 
255
     {?eh,tc_start,{repeat_1_SUITE,end_per_suite}},
 
256
     {?eh,tc_done,{repeat_1_SUITE,end_per_suite,ok}},
 
257
     {?eh,test_done,{'DEF','STOP_TIME'}},
 
258
     {?eh,stop_logging,[]}
 
259
    ].