aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/test
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2014-01-27 14:05:44 +0100
committerPeter Andersson <[email protected]>2014-01-28 19:04:05 +0100
commit95a574b3620ec3d7420c7807b2d84f4602512229 (patch)
treebe7cfa305637082799461fe751cc28456e7c1f91 /lib/common_test/test
parentf40f4686848bbabb9357b33d08d4b4039d9d7c63 (diff)
downloadotp-95a574b3620ec3d7420c7807b2d84f4602512229.tar.gz
otp-95a574b3620ec3d7420c7807b2d84f4602512229.tar.bz2
otp-95a574b3620ec3d7420c7807b2d84f4602512229.zip
Make it possible to use raw telnet logs in parallel test case groups
Diffstat (limited to 'lib/common_test/test')
-rw-r--r--lib/common_test/test/ct_telnet_SUITE.erl3
-rw-r--r--lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl57
2 files changed, 31 insertions, 29 deletions
diff --git a/lib/common_test/test/ct_telnet_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE.erl
index 9eb6c4033c..bb6cc0be5d 100644
--- a/lib/common_test/test/ct_telnet_SUITE.erl
+++ b/lib/common_test/test/ct_telnet_SUITE.erl
@@ -50,7 +50,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
groups() ->
[{legacy, [], [unix_telnet,own_server,timetrap]},
- {raw, [], [unix_telnet]},%,own_server,timetrap]},
+ {raw, [], [unix_telnet,own_server,timetrap]},
+%{raw, [], [unix_telnet]},
{html, [], [unix_telnet,own_server]},
{silent, [], [unix_telnet,own_server]}].
diff --git a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl
index a443893c5d..dbb9e9449a 100644
--- a/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl
+++ b/lib/common_test/test/ct_telnet_SUITE_data/ct_telnet_basic_SUITE.erl
@@ -5,12 +5,8 @@
-include_lib("common_test/include/ct.hrl").
--define(no_of_sessions, 2).
+-define(no_of_sessions, 4).
-define(conn_name(N), (list_to_atom("telnet_server_conn"++integer_to_list(N)))).
--define(req_n(), (begin
- ?MODULE ! {self(),req},
- receive _N -> _N after 2000 -> 0 end
- end)).
-define(get_n(Cfg), (proplists:get_value(n, Cfg))).
%%--------------------------------------------------------------------
@@ -23,15 +19,20 @@ suite() -> [
].
operations() ->
- [start_stop, send_and_get, expect, already_closed,
+ [start_stop
+, send_and_get, expect, already_closed,
cmd, sendf, close_wrong_type].
-mult_case(_Case, 0) -> [];
-mult_case(Case, N) -> [Case | mult_case(Case, N-1)].
+mult_case(_Case, 0) ->
+ [];
+mult_case(Case, N) ->
+ [list_to_atom(atom_to_list(Case)++integer_to_list(N)) |
+ mult_case(Case, N-1)].
groups() ->
[{single_connection,[],operations()},
- {multiple_connections,[parallel],mult_case(sessions,?no_of_sessions)}].
+ {multiple_connections,[parallel],
+ lists:reverse(mult_case(sessions,?no_of_sessions))}].
all() ->
[{group,single_connection},
@@ -40,11 +41,9 @@ all() ->
init_per_suite(Config) ->
ct:pal("Will use these log hook options: ~p",
[ct:get_config(ct_conn_log,[])]),
- SerialNo = spawn(?MODULE, serialno, [1,?no_of_sessions]),
Config.
end_per_suite(_Config) ->
- catch exit(whereis(?MODULE), kill),
ok.
init_per_group(Group, Config) ->
@@ -58,8 +57,15 @@ init_per_group(Group, Config) ->
end_per_group(_GroupName, Config) ->
Config.
-init_per_testcase(sessions, Config) ->
- N = ?req_n(),
+init_per_testcase(Case, Config) when (Case == sessions1) or
+ (Case == sessions2) or
+ (Case == sessions3) or
+ (Case == sessions4) ->
+
+ %%! --- Tue Jan 28 13:46:47 2014 --- peppe was here!
+ io:format(user, ">>> ~p STARTING~n", [Case]),
+
+ N = lists:last(atom_to_list(Case))-48,
ct:log("Using connection ~w for session ~w on ~w",
[?conn_name(N),N,self()]),
ct:require(?conn_name(N),{unix,[telnet]}),
@@ -69,7 +75,11 @@ init_per_testcase(Case, Config) ->
[Case,?conn_name(?get_n(Config))]),
Config.
-end_per_testcase(_, _) ->
+end_per_testcase(_Case, _) ->
+
+ %%! --- Tue Jan 28 13:46:47 2014 --- peppe was here!
+ io:format(user, "<<< ~p ENDING~n", [_Case]),
+
ok.
%%%-----------------------------------------------------------------
@@ -79,6 +89,11 @@ sessions(Config) ->
[apply(?MODULE,Op,[Config]) || Op <- operations()],
ok.
+sessions1(Config) -> sessions(Config).
+sessions2(Config) -> sessions(Config).
+sessions3(Config) -> sessions(Config).
+sessions4(Config) -> sessions(Config).
+
start_stop(Config) ->
ct:log("Opening ~w...", [?conn_name(?get_n(Config))]),
{ok, Handle} = ct_telnet:open(?conn_name(?get_n(Config))),
@@ -130,18 +145,4 @@ close_wrong_type(_) ->
%%%-----------------------------------------------------------------
%%% HELP FUNCS
-serialno(Start, Stop) ->
- register(?MODULE, self()),
- loop(Start, Stop).
-
-loop(X, Y) when X > Y ->
- done;
-loop(X, Y) ->
- receive
- {Pid,req} ->
- Pid ! X
- end,
- loop(X+1, Y).
-
-