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

« back to all changes in this revision

Viewing changes to lib/test_server/test/test_server_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-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
%%% @author Lukas Larsson <lukas@erlang-solutions.com>
 
21
%%% @copyright (C) 2011, Erlang Solutions Ltd.
 
22
%%% @doc
 
23
%%%
 
24
%%% @end
 
25
%%% Created : 15 Feb 2011 by Lukas Larsson <lukas@erlang-solutions.com>
 
26
%%%-------------------------------------------------------------------
 
27
-module(test_server_SUITE).
 
28
 
 
29
%% Note: This directive should only be used in test suites.
 
30
-compile(export_all).
 
31
 
 
32
-include_lib("common_test/include/ct.hrl").
 
33
-include("test_server_test_lib.hrl").
 
34
 
 
35
%%--------------------------------------------------------------------
 
36
%% COMMON TEST CALLBACK FUNCTIONS
 
37
%%--------------------------------------------------------------------
 
38
 
 
39
%% @spec suite() -> Info
 
40
suite() ->
 
41
    [{ct_hooks,[ts_install_cth,test_server_test_lib]}].
 
42
 
 
43
 
 
44
%% @spec init_per_suite(Config0) ->
 
45
%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
 
46
init_per_suite(Config) ->
 
47
    [{path_dirs,[proplists:get_value(data_dir,Config)]} | Config].
 
48
 
 
49
%% @spec end_per_suite(Config) -> _
 
50
end_per_suite(_Config) ->
 
51
    io:format("TEST_SERVER_FRAMEWORK: ~p",[os:getenv("TEST_SERVER_FRAMEWORK")]),
 
52
    ok.
 
53
 
 
54
%% @spec init_per_group(GroupName, Config0) ->
 
55
%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
 
56
init_per_group(_GroupName, Config) ->
 
57
    Config.
 
58
 
 
59
%% @spec end_per_group(GroupName, Config0) ->
 
60
%%               void() | {save_config,Config1}
 
61
end_per_group(_GroupName, _Config) ->
 
62
    ok.
 
63
 
 
64
%% @spec init_per_testcase(TestCase, Config0) ->
 
65
%%               Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
 
66
init_per_testcase(_TestCase, Config) ->
 
67
    Config.
 
68
 
 
69
%% @spec end_per_testcase(TestCase, Config0) ->
 
70
%%               void() | {save_config,Config1} | {fail,Reason}
 
71
end_per_testcase(_TestCase, _Config) ->
 
72
    ok.
 
73
 
 
74
%% @spec: groups() -> [Group]
 
75
groups() ->
 
76
    [].
 
77
 
 
78
%% @spec all() -> GroupsAndTestCases | {skip,Reason}
 
79
all() ->
 
80
    [test_server_SUITE, test_server_parallel01_SUITE,
 
81
     test_server_conf02_SUITE, test_server_conf01_SUITE,
 
82
     test_server_skip_SUITE, test_server_shuffle01_SUITE].
 
83
 
 
84
 
 
85
%%--------------------------------------------------------------------
 
86
%% TEST CASES
 
87
%%--------------------------------------------------------------------
 
88
%% @spec TestCase(Config0) ->
 
89
%%           ok | exit() | {skip,Reason} | {comment,Comment} |
 
90
%%           {save_config,Config1} | {skip_and_save,Reason,Config1}
 
91
test_server_SUITE(Config) ->
 
92
%    rpc:call(Node,dbg, tracer,[]),
 
93
%    rpc:call(Node,dbg, p,[all,c]),
 
94
%    rpc:call(Node,dbg, tpl,[test_server_ctrl,x]),
 
95
    run_test_server_tests("test_server_SUITE", 39, 1, 31, 
 
96
                          20, 9, 1, 11, 2, 26, Config).
 
97
 
 
98
test_server_parallel01_SUITE(Config) ->
 
99
    run_test_server_tests("test_server_parallel01_SUITE", 37, 0, 19, 
 
100
                          19, 0, 0, 0, 0, 37, Config).
 
101
 
 
102
test_server_shuffle01_SUITE(Config) ->
 
103
    run_test_server_tests("test_server_shuffle01_SUITE", 130, 0, 0, 
 
104
                          76, 0, 0, 0, 0, 130, Config).
 
105
 
 
106
test_server_skip_SUITE(Config) ->
 
107
    run_test_server_tests("test_server_skip_SUITE", 3, 0, 1, 
 
108
                          0, 0, 1, 3, 0, 0, Config).
 
109
 
 
110
test_server_conf01_SUITE(Config) ->
 
111
    run_test_server_tests("test_server_conf01_SUITE", 24, 0, 12, 
 
112
                          12, 0, 0, 0, 0, 24, Config).
 
113
 
 
114
test_server_conf02_SUITE(Config) ->
 
115
    run_test_server_tests("test_server_conf02_SUITE", 26, 0, 12, 
 
116
                          12, 0, 0, 0, 0, 26, Config).
 
117
 
 
118
 
 
119
run_test_server_tests(SuiteName, NCases, NFail, NExpected, NSucc, 
 
120
                      NUsrSkip, NAutoSkip, 
 
121
                      NActualSkip, NActualFail, NActualSucc, Config) ->
 
122
    Node = proplists:get_value(node, Config),
 
123
    {ok,_Pid} = rpc:call(Node,test_server_ctrl, start, []),
 
124
    rpc:call(Node,
 
125
             test_server_ctrl,add_dir_with_skip,
 
126
             [SuiteName, 
 
127
              [proplists:get_value(data_dir,Config)],SuiteName,
 
128
              [{test_server_SUITE,skip_case7,"SKIPPED!"}]]),
 
129
 
 
130
    until(fun() ->
 
131
                  rpc:call(Node,test_server_ctrl,jobs,[]) =:= []
 
132
          end),
 
133
    
 
134
    rpc:call(Node,test_server_ctrl, stop, []),
 
135
    {ok,#suite{ n_cases = NCases,
 
136
                n_cases_failed = NFail,
 
137
                n_cases_expected = NExpected, 
 
138
                n_cases_succ = NSucc,
 
139
                n_cases_user_skip = NUsrSkip,
 
140
                n_cases_auto_skip = NAutoSkip,
 
141
                cases = Cases }} = Data =
 
142
        test_server_test_lib:parse_suite(
 
143
          hd(filelib:wildcard(
 
144
               filename:join([proplists:get_value(priv_dir, Config), 
 
145
                              SuiteName++".logs","run*","suite.log"])))),
 
146
    {NActualSkip,NActualFail,NActualSucc} = 
 
147
        lists:foldl(fun(#tc{ result = skip },{S,F,Su}) ->
 
148
                             {S+1,F,Su};
 
149
                         (#tc{ result = ok },{S,F,Su}) ->
 
150
                             {S,F,Su+1};
 
151
                        (#tc{ result = failed },{S,F,Su}) ->
 
152
                             {S,F+1,Su}
 
153
                          end,{0,0,0},Cases),
 
154
    Data.
 
155
 
 
156
until(Fun) ->
 
157
    case Fun() of
 
158
        true ->
 
159
            ok;
 
160
        false ->
 
161
            timer:sleep(100),
 
162
            until(Fun)
 
163
    end.
 
164