aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/test_server/test/Makefile2
-rw-r--r--lib/test_server/test/test_server_SUITE.erl38
-rw-r--r--lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl48
-rw-r--r--lib/test_server/test/test_server_line_SUITE.erl131
-rw-r--r--lib/test_server/test/test_server_line_SUITE_data/Makefile.src6
-rw-r--r--lib/test_server/test/test_server_line_SUITE_data/parse_transform_test.erl59
6 files changed, 25 insertions, 259 deletions
diff --git a/lib/test_server/test/Makefile b/lib/test_server/test/Makefile
index afe5aff196..a3f9820d7f 100644
--- a/lib/test_server/test/Makefile
+++ b/lib/test_server/test/Makefile
@@ -26,7 +26,6 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
MODULES= \
test_server_SUITE \
- test_server_line_SUITE \
test_server_test_lib
ERL_FILES= $(MODULES:%=%.erl)
@@ -65,7 +64,6 @@ make_emakefile:
>> $(EMAKEFILE)
tests debug opt: make_emakefile
- cd ../src && $(MAKE) ../ebin/test_server_line.beam
erl $(ERL_MAKE_FLAGS) -make
clean:
diff --git a/lib/test_server/test/test_server_SUITE.erl b/lib/test_server/test/test_server_SUITE.erl
index a8532b08ab..cb8cb9da31 100644
--- a/lib/test_server/test/test_server_SUITE.erl
+++ b/lib/test_server/test/test_server_SUITE.erl
@@ -92,8 +92,8 @@ test_server_SUITE(Config) ->
% rpc:call(Node,dbg, tracer,[]),
% rpc:call(Node,dbg, p,[all,c]),
% rpc:call(Node,dbg, tpl,[test_server_ctrl,x]),
- run_test_server_tests("test_server_SUITE", 39, 1, 31,
- 20, 9, 1, 11, 2, 26, Config).
+ run_test_server_tests("test_server_SUITE", 38, 1, 30,
+ 19, 9, 1, 11, 2, 25, Config).
test_server_parallel01_SUITE(Config) ->
run_test_server_tests("test_server_parallel01_SUITE", 37, 0, 19,
@@ -120,7 +120,7 @@ run_test_server_tests(SuiteName, NCases, NFail, NExpected, NSucc,
NUsrSkip, NAutoSkip,
NActualSkip, NActualFail, NActualSucc, Config) ->
- ct:log("See test case log files under:~n~p~n",
+ ct:log("<a href=\"file://~s\">Test case log files</a>\n",
[filename:join([proplists:get_value(priv_dir, Config),
SuiteName++".logs"])]),
@@ -138,17 +138,16 @@ run_test_server_tests(SuiteName, NCases, NFail, NExpected, NSucc,
rpc:call(Node,test_server_ctrl, stop, []),
- {ok,#suite{ n_cases = NCases,
- n_cases_failed = NFail,
- n_cases_expected = NExpected,
- n_cases_succ = NSucc,
- n_cases_user_skip = NUsrSkip,
- n_cases_auto_skip = NAutoSkip,
- cases = Cases }} = Data =
- test_server_test_lib:parse_suite(
- hd(filelib:wildcard(
- filename:join([proplists:get_value(priv_dir, Config),
- SuiteName++".logs","run*","suite.log"])))),
+ {ok,Data} = test_server_test_lib:parse_suite(
+ hd(filelib:wildcard(
+ filename:join([proplists:get_value(priv_dir, Config),
+ SuiteName++".logs","run*","suite.log"])))),
+ check([{"Number of cases",NCases,Data#suite.n_cases},
+ {"Number failed",NFail,Data#suite.n_cases_failed},
+ {"Number expected",NExpected,Data#suite.n_cases_expected},
+ {"Number successful",NSucc,Data#suite.n_cases_succ},
+ {"Number user skipped",NUsrSkip,Data#suite.n_cases_user_skip},
+ {"Number auto skipped",NAutoSkip,Data#suite.n_cases_auto_skip}], ok),
{NActualSkip,NActualFail,NActualSucc} =
lists:foldl(fun(#tc{ result = skip },{S,F,Su}) ->
{S+1,F,Su};
@@ -156,9 +155,18 @@ run_test_server_tests(SuiteName, NCases, NFail, NExpected, NSucc,
{S,F,Su+1};
(#tc{ result = failed },{S,F,Su}) ->
{S,F+1,Su}
- end,{0,0,0},Cases),
+ end,{0,0,0},Data#suite.cases),
Data.
+check([{Str,Same,Same}|T], Status) ->
+ io:format("~s: ~p\n", [Str,Same]),
+ check(T, Status);
+check([{Str,Expected,Actual}|T], _) ->
+ io:format("~s: expected ~p, actual ~p\n", [Str,Expected,Actual]),
+ check(T, error);
+check([], ok) -> ok;
+check([], error) -> ?t:fail().
+
until(Fun) ->
case Fun() of
true ->
diff --git a/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl b/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl
index dfcdff0c3e..ab25e4ad2f 100644
--- a/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl
+++ b/lib/test_server/test/test_server_SUITE_data/test_server_SUITE.erl
@@ -34,7 +34,7 @@
do_times/1, do_times_mfa/1, do_times_fun/1,
skip_cases/1, skip_case1/1, skip_case2/1, skip_case3/1,
skip_case4/1, skip_case5/1, skip_case6/1, skip_case7/1,
- skip_case8/1, skip_case9/1, undefined_functions/1,
+ skip_case8/1, skip_case9/1,
conf_init/1, check_new_conf/1, conf_cleanup/1,
check_old_conf/1, conf_init_fail/1, start_stop_node/1,
cleanup_nodes_init/1, check_survive_nodes/1, cleanup_nodes_fin/1,
@@ -47,7 +47,7 @@ all(suite) ->
[config, comment, timetrap, timetrap_cancel, multiply_timetrap,
init_per_s, init_per_tc, end_per_tc,
timeconv, msgs, capture, timecall, do_times, skip_cases,
- undefined_functions, commercial,
+ commercial,
{conf, conf_init, [check_new_conf], conf_cleanup},
check_old_conf,
{conf, conf_init_fail,[conf_member_skip],conf_cleanup_skip},
@@ -386,50 +386,6 @@ skip_case9(Config) when is_list(Config) ->
%% returning {skip, Reason} from init_per_testcase/2 for this case.
?t:fail("This case should have been Skipped by init_per_testcase/2").
-undefined_functions(suite) -> [];
-undefined_functions(doc) -> ["Check for calls to undefined functions in"
- " test_server."
- "Skip if cover is running"];
-undefined_functions(Config) when is_list(Config) ->
- case whereis(cover_server) of
- Pid when is_pid(Pid) ->
- {skip,"Cover is running"};
- undefined ->
- undefined_functions()
- end.
-
-undefined_functions() ->
- TestServerDir = filename:dirname(code:which(test_server)),
- Res = xref:d(TestServerDir),
-
- {value,{unused,Unused}} = lists:keysearch(unused, 1, Res),
- case Unused of
- [] -> ok;
- _ ->
- lists:foreach(fun (MFA) ->
- io:format("~s unused", [format_mfa(MFA)])
- end, Unused)
- end,
-
- {value,{undefined,Undef0}} = lists:keysearch(undefined, 1, Res),
- Undef = [U || U <- Undef0, not unresolved(U)],
- case Undef of
- [] -> ok;
- _ ->
- lists:foreach(fun ({MFA1,MFA2}) ->
- io:format("~s calls undefined ~s",
- [format_mfa(MFA1),format_mfa(MFA2)])
- end, Undef),
- ?t:fail({length(Undef),undefined_functions_in_otp})
- end,
- ok.
-
-unresolved({_,{_,'$F_EXPR',_}}) -> true;
-unresolved(_) -> false.
-
-format_mfa({M,F,A}) ->
- lists:flatten(io_lib:format("~s:~s/~p", [M,F,A])).
-
conf_init(doc) -> ["Test successful conf case: Change Config parameter"];
conf_init(Config) when is_list(Config) ->
[{conf_init_var,1389}|Config].
diff --git a/lib/test_server/test/test_server_line_SUITE.erl b/lib/test_server/test/test_server_line_SUITE.erl
deleted file mode 100644
index 0aba54f6b5..0000000000
--- a/lib/test_server/test/test_server_line_SUITE.erl
+++ /dev/null
@@ -1,131 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
-
-%%%------------------------------------------------------------------
-%%% Test Server self test.
-%%%------------------------------------------------------------------
--module(test_server_line_SUITE).
--include_lib("test_server/include/test_server.hrl").
-
--export([all/0,suite/0]).
--export([init_per_suite/1,end_per_suite/1,
- init_per_testcase/2, end_per_testcase/2]).
--export([parse_transform/1, lines/1]).
-
-suite() ->
- [{ct_hooks,[ts_install_cth]},
- {doc,["Test of parse transform for collection line numbers"]}].
-
-all() -> [parse_transform,lines].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_testcase(_Case, Config) ->
- ?line test_server_line:clear(),
- Dog = ?t:timetrap(?t:minutes(2)),
- [{watchdog, Dog}|Config].
-
-end_per_testcase(_Case, Config) ->
- ?line test_server_line:clear(),
- Dog=?config(watchdog, Config),
- ?t:timetrap_cancel(Dog),
- ok.
-
-parse_transform(suite) -> [];
-parse_transform(doc) -> [];
-parse_transform(Config) when is_list(Config) ->
- ?line DataDir = ?config(data_dir,Config),
- code:add_pathz(DataDir),
-
- ?line ok = parse_transform_test:excluded(),
- ?line [] = test_server_line:get_lines(),
-
- ?line test_server_line:clear(),
- ?line ok = parse_transform_test:func(),
-
- ?line [{parse_transform_test,func4,58},
- {parse_transform_test,func,49},
- {parse_transform_test,func3,56},
- {parse_transform_test,func,39},
- {parse_transform_test,func2,54},
- {parse_transform_test,func,36},
- {parse_transform_test,func1,52},
- {parse_transform_test,func,35}] = test_server_line:get_lines(),
-
- code:del_path(DataDir),
- ok.
-
-lines(suite) -> [];
-lines(doc) -> ["Test parse transform for collection line numbers"];
-lines(Config) when is_list(Config) ->
- ?line L0 = [{mod,func,1},{mod,func,2},{mod,func,3},
- {m,f,4},{m,f,5},{m,f,6},
- {mo,fu,7},{mo,fu,8},{mo,fu,9}],
- ?line LL = string:copies(L0, 1000),
- ?line T1 = erlang:now(),
- ?line lists:foreach(fun ({M,F,L}) ->
- test_server_line:'$test_server_line'(M, F, L)
- end, LL),
- ?line T2 = erlang:now(),
- ?line Long = test_server_line:get_lines(),
- ?line test_server_line:clear(),
-
- ?line T3 = erlang:now(),
- ?line lists:foreach(fun ({M,F,L}) ->
- test_server_line:'$test_server_lineQ'(M, F, L)
- end, LL),
- ?line T4 = erlang:now(),
- ?line LongQ = test_server_line:get_lines(),
-
- ?line io:format("'$test_server_line': ~f~n'$test_server_lineQ': ~f~n",
- [timer:now_diff(T2, T1)/1000, timer:now_diff(T4, T3)/1000]),
- ?line io:format("'$test_server_line' result long:~p~n", [Long]),
- ?line io:format("'$test_server_lineQ' result long:~p~n", [LongQ]),
-
- if Long =:= LongQ ->
- ?line ok;
- true ->
- ?line ?t:fail("The two methods did not produce same result for"
- " long lists of lines")
- end,
-
- ?line test_server_line:clear(),
- ?line lists:foreach(fun ({M,F,L}) ->
- test_server_line:'$test_server_line'(M, F, L)
- end, L0),
- ?line Short = test_server_line:get_lines(),
- ?line test_server_line:clear(),
- ?line lists:foreach(fun ({M,F,L}) ->
- test_server_line:'$test_server_lineQ'(M, F, L)
- end, L0),
- ?line ShortQ = test_server_line:get_lines(),
-
- ?line io:format("'$test_server_line' result short:~p~n", [Short]),
- ?line io:format("'$test_server_lineQ' result short:~p~n", [ShortQ]),
-
- if Short =:= ShortQ ->
- ?line ok;
- true ->
- ?line ?t:fail("The two methods did not produce same result for"
- " shot lists of lines\n")
- end.
diff --git a/lib/test_server/test/test_server_line_SUITE_data/Makefile.src b/lib/test_server/test/test_server_line_SUITE_data/Makefile.src
deleted file mode 100644
index a077648934..0000000000
--- a/lib/test_server/test/test_server_line_SUITE_data/Makefile.src
+++ /dev/null
@@ -1,6 +0,0 @@
-EFLAGS=+debug_info -pa ../../test_server -I../../test_server
-
-all: parse_transform_test.@EMULATOR@
-
-parse_transform_test.@EMULATOR@: parse_transform_test.erl
- erlc $(EFLAGS) parse_transform_test.erl
diff --git a/lib/test_server/test/test_server_line_SUITE_data/parse_transform_test.erl b/lib/test_server/test/test_server_line_SUITE_data/parse_transform_test.erl
deleted file mode 100644
index 8f3477d3ac..0000000000
--- a/lib/test_server/test/test_server_line_SUITE_data/parse_transform_test.erl
+++ /dev/null
@@ -1,59 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
-%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
-%%
-%% %CopyrightEnd%
-%%
--module(parse_transform_test).
-
--include("test_server_line.hrl").
--no_lines([{excluded,0}]).
-
--export([excluded/0, func/0]).
-
-
-excluded() ->
- line1,
- line2,
- ok.
-
-
-func() ->
- hello,
- func1(),
- case func2() of
- ok ->
- helloagain,
- case func3() of
- ok ->
- ok;
- error ->
- error
- end;
- error ->
- error
- end,
- excluded(),
- func4().
-
-func1() ->
- ok.
-func2() ->
- ok.
-func3() ->
- error.
-func4() ->
- ok.
-