From 66668a6504fe3d6ed33ce87b1d4c1a76dae1a987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Wed, 6 Apr 2016 16:15:24 +0200 Subject: Eliminate use of test_server:fail/0,1 --- erts/test/erl_print_SUITE.erl | 8 ++++---- erts/test/erlc_SUITE.erl | 11 +++++------ erts/test/ethread_SUITE.erl | 16 ++++++++-------- erts/test/install_SUITE.erl | 2 +- erts/test/otp_SUITE.erl | 12 ++++++------ erts/test/run_erl_SUITE.erl | 18 +++++++----------- erts/test/z_SUITE.erl | 2 +- 7 files changed, 32 insertions(+), 37 deletions(-) (limited to 'erts/test') diff --git a/erts/test/erl_print_SUITE.erl b/erts/test/erl_print_SUITE.erl index 9ef68155bc..a6d287a318 100644 --- a/erts/test/erl_print_SUITE.erl +++ b/erts/test/erl_print_SUITE.erl @@ -261,7 +261,7 @@ get_line(Port, noeol, Data) -> {Port, {data, {Flag, NextData}}} -> get_line(Port, Flag, Data ++ NextData); {Port, eof} -> - ?t:fail(port_prog_unexpectedly_closed) + ct:fail(port_prog_unexpectedly_closed) end. read_case_data(Port, TestCase) -> @@ -273,7 +273,7 @@ read_case_data(Port, TestCase) -> {Port, {data, {Flag, [?SKIPPED_MARKER | CommentStart]}}} -> {skipped, get_line(Port, Flag, CommentStart)}; {Port, {data, {Flag, [?FAILED_MARKER | ReasonStart]}}} -> - ?t:fail(get_line(Port, Flag, ReasonStart)); + ct:fail(get_line(Port, Flag, ReasonStart)); {Port, {data, {eol, [?PID_MARKER | PidStr]}}} -> ?t:format("Port program pid: ~s~n", [PidStr]), CaseProc = self(), @@ -287,7 +287,7 @@ read_case_data(Port, TestCase) -> ?t:format("~s~n", [get_line(Port, Flag, LineStart)]), read_case_data(Port, TestCase); {Port, eof} -> - ?t:fail(port_prog_unexpectedly_closed) + ct:fail(port_prog_unexpectedly_closed) end. run_case(Config) -> @@ -317,7 +317,7 @@ run_case(Config, TestArgs, Fun) -> end, CaseResult; Error -> - ?t:fail({open_port_failed, Error}) + ct:fail({open_port_failed, Error}) end. diff --git a/erts/test/erlc_SUITE.erl b/erts/test/erlc_SUITE.erl index eca8319153..0750bf2836 100644 --- a/erts/test/erlc_SUITE.erl +++ b/erts/test/erlc_SUITE.erl @@ -249,7 +249,7 @@ num_d_options() -> erlc() -> case os:find_executable("erlc") of false -> - test_server:fail("Can't find erlc"); + ct:fail("Can't find erlc"); Erlc -> "\"" ++ Erlc ++ "\"" end. @@ -359,13 +359,13 @@ match_messages([Msg|Rest1], [Regexp|Rest2]) -> nomatch -> io:format("Not matching: ~s\n", [Msg]), io:format("Regexp : ~s\n", [Regexp]), - test_server:fail(message_mismatch) + ct:fail(message_mismatch) end, match_messages(Rest1, Rest2); match_messages([], [Expect|Rest]) -> - test_server:fail({too_few_messages, [Expect|Rest]}); + ct:fail({too_few_messages, [Expect|Rest]}); match_messages([Msg|Rest], []) -> - test_server:fail({too_many_messages, [Msg|Rest]}); + ct:fail({too_many_messages, [Msg|Rest]}); match_messages([], []) -> ok. @@ -422,5 +422,4 @@ run_command(Dir, {unix, _}, Cmd) -> " *) echo '_ERROR_';;\n", "esac\n"]}; run_command(_Dir, Other, _Cmd) -> - M = io_lib:format("Don't know how to test exit code for ~p", [Other]), - test_server:fail(lists:flatten(M)). + ct:fail("Don't know how to test exit code for ~p", [Other]). diff --git a/erts/test/ethread_SUITE.erl b/erts/test/ethread_SUITE.erl index 0cef913986..1c1a2f3836 100644 --- a/erts/test/ethread_SUITE.erl +++ b/erts/test/ethread_SUITE.erl @@ -241,7 +241,7 @@ get_line(Port, noeol, Data) -> {Port, {data, {Flag, NextData}}} -> get_line(Port, Flag, Data ++ NextData); {Port, eof} -> - ?t:fail(port_prog_unexpectedly_closed) + ct:fail(port_prog_unexpectedly_closed) end. read_case_data(Port, TestCase) -> @@ -253,7 +253,7 @@ read_case_data(Port, TestCase) -> {Port, {data, {Flag, [?SKIPPED_MARKER | CommentStart]}}} -> {skipped, get_line(Port, Flag, CommentStart)}; {Port, {data, {Flag, [?FAILED_MARKER | ReasonStart]}}} -> - ?t:fail(get_line(Port, Flag, ReasonStart)); + ct:fail(get_line(Port, Flag, ReasonStart)); {Port, {data, {eol, [?PID_MARKER | PidStr]}}} -> ?t:format("Port program pid: ~s~n", [PidStr]), CaseProc = self(), @@ -267,7 +267,7 @@ read_case_data(Port, TestCase) -> ?t:format("~s~n", [get_line(Port, Flag, LineStart)]), read_case_data(Port, TestCase); {Port, eof} -> - ?t:fail(port_prog_unexpectedly_closed) + ct:fail(port_prog_unexpectedly_closed) end. run_case(Config, Test, TestArgs) -> @@ -284,11 +284,11 @@ run_case(Config, Test, TestArgs, Fun) -> Port when is_port(Port) -> Fun(Port), CaseResult = read_case_data(Port, Test), - receive - {Port, eof} -> - ok - end, + receive + {Port, eof} -> + ok + end, CaseResult; Error -> - ?t:fail({open_port_failed, Error}) + ct:fail({open_port_failed, Error}) end. diff --git a/erts/test/install_SUITE.erl b/erts/test/install_SUITE.erl index 0010753edb..cf5a145755 100644 --- a/erts/test/install_SUITE.erl +++ b/erts/test/install_SUITE.erl @@ -546,7 +546,7 @@ expect(X, Y) -> ?t:format("expected: ~p~n", [X]), ?t:format("got : ~p~n", [Y]), ?t:format("-----------------------------------------------~n", []), - ?t:fail({X,Y}). + ct:fail({X,Y}). init_per_suite(Config) -> PD = proplists:get_value(priv_dir, Config), diff --git a/erts/test/otp_SUITE.erl b/erts/test/otp_SUITE.erl index 05c08207be..7ca0f50263 100644 --- a/erts/test/otp_SUITE.erl +++ b/erts/test/otp_SUITE.erl @@ -100,7 +100,7 @@ undefined_functions(Config) when is_list(Config) -> format_mfa(MFA2)]) end, Undef), close_log(Fd), - ?t:fail({length(Undef),undefined_functions_in_otp}) + ct:fail({length(Undef),undefined_functions_in_otp}) end. hipe_filter(Undef) -> @@ -240,7 +240,7 @@ deprecated_not_in_obsolete(Config) when is_list(Config) -> Fd = open_log(Config, "deprecated_not_obsolete"), print_mfas(Fd, Server, L), close_log(Fd), - ?t:fail({length(L),deprecated_but_not_obsolete}) + ct:fail({length(L),deprecated_but_not_obsolete}) end. obsolete_but_not_deprecated(Config) when is_list(Config) -> @@ -264,7 +264,7 @@ obsolete_but_not_deprecated(Config) when is_list(Config) -> Fd = open_log(Config, "obsolete_not_deprecated"), print_mfas(Fd, Server, L), close_log(Fd), - ?t:fail({length(L),obsolete_but_not_deprecated}) + ct:fail({length(L),obsolete_but_not_deprecated}) end. call_to_deprecated(Config) when is_list(Config) -> @@ -340,7 +340,7 @@ not_recommended_calls(Config, Apps0, MFA) -> {comment, Mess} end; _ -> - ?t:fail({length(CallsToMFA),calls_to_size_1}) + ct:fail({length(CallsToMFA),calls_to_size_1}) end. is_present_application(Name, Server) -> @@ -374,7 +374,7 @@ erl_file_encoding(_Config) -> [_|_] -> io:put_chars("Files with \"coding:\":\n"), [io:put_chars(F) || F <- Fs], - ?t:fail() + ct:fail(failed) end. filter_use_latin1_coding(F, MP) -> @@ -394,7 +394,7 @@ xml_file_encoding(_Config) -> [_|_] -> io:put_chars("Encoding should be \"utf-8\" or \"UTF-8\":\n"), [io:put_chars(F) || F <- Fs], - ?t:fail() + ct:fail(failed) end. xml_files() -> diff --git a/erts/test/run_erl_SUITE.erl b/erts/test/run_erl_SUITE.erl index 2474492a3b..5cd0068280 100644 --- a/erts/test/run_erl_SUITE.erl +++ b/erts/test/run_erl_SUITE.erl @@ -50,7 +50,7 @@ basic_1(Config) -> {nodedown,Node} -> io:format("Down: ~p\n", [Node]) after 10000 -> - ?t:fail() + ct:fail(timeout) end, ok. @@ -75,15 +75,14 @@ heavy_1(Config) -> {nodedown,Node} -> io:format("Down: ~p\n", [Node]) after 10000 -> - ?t:fail() + ct:fail(timeout) end, case count_new_lines(ToErl, 0) of Nls when Nls > 30000 -> ok; Nls -> - io:format("new_lines: ~p\n", [Nls]), - ?t:fail() + ct:fail("new_lines: ~p\n", [Nls]) end. @@ -153,7 +152,7 @@ heavier_1(Config) -> io:format("Down: ~p\n", [Node]) after 10000 -> c:flush(), - ?t:fail() + ct:fail(timeout) end, ok. @@ -180,9 +179,7 @@ receive_all_2(Iter, {NumChars,Pattern}, Line0, ToErl, MaxLen) -> %%io:format("Recv: ~p\n", [S]), receive_all_2(Iter, {NumChars,Pattern}, Line++S, ToErl, MaxLen) after 10000 -> - io:format("Timeout waiting for\n~p\ngot\n~p\n", - [Pattern, Line]), - ?t:fail() + ct:fail("Timeout waiting for\n~p\ngot\n~p\n", [Pattern, Line]) end end. @@ -256,9 +253,8 @@ do_run_erl(Config, Case) -> {nodeup,Node} -> io:format("Up: ~p\n", [Node]); Other -> - io:format("Unexpected: ~p\n", [Other]), - ?t:fail() + ct:fail("Unexpected: ~p\n", [Other]) after 10000 -> - ?t:fail() + ct:fail(timeout) end, {Node,Pipe}. diff --git a/erts/test/z_SUITE.erl b/erts/test/z_SUITE.erl index e6ce90ac3e..204f393e93 100644 --- a/erts/test/z_SUITE.erl +++ b/erts/test/z_SUITE.erl @@ -324,7 +324,7 @@ core_file_search(#core_search_conf{search_dir = Base, case {RunByTS, ICores, FCores} of {true, [], []} -> ok; {true, _, []} -> {comment, Res}; - {true, _, _} -> ?t:fail(Res); + {true, _, _} -> ct:fail(Res); _ -> Res end end. -- cgit v1.2.3