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

« back to all changes in this revision

Viewing changes to lib/common_test/test/ct_event_handler_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 2008-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_event_handler_SUITE.erl
 
22
%%%
 
23
%%% Description: This suite will install event handlers and run
 
24
%%% some simple tests to check that events are generated according
 
25
%%% to the specification (see Event Handling in CT User's Guide).
 
26
%%%-------------------------------------------------------------------
 
27
-module(ct_event_handler_SUITE).
 
28
 
 
29
-compile(export_all).
 
30
 
 
31
-include_lib("common_test/include/ct.hrl").
 
32
 
 
33
%-include_lib("common_test/include/ct_event.hrl").
 
34
 
 
35
%%--------------------------------------------------------------------
 
36
%% TEST SERVER CALLBACK FUNCTIONS
 
37
%%--------------------------------------------------------------------
 
38
 
 
39
init_per_suite(Config) ->
 
40
    DataDir = ?config(data_dir, Config),
 
41
    PrivDir = ?config(priv_dir, Config),
 
42
 
 
43
    EH = filename:join(DataDir, "eh_A.erl"),
 
44
    CResult = compile:file(EH, [verbose,report,{outdir,PrivDir}]),
 
45
    test_server:format("~s compilation result: ~p~n", [EH,CResult]),
 
46
 
 
47
    Config1 = ct_test_support:init_per_suite(Config, 0),
 
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
    [start_stop, results].
 
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
%%--------------------------------------------------------------------
 
76
%% TEST CASES
 
77
%%--------------------------------------------------------------------
 
78
 
 
79
start_stop(doc) -> 
 
80
    [];
 
81
 
 
82
start_stop(suite) -> 
 
83
    [];
 
84
 
 
85
start_stop(Config) when is_list(Config) -> 
 
86
    DataDir = ?config(data_dir, Config),
 
87
 
 
88
    TestObj = filename:join(DataDir, "event_handling_1"),
 
89
    Suite1 = filename:join(TestObj, "test/eh_11_SUITE"),
 
90
    Opts0 = ct_test_support:get_opts(Config),
 
91
 
 
92
    Level = ?config(trace_level, Config),
 
93
    EvHArgs = [{cbm,ct_test_support},{trace_level,Level}],
 
94
 
 
95
    Opts = Opts0 ++ [{suite,Suite1},{testcase,tc1},
 
96
                     {event_handler,{eh_A,EvHArgs}}],
 
97
 
 
98
    ERPid = ct_test_support:start_event_receiver(Config),
 
99
 
 
100
    ok = ct_test_support:run(Opts, Config),
 
101
    
 
102
    Events = ct_test_support:get_events(ERPid, Config),    
 
103
 
 
104
    ct_test_support:log_events(start_stop, 
 
105
                               ct_test_support:reformat(Events, eh_A), 
 
106
                               ?config(priv_dir, Config)),
 
107
    
 
108
    TestEvents =
 
109
        [{eh_A,start_logging,{'DEF','RUNDIR'}},
 
110
         {eh_A,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
 
111
         {eh_A,start_info,{1,1,1}},
 
112
         {eh_A,tc_start,{eh_11_SUITE,init_per_suite}},
 
113
         {eh_A,tc_done,{eh_11_SUITE,init_per_suite,ok}},
 
114
         {eh_A,tc_start,{eh_11_SUITE,tc1}},
 
115
         {eh_A,tc_done,{eh_11_SUITE,tc1,ok}},
 
116
         {eh_A,test_stats,{1,0,{0,0}}},
 
117
         {eh_A,tc_start,{eh_11_SUITE,end_per_suite}},
 
118
         {eh_A,tc_done,{eh_11_SUITE,end_per_suite,ok}},
 
119
         {eh_A,test_done,{'DEF','STOP_TIME'}},
 
120
         {eh_A,stop_logging,[]}],
 
121
 
 
122
    ok = ct_test_support:verify_events(TestEvents++TestEvents, Events, Config).
 
123
 
 
124
 
 
125
results(doc) -> 
 
126
    [];
 
127
 
 
128
results(suite) -> 
 
129
    [];
 
130
 
 
131
results(Config) when is_list(Config) -> 
 
132
    DataDir = ?config(data_dir, Config),
 
133
 
 
134
    TestObj = filename:join(DataDir, "event_handling_1"),
 
135
    Suite1 = filename:join(TestObj, "test/eh_11_SUITE"),
 
136
    Opts0 = ct_test_support:get_opts(Config),
 
137
 
 
138
    Level = ?config(trace_level, Config),
 
139
    EvHArgs = [{cbm,ct_test_support},{trace_level,Level}],
 
140
 
 
141
    Opts = Opts0 ++ [{suite,Suite1},
 
142
                     {event_handler,{eh_A,EvHArgs}}],
 
143
 
 
144
    ERPid = ct_test_support:start_event_receiver(Config),
 
145
 
 
146
    ok = ct_test_support:run(Opts, Config),
 
147
    
 
148
    Events = ct_test_support:get_events(ERPid, Config),
 
149
    
 
150
    ct_test_support:log_events(results, 
 
151
                               ct_test_support:reformat(Events, eh_A), 
 
152
                               ?config(priv_dir, Config)),
 
153
 
 
154
    TestEvents =
 
155
        [{eh_A,start_logging,{'DEF','RUNDIR'}},
 
156
         {eh_A,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
 
157
         {eh_A,start_info,{1,1,3}},
 
158
         {eh_A,tc_start,{eh_11_SUITE,init_per_suite}},
 
159
         {eh_A,tc_done,{eh_11_SUITE,init_per_suite,ok}},
 
160
         {eh_A,tc_start,{eh_11_SUITE,tc1}},
 
161
         {eh_A,tc_done,{eh_11_SUITE,tc1,ok}},
 
162
         {eh_A,test_stats,{1,0,{0,0}}},
 
163
         {eh_A,tc_start,{eh_11_SUITE,tc2}},
 
164
         {eh_A,tc_done,{eh_11_SUITE,tc2,{skipped,"Skipped"}}},
 
165
         {eh_A,test_stats,{1,0,{1,0}}},
 
166
         {eh_A,tc_start,{eh_11_SUITE,tc3}},
 
167
         {eh_A,tc_done,{eh_11_SUITE,tc3,{failed,{error,'Failing'}}}},
 
168
         {eh_A,test_stats,{1,1,{1,0}}},
 
169
         {eh_A,tc_start,{eh_11_SUITE,end_per_suite}},
 
170
         {eh_A,tc_done,{eh_11_SUITE,end_per_suite,ok}},
 
171
         {eh_A,test_done,{'DEF','STOP_TIME'}},
 
172
         {eh_A,stop_logging,[]}],
 
173
 
 
174
    ok = ct_test_support:verify_events(TestEvents++TestEvents, Events, Config).
 
175
 
 
176
 
 
177
%%%-----------------------------------------------------------------
 
178
%%% HELP FUNCTIONS