~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/test_server/test/test_server_shuffle01_SUITE.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%%
 
4
%% Copyright Ericsson AB 2009-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
 
 
20
%%%------------------------------------------------------------------
 
21
%%% Test Server self test. 
 
22
%%%------------------------------------------------------------------
 
23
-module(test_server_shuffle01_SUITE).
 
24
-include_lib("test_server/include/test_server.hrl").
 
25
 
 
26
-compile(export_all).
 
27
 
 
28
all(doc) -> ["Test simple conf case structure, with and without nested cases"];
 
29
all(suite) -> 
 
30
    [
 
31
     {conf, [shuffle], conf1_init, [conf1_tc1, conf1_tc2, conf1_tc3], conf1_end},
 
32
 
 
33
     {conf, [{shuffle,{1,2,3}}], conf2_init, [conf2_tc1, conf2_tc2, conf2_tc3], conf2_end},
 
34
 
 
35
     {conf, [shuffle], conf3_init, [conf3_tc1, conf3_tc2, conf3_tc3,
 
36
                                    
 
37
                                    {conf, [], conf4_init, 
 
38
                                     [conf4_tc1, conf4_tc2], conf4_end}], 
 
39
                       conf3_end},
 
40
 
 
41
     conf5,
 
42
 
 
43
     {conf, [shuffle,{repeat,5},parallel], conf7_init, [conf7_tc1, 
 
44
                                    
 
45
                                    {conf, [{shuffle,{3,2,1}},{repeat,3}], 
 
46
                                     conf8_init, [conf8_tc1, conf8_tc2, conf8_tc3], 
 
47
                                     conf8_end},
 
48
                                    
 
49
                                    conf7_tc2, conf7_tc3], conf7_end}
 
50
     
 
51
    ].
 
52
 
 
53
 
 
54
%%---------- conf cases ----------
 
55
 
 
56
init_per_suite(Config) ->
 
57
    case ?config(data_dir,Config) of
 
58
        undefined -> exit(no_data_dir);
 
59
        _ -> ok
 
60
    end,    
 
61
    [{suite,init}|Config].
 
62
end_per_suite(Config) ->
 
63
    case ?config(data_dir,Config) of
 
64
        undefined -> exit(no_data_dir);
 
65
        _ -> ok
 
66
    end,    
 
67
    init = ?config(suite,Config),
 
68
    ok.
 
69
 
 
70
init_per_testcase(TC=conf1_tc1, Config) ->
 
71
    init = ?config(suite,Config),
 
72
    [{tc11,TC}|Config];
 
73
init_per_testcase(TC=conf1_tc2, Config) ->
 
74
    [{tc12,TC}|Config];
 
75
init_per_testcase(TC=conf1_tc3, Config) ->
 
76
    [{tc13,TC}|Config];
 
77
init_per_testcase(TC=conf2_tc1, Config) ->
 
78
    [{tc21,TC}|Config];
 
79
init_per_testcase(TC=conf2_tc2, Config) ->
 
80
    [{tc22,TC}|Config];
 
81
init_per_testcase(TC=conf2_tc3, Config) ->
 
82
    [{tc23,TC}|Config];
 
83
init_per_testcase(TC=conf3_tc1, Config) ->
 
84
    [{tc31,TC}|Config];
 
85
init_per_testcase(TC=conf3_tc2, Config) ->
 
86
    [{tc32,TC}|Config];
 
87
init_per_testcase(TC=conf3_tc3, Config) ->
 
88
    [{tc33,TC}|Config];
 
89
init_per_testcase(TC=conf4_tc1, Config) ->
 
90
    [{tc41,TC}|Config];
 
91
init_per_testcase(TC=conf4_tc2, Config) ->
 
92
    [{tc42,TC}|Config];
 
93
init_per_testcase(TC=conf5_tc1, Config) ->
 
94
    [{tc51,TC}|Config];
 
95
init_per_testcase(TC=conf5_tc2, Config) ->
 
96
    [{tc52,TC}|Config];
 
97
init_per_testcase(TC=conf6_tc1, Config) ->
 
98
    [{tc61,TC}|Config];
 
99
init_per_testcase(TC=conf6_tc2, Config) ->
 
100
    init = ?config(suite,Config),
 
101
    [{tc62,TC}|Config];
 
102
init_per_testcase(TC=conf6_tc3, Config) ->
 
103
    [{tc63,TC}|Config];
 
104
init_per_testcase(TC=conf7_tc1, Config) ->
 
105
    [{tc71,TC}|Config];
 
106
init_per_testcase(TC=conf7_tc2, Config) ->
 
107
    [{tc72,TC}|Config];
 
108
init_per_testcase(TC=conf7_tc3, Config) ->
 
109
    [{tc73,TC}|Config];
 
110
init_per_testcase(TC=conf8_tc1, Config) ->
 
111
    [{tc81,TC}|Config];
 
112
init_per_testcase(TC=conf8_tc2, Config) ->
 
113
    init = ?config(suite,Config),
 
114
    [{tc82,TC}|Config];
 
115
init_per_testcase(TC=conf8_tc3, Config) ->
 
116
    [{tc83,TC}|Config].
 
117
 
 
118
end_per_testcase(TC=conf1_tc1, Config) ->
 
119
    init = ?config(suite,Config),
 
120
    TC = ?config(tc11,Config),
 
121
    ok;
 
122
end_per_testcase(TC=conf1_tc2, Config) ->
 
123
    TC = ?config(tc12,Config),
 
124
    ok;
 
125
end_per_testcase(TC=conf1_tc3, Config) ->
 
126
    TC = ?config(tc13,Config),
 
127
    ok;
 
128
end_per_testcase(TC=conf2_tc1, Config) ->
 
129
    TC = ?config(tc21,Config),
 
130
    ok;
 
131
end_per_testcase(TC=conf2_tc2, Config) ->
 
132
    TC = ?config(tc22,Config),
 
133
    ok;
 
134
end_per_testcase(TC=conf2_tc3, Config) ->
 
135
    TC = ?config(tc23,Config),
 
136
    ok;
 
137
end_per_testcase(TC=conf3_tc1, Config) ->
 
138
    TC = ?config(tc31,Config),
 
139
    ok;
 
140
end_per_testcase(TC=conf3_tc2, Config) ->
 
141
    TC = ?config(tc32,Config),
 
142
    ok;
 
143
end_per_testcase(TC=conf3_tc3, Config) ->
 
144
    TC = ?config(tc33,Config),
 
145
    ok;
 
146
end_per_testcase(TC=conf4_tc1, Config) ->
 
147
    TC = ?config(tc41,Config),
 
148
    ok;
 
149
end_per_testcase(TC=conf4_tc2, Config) ->
 
150
    TC = ?config(tc42,Config),
 
151
    ok;
 
152
end_per_testcase(TC=conf5_tc1, Config) ->
 
153
    TC = ?config(tc51,Config),
 
154
    ok;
 
155
end_per_testcase(TC=conf5_tc2, Config) ->
 
156
    TC = ?config(tc52,Config),
 
157
    ok;
 
158
end_per_testcase(TC=conf6_tc1, Config) ->
 
159
    TC = ?config(tc61,Config),
 
160
    ok;
 
161
end_per_testcase(TC=conf6_tc2, Config) ->
 
162
    init = ?config(suite,Config),
 
163
    TC = ?config(tc62,Config),
 
164
    ok;
 
165
end_per_testcase(TC=conf6_tc3, Config) ->
 
166
    TC = ?config(tc63,Config),
 
167
    ok;
 
168
end_per_testcase(TC=conf7_tc1, Config) ->
 
169
    TC = ?config(tc71,Config),
 
170
    ok;
 
171
end_per_testcase(TC=conf7_tc2, Config) ->
 
172
    TC = ?config(tc72,Config),
 
173
    ok;
 
174
end_per_testcase(TC=conf7_tc3, Config) ->
 
175
    TC = ?config(tc73,Config),
 
176
    ok;
 
177
end_per_testcase(TC=conf8_tc1, Config) ->
 
178
    TC = ?config(tc81,Config),
 
179
    ok;
 
180
end_per_testcase(TC=conf8_tc2, Config) ->
 
181
    init = ?config(suite,Config),
 
182
    TC = ?config(tc82,Config),
 
183
    ok;
 
184
end_per_testcase(TC=conf8_tc3, Config) ->
 
185
    TC = ?config(tc83,Config),
 
186
    ok.
 
187
 
 
188
 
 
189
conf1_init(Config) when is_list(Config) ->
 
190
    init = ?config(suite,Config),
 
191
    [{shuffle,{_,_,_}}] = ?config(tc_group_properties,Config),
 
192
    test_server:comment("Shuffle (random seed)"),
 
193
    [{cc1,conf1}|Config].
 
194
conf1_end(_Config) ->
 
195
    ok.
 
196
 
 
197
conf2_init(Config) when is_list(Config) ->
 
198
    [{shuffle,{1,2,3}}] = ?config(tc_group_properties,Config),
 
199
    test_server:comment("Shuffle (user seed)"),
 
200
    [{cc2,conf2}|Config].
 
201
conf2_end(_Config) ->
 
202
    ok.
 
203
 
 
204
conf3_init(Config) when is_list(Config) ->
 
205
    [{shuffle,{_,_,_}}] = ?config(tc_group_properties,Config),
 
206
    test_server:comment("Shuffle (random)"),
 
207
    [{cc3,conf3}|Config].
 
208
conf3_end(_Config) ->
 
209
    ok.
 
210
 
 
211
conf4_init(Config) when is_list(Config) ->
 
212
    [] = ?config(tc_group_properties,Config),
 
213
    test_server:comment("No shuffle"),
 
214
    [{cc4,conf4}|Config].
 
215
conf4_end(_Config) ->
 
216
    ok.
 
217
 
 
218
conf5_init(Config) when is_list(Config) ->
 
219
    [] = ?config(tc_group_properties,Config),
 
220
    test_server:comment("No shuffle"),
 
221
    [{cc5,conf5}|Config].
 
222
conf5_end(_Config) ->
 
223
    ok.
 
224
 
 
225
conf6_init(Config) when is_list(Config) ->
 
226
    [{shuffle,{_,_,_}}] = ?config(tc_group_properties,Config),
 
227
    test_server:comment("Shuffle (random)"),
 
228
    init = ?config(suite,Config),
 
229
    [{cc6,conf6}|Config].
 
230
conf6_end(_Config) ->
 
231
    ok.
 
232
 
 
233
conf5(suite) ->                                 % test specification
 
234
    [{conf, conf5_init, [conf5_tc1, 
 
235
 
 
236
                         {conf, [shuffle], conf6_init, 
 
237
                          [conf6_tc1, conf6_tc2, conf6_tc3], 
 
238
                          conf6_end},
 
239
 
 
240
                         conf5_tc2], conf5_end}].
 
241
 
 
242
conf7_init(Config) when is_list(Config) ->
 
243
    test_server:comment("Group 7, Shuffle (random seed)"),
 
244
    case proplists:get_value(shuffle,?config(tc_group_properties,Config)) of
 
245
        {_,_,_} -> ok
 
246
    end,
 
247
    [{cc7,conf7}|Config].
 
248
conf7_end(_Config) ->
 
249
    ok.
 
250
 
 
251
conf8_init(Config) when is_list(Config) ->
 
252
    test_server:comment("Group 8, Shuffle (user start seed)"),
 
253
    case proplists:get_value(shuffle,?config(tc_group_properties,Config)) of
 
254
        {_,_,_} -> ok
 
255
    end,
 
256
    init = ?config(suite,Config),
 
257
    [{cc8,conf8}|Config].
 
258
conf8_end(_Config) ->
 
259
    ok.
 
260
 
 
261
 
 
262
%%---------- test cases ----------
 
263
 
 
264
conf1_tc1(Config) when is_list(Config) ->
 
265
    test_server:comment("Case 1"),
 
266
    case ?config(data_dir,Config) of
 
267
        undefined -> exit(no_data_dir);
 
268
        _ -> ok
 
269
    end,    
 
270
    init = ?config(suite,Config),
 
271
    conf1 = ?config(cc1,Config),
 
272
    conf1_tc1 = ?config(tc11,Config),
 
273
    ok.
 
274
conf1_tc2(Config) when is_list(Config) ->
 
275
    test_server:comment("Case 2"),
 
276
    case ?config(priv_dir,Config) of
 
277
        undefined -> exit(no_priv_dir);
 
278
        _ -> ok
 
279
    end,    
 
280
    init = ?config(suite,Config),
 
281
    conf1 = ?config(cc1,Config),
 
282
    conf1_tc2 = ?config(tc12,Config),
 
283
    ok.
 
284
conf1_tc3(suite) -> [];
 
285
conf1_tc3(_Config) ->
 
286
    test_server:comment("Case 3"),
 
287
    ok.
 
288
    
 
289
conf2_tc1(Config) when is_list(Config) ->
 
290
    test_server:comment("Case 1"),
 
291
    init = ?config(suite,Config),
 
292
    undefined = ?config(cc1,Config),
 
293
    conf2 = ?config(cc2,Config),
 
294
    conf2_tc1 = ?config(tc21,Config),
 
295
    ok.
 
296
conf2_tc2(Config) when is_list(Config) ->
 
297
    test_server:comment("Case 2"),
 
298
    init = ?config(suite,Config),
 
299
    conf2 = ?config(cc2,Config),
 
300
    conf2_tc2 = ?config(tc22,Config),
 
301
    ok.
 
302
conf2_tc3(suite) -> [];
 
303
conf2_tc3(_Config) ->    
 
304
    test_server:comment("Case 3"),
 
305
    ok.
 
306
 
 
307
conf3_tc1(Config) when is_list(Config) ->
 
308
    test_server:comment("Case 1"),
 
309
    init = ?config(suite,Config),
 
310
    undefined = ?config(cc2,Config),
 
311
    conf3 = ?config(cc3,Config),
 
312
    conf3_tc1 = ?config(tc31,Config),
 
313
    ok.
 
314
conf3_tc2(Config) when is_list(Config) ->
 
315
    test_server:comment("Case 2"),
 
316
    init = ?config(suite,Config),
 
317
    conf3 = ?config(cc3,Config),
 
318
    undefined = ?config(cc4,Config),
 
319
    conf3_tc2 = ?config(tc32,Config),
 
320
    ok.
 
321
conf3_tc3(suite) -> [];
 
322
conf3_tc3(_Config) ->
 
323
    test_server:comment("Case 3"),
 
324
    ok.
 
325
 
 
326
conf4_tc1(Config) when is_list(Config) ->
 
327
    test_server:comment("Case 1"),
 
328
    init = ?config(suite,Config),
 
329
    case ?config(data_dir,Config) of
 
330
        undefined -> exit(no_data_dir);
 
331
        _ -> ok
 
332
    end,    
 
333
    undefined = ?config(cc1,Config),
 
334
    undefined = ?config(cc2,Config),
 
335
    conf3 = ?config(cc3,Config),
 
336
    conf4 = ?config(cc4,Config),
 
337
    conf4_tc1 = ?config(tc41,Config),
 
338
    ok.
 
339
conf4_tc2(Config) when is_list(Config) ->
 
340
    test_server:comment("Case 2"),
 
341
    init = ?config(suite,Config),
 
342
    case ?config(priv_dir,Config) of
 
343
        undefined -> exit(no_priv_dir);
 
344
        _ -> ok
 
345
    end,    
 
346
    conf3 = ?config(cc3,Config),
 
347
    conf4 = ?config(cc4,Config),
 
348
    conf4_tc2 = ?config(tc42,Config),
 
349
    ok.
 
350
 
 
351
conf5_tc1(Config) when is_list(Config) ->
 
352
    test_server:comment("Case 1"),
 
353
    init = ?config(suite,Config),
 
354
    case ?config(data_dir,Config) of
 
355
        undefined -> exit(no_data_dir);
 
356
        _ -> ok
 
357
    end,    
 
358
    undefined = ?config(cc1,Config),
 
359
    undefined = ?config(cc2,Config),
 
360
    undefined = ?config(cc3,Config),
 
361
    undefined = ?config(cc4,Config),
 
362
    conf5 = ?config(cc5,Config),
 
363
    conf5_tc1 = ?config(tc51,Config),
 
364
    ok.
 
365
conf5_tc2(Config) when is_list(Config) ->
 
366
    test_server:comment("Case 2"),
 
367
    init = ?config(suite,Config),
 
368
    case ?config(priv_dir,Config) of
 
369
        undefined -> exit(no_priv_dir);
 
370
        _ -> ok
 
371
    end,    
 
372
    conf5 = ?config(cc5,Config),
 
373
    undefined = ?config(cc6,Config),
 
374
    conf5_tc2 = ?config(tc52,Config),
 
375
    ok.
 
376
 
 
377
conf6_tc1(Config) when is_list(Config) ->
 
378
    test_server:comment("Case 1"),
 
379
    init = ?config(suite,Config),
 
380
    case ?config(data_dir,Config) of
 
381
        undefined -> exit(no_data_dir);
 
382
        _ -> ok
 
383
    end,    
 
384
    undefined = ?config(cc1,Config),
 
385
    undefined = ?config(cc2,Config),
 
386
    undefined = ?config(cc3,Config),
 
387
    undefined = ?config(cc4,Config),
 
388
    conf5 = ?config(cc5,Config),
 
389
    conf6 = ?config(cc6,Config),
 
390
    conf6_tc1 = ?config(tc61,Config),
 
391
    ok.
 
392
conf6_tc2(Config) when is_list(Config) ->
 
393
    test_server:comment("Case 2"),
 
394
    init = ?config(suite,Config),
 
395
    case ?config(priv_dir,Config) of
 
396
        undefined -> exit(no_priv_dir);
 
397
        _ -> ok
 
398
    end,    
 
399
    conf5 = ?config(cc5,Config),
 
400
    conf6 = ?config(cc6,Config),
 
401
    conf6_tc2 = ?config(tc62,Config),
 
402
    ok.
 
403
conf6_tc3(suite) -> [];
 
404
conf6_tc3(_Config) ->
 
405
    test_server:comment("Case 3"),
 
406
    ok.
 
407
 
 
408
conf7_tc1(Config) when is_list(Config) ->
 
409
    test_server:comment("Case 1"),
 
410
    init = ?config(suite,Config),
 
411
    case ?config(data_dir,Config) of
 
412
        undefined -> exit(no_data_dir);
 
413
        _ -> ok
 
414
    end,    
 
415
    undefined = ?config(cc1,Config),
 
416
    undefined = ?config(cc2,Config),
 
417
    undefined = ?config(cc3,Config),
 
418
    undefined = ?config(cc4,Config),
 
419
    undefined = ?config(cc5,Config),
 
420
    undefined = ?config(cc6,Config),
 
421
    conf7 = ?config(cc7,Config),
 
422
    conf7_tc1 = ?config(tc71,Config),
 
423
    ok.
 
424
conf7_tc2(Config) when is_list(Config) ->
 
425
    test_server:comment("Case 2"),
 
426
    init = ?config(suite,Config),
 
427
    case ?config(priv_dir,Config) of
 
428
        undefined -> exit(no_priv_dir);
 
429
        _ -> ok
 
430
    end,    
 
431
    conf7 = ?config(cc7,Config),
 
432
    undefined = ?config(cc8,Config),
 
433
    conf7_tc2 = ?config(tc72,Config),
 
434
    ok.
 
435
conf7_tc3(suite) -> [];
 
436
conf7_tc3(_Config) ->
 
437
    test_server:comment("Case 3"),
 
438
    ok.
 
439
 
 
440
conf8_tc1(Config) when is_list(Config) ->
 
441
    test_server:comment("Case 1"),
 
442
    init = ?config(suite,Config),
 
443
    case ?config(data_dir,Config) of
 
444
        undefined -> exit(no_data_dir);
 
445
        _ -> ok
 
446
    end,    
 
447
    undefined = ?config(cc1,Config),
 
448
    undefined = ?config(cc2,Config),
 
449
    undefined = ?config(cc3,Config),
 
450
    undefined = ?config(cc4,Config),
 
451
    undefined = ?config(cc5,Config),
 
452
    undefined = ?config(cc6,Config),
 
453
    conf7 = ?config(cc7,Config),
 
454
    conf8 = ?config(cc8,Config),
 
455
    conf8_tc1 = ?config(tc81,Config),
 
456
    ok.
 
457
conf8_tc2(Config) when is_list(Config) ->
 
458
    test_server:comment("Case 2"),
 
459
    init = ?config(suite,Config),
 
460
    case ?config(priv_dir,Config) of
 
461
        undefined -> exit(no_priv_dir);
 
462
        _ -> ok
 
463
    end,    
 
464
    conf7 = ?config(cc7,Config),
 
465
    conf8 = ?config(cc8,Config),
 
466
    conf8_tc2 = ?config(tc82,Config),
 
467
    ok.
 
468
conf8_tc3(suite) -> [];
 
469
conf8_tc3(_Config) ->
 
470
    test_server:comment("Case 3"),
 
471
    ok.