4
%% Copyright Ericsson AB 2010-2011. All Rights Reserved.
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/.
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
19
%%%-------------------------------------------------------------------
20
%%% @author Lukas Larsson <lukas@erlang-solutions.com>
21
%%% @copyright (C) 2011, Erlang Solutions Ltd.
25
%%% Created : 15 Feb 2011 by Lukas Larsson <lukas@erlang-solutions.com>
26
%%%-------------------------------------------------------------------
27
-module(test_server_SUITE).
29
%% Note: This directive should only be used in test suites.
32
-include_lib("common_test/include/ct.hrl").
33
-include("test_server_test_lib.hrl").
35
%%--------------------------------------------------------------------
36
%% COMMON TEST CALLBACK FUNCTIONS
37
%%--------------------------------------------------------------------
39
%% @spec suite() -> Info
41
[{ct_hooks,[ts_install_cth,test_server_test_lib]}].
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].
49
%% @spec end_per_suite(Config) -> _
50
end_per_suite(_Config) ->
51
io:format("TEST_SERVER_FRAMEWORK: ~p",[os:getenv("TEST_SERVER_FRAMEWORK")]),
54
%% @spec init_per_group(GroupName, Config0) ->
55
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
56
init_per_group(_GroupName, Config) ->
59
%% @spec end_per_group(GroupName, Config0) ->
60
%% void() | {save_config,Config1}
61
end_per_group(_GroupName, _Config) ->
64
%% @spec init_per_testcase(TestCase, Config0) ->
65
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
66
init_per_testcase(_TestCase, Config) ->
69
%% @spec end_per_testcase(TestCase, Config0) ->
70
%% void() | {save_config,Config1} | {fail,Reason}
71
end_per_testcase(_TestCase, _Config) ->
74
%% @spec: groups() -> [Group]
78
%% @spec all() -> GroupsAndTestCases | {skip,Reason}
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].
85
%%--------------------------------------------------------------------
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).
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).
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).
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).
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).
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).
119
run_test_server_tests(SuiteName, NCases, NFail, NExpected, NSucc,
121
NActualSkip, NActualFail, NActualSucc, Config) ->
122
Node = proplists:get_value(node, Config),
123
{ok,_Pid} = rpc:call(Node,test_server_ctrl, start, []),
125
test_server_ctrl,add_dir_with_skip,
127
[proplists:get_value(data_dir,Config)],SuiteName,
128
[{test_server_SUITE,skip_case7,"SKIPPED!"}]]),
131
rpc:call(Node,test_server_ctrl,jobs,[]) =:= []
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(
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}) ->
149
(#tc{ result = ok },{S,F,Su}) ->
151
(#tc{ result = failed },{S,F,Su}) ->