From ca290148fbde80f1cda249c1c15562c5bc9aedaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 25 Feb 2016 15:28:25 +0100 Subject: Eliminate use of test_server:fail/0,1 --- lib/kernel/test/application_SUITE.erl | 48 ++++++------- lib/kernel/test/bif_SUITE.erl | 2 +- lib/kernel/test/cleanup.erl | 2 +- lib/kernel/test/code_SUITE.erl | 8 +-- lib/kernel/test/disk_log_SUITE.erl | 2 +- lib/kernel/test/erl_boot_server_SUITE.erl | 14 ++-- lib/kernel/test/erl_distribution_SUITE.erl | 30 ++++---- lib/kernel/test/erl_prim_loader_SUITE.erl | 10 +-- lib/kernel/test/error_logger_SUITE.erl | 2 +- lib/kernel/test/file_SUITE.erl | 18 ++--- lib/kernel/test/gen_sctp_SUITE.erl | 16 ++--- lib/kernel/test/gen_tcp_api_SUITE.erl | 18 ++--- lib/kernel/test/gen_tcp_echo_SUITE.erl | 18 ++--- lib/kernel/test/gen_tcp_misc_SUITE.erl | 108 ++++++++++++++--------------- lib/kernel/test/gen_udp_SUITE.erl | 8 +-- lib/kernel/test/global_SUITE.erl | 46 ++++++------ lib/kernel/test/global_group_SUITE.erl | 54 +++++++-------- lib/kernel/test/heart_SUITE.erl | 28 ++++---- lib/kernel/test/inet_SUITE.erl | 20 +++--- lib/kernel/test/init_SUITE.erl | 56 +++++++-------- lib/kernel/test/kernel_config_SUITE.erl | 4 +- lib/kernel/test/os_SUITE.erl | 8 +-- lib/kernel/test/prim_file_SUITE.erl | 4 +- lib/kernel/test/seq_trace_SUITE.erl | 22 +++--- lib/kernel/test/wrap_log_reader_SUITE.erl | 12 ++-- lib/kernel/test/zlib_SUITE.erl | 2 +- 26 files changed, 280 insertions(+), 280 deletions(-) (limited to 'lib/kernel/test') diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl index 8ff2bf68e1..46c8d82a3b 100644 --- a/lib/kernel/test/application_SUITE.erl +++ b/lib/kernel/test/application_SUITE.erl @@ -1216,14 +1216,14 @@ otp_2973(Conf) when is_list(Conf) -> {Pid2, res, Res2x} -> {Res1x, Res2x} after 2000 -> - test_server:fail(timeout_pid2) + ct:fail(timeout_pid2) end; {Pid2, res, Res2x} -> receive {Pid1, res, Res1x} -> {Res1x, Res2x} after 2000 -> - test_server:fail(timeout_pid1) + ct:fail(timeout_pid1) end end, @@ -1237,7 +1237,7 @@ otp_2973(Conf) when is_list(Conf) -> _ -> Txt = io_lib:format("Illegal results from start: ~p ~p ", [Res1, Res2]), - test_server:fail(lists:flatten(Txt)) + ct:fail(lists:flatten(Txt)) end, @@ -1255,14 +1255,14 @@ otp_2973(Conf) when is_list(Conf) -> {Pid2, res, Res2y} -> {Res1y, Res2y} after 2000 -> - test_server:fail(timeout_pid2) + ct:fail(timeout_pid2) end; {Pid2, res, Res2y} -> receive {Pid1, res, Res1y} -> {Res1y, Res2y} after 2000 -> - test_server:fail(timeout_pid1) + ct:fail(timeout_pid1) end end, @@ -1272,7 +1272,7 @@ otp_2973(Conf) when is_list(Conf) -> ok; _ -> Txta = io_lib:format("Illegal results from start ~p ~p ",[Res1a, Res2a]), - test_server:fail(lists:flatten(Txta)) + ct:fail(lists:flatten(Txta)) end, ok. @@ -1526,7 +1526,7 @@ otp_5363(Conf) when is_list(Conf) -> undefined = whereis(nisse); Bad -> io:format("~p\n", [Bad]), - ?t:fail() + ct:fail(failed) end after code:set_path(OldPath) @@ -1580,7 +1580,7 @@ otp_5606(Conf) when is_list(Conf) -> [Res1, Res2, Res3, Res4] -> Txt = io_lib:format("Illegal results from start ~p ~p ~p ~p", [Res1, Res2, Res3, Res4]), - test_server:fail(lists:flatten(Txt)) + ct:fail(lists:flatten(Txt)) end, {error, {already_started, app1}} = @@ -1595,7 +1595,7 @@ otp_5606_loop(ResL) when length(ResL)<4 -> {_Pid, Res} -> otp_5606_loop([Res|ResL]) after 5000 -> - test_server:fail(timeout_waiting_for_res) + ct:fail(timeout_waiting_for_res) end; otp_5606_loop(ResL) -> ResL. @@ -1772,7 +1772,7 @@ distr_changed_tc1(Conf) when is_list(Conf) -> ok; EWa1 -> X1 = io_lib:format("distribution error: Cp1 ~p ",[EWa1]), - test_server:fail(lists:flatten(X1)) + ct:fail(lists:flatten(X1)) end, case lists:sort(Wa2) of @@ -1780,7 +1780,7 @@ distr_changed_tc1(Conf) when is_list(Conf) -> ok; EWa2 -> X2 = io_lib:format("distribution error: Cp2 ~p ",[EWa2]), - test_server:fail(lists:flatten(X2)) + ct:fail(lists:flatten(X2)) end, case lists:sort(Wa3) of @@ -1788,7 +1788,7 @@ distr_changed_tc1(Conf) when is_list(Conf) -> ok; EWa3 -> X3 = io_lib:format("distribution error: Cp3 ~p ",[EWa3]), - test_server:fail(lists:flatten(X3)) + ct:fail(lists:flatten(X3)) end, DcInfo1n = rpc:call(Cp1, dist_ac, info, []), @@ -1863,7 +1863,7 @@ distr_changed_tc2(Conf) when is_list(Conf) -> ok; EWa2 -> X2 = io_lib:format("distribution error: Cp2 ~p ",[EWa2]), - test_server:fail(lists:flatten(X2)) + ct:fail(lists:flatten(X2)) end, case lists:sort(Wa3) of @@ -1871,7 +1871,7 @@ distr_changed_tc2(Conf) when is_list(Conf) -> ok; EWa3 -> X3 = io_lib:format("distribution error: Cp3 ~p ",[EWa3]), - test_server:fail(lists:flatten(X3)) + ct:fail(lists:flatten(X3)) end, @@ -1898,7 +1898,7 @@ distr_changed_tc2(Conf) when is_list(Conf) -> ok; EWa1rs -> X1rs = io_lib:format("distribution error: Cp1 ~p ",[EWa1rs]), - test_server:fail(lists:flatten(X1rs)) + ct:fail(lists:flatten(X1rs)) end, case lists:sort(Wa2rs) of @@ -1906,7 +1906,7 @@ distr_changed_tc2(Conf) when is_list(Conf) -> ok; EWa2rs -> X2rs = io_lib:format("distribution error: Cp2 ~p ",[EWa2rs]), - test_server:fail(lists:flatten(X2rs)) + ct:fail(lists:flatten(X2rs)) end, case lists:sort(Wa3rs) of @@ -1914,7 +1914,7 @@ distr_changed_tc2(Conf) when is_list(Conf) -> ok; EWa3rs -> X3rs = io_lib:format("distribution error: Cp3 ~p ",[EWa3rs]), - test_server:fail(lists:flatten(X3rs)) + ct:fail(lists:flatten(X3rs)) end, @@ -2071,10 +2071,10 @@ shutdown_func(Config) when is_list(Config) -> {'DOWN', Mref, _, Pid, noconnection} -> ok after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end. @@ -2708,7 +2708,7 @@ get_start_type(Expected) -> get_start_type(_Expected, 0, Ack) -> test_server:format("====== ~p ======~n", [Ack]), - test_server:fail(not_valid_start_type); + ct:fail(not_valid_start_type); get_start_type(Expected, Times, Ack0) -> #st{normal = N0, local = L0, takeover = T0, failover = F0} = Ack0, global:send(st_type, {st, read, self()}), @@ -2758,9 +2758,9 @@ get_start_phase(Expected) -> test_server:format("=========== got ~p ~n", [{sp, T1, I1, So1, Sp1, G1}]), test_server:format("====== expected ~p ~n", [Expected]), - test_server:fail(not_valid_start_phase) + ct:fail(not_valid_start_phase) after 5000 -> - test_server:fail(not_valid_start_phase) + ct:fail(not_valid_start_phase) end. start_phase() -> @@ -2792,9 +2792,9 @@ get_conf_change(Expected) -> ok; {cc, List} -> test_server:format("====== ~p ======~n",[{cc, List}]), - test_server:fail(not_valid_conf_change) + ct:fail(not_valid_conf_change) after 5000 -> - test_server:fail(not_valid_conf_change_to) + ct:fail(not_valid_conf_change_to) end. conf_change() -> diff --git a/lib/kernel/test/bif_SUITE.erl b/lib/kernel/test/bif_SUITE.erl index 8fb84b5d1c..c0ef0ab714 100644 --- a/lib/kernel/test/bif_SUITE.erl +++ b/lib/kernel/test/bif_SUITE.erl @@ -427,7 +427,7 @@ spawn_failures(Config) when is_list(Config) -> false -> receive {'EXIT', P, R} -> - ?line test_server:fail({'EXIT', P, R}) + ct:fail({'EXIT', P, R}) after 0 -> ok end; diff --git a/lib/kernel/test/cleanup.erl b/lib/kernel/test/cleanup.erl index 7f623b9fc3..c9f2a2a2d0 100644 --- a/lib/kernel/test/cleanup.erl +++ b/lib/kernel/test/cleanup.erl @@ -46,5 +46,5 @@ cleanup(_) -> Nodes when is_list(Nodes) -> Kill = fun(Node) -> spawn(Node, erlang, halt, []) end, ?line lists:foreach(Kill, Nodes), - ?line test_server:fail({nodes_left, Nodes}) + ct:fail({nodes_left, Nodes}) end. diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl index 5a194328e5..639d59c39a 100644 --- a/lib/kernel/test/code_SUITE.erl +++ b/lib/kernel/test/code_SUITE.erl @@ -609,7 +609,7 @@ sticky_dir(Config) when is_list(Config) -> ok; Other -> io:format("~p\n", [Other]), - ?t:fail() + ct:fail(failed) end, ?t:stop_node(Node), ok. @@ -746,7 +746,7 @@ ext_mod_dep(Config) when is_list(Config) -> xref:stop(s), case Else of ok -> ok; - _ -> test_server:fail(Else) + _ -> ct:fail(Else) end end. @@ -1192,7 +1192,7 @@ on_load(Config) when is_list(Config) -> on_load_wait_for_all(Refs), receive Any -> - ?t:fail({unexpected,Any}) + ct:fail({unexpected,Any}) after 10 -> ok end. @@ -1428,7 +1428,7 @@ on_load_errors(Config) when is_list(Config) -> %% There should be no more messages. receive Unexpected -> - ?t:fail({unexpected,Unexpected}) + ct:fail({unexpected,Unexpected}) after 10 -> ok end, diff --git a/lib/kernel/test/disk_log_SUITE.erl b/lib/kernel/test/disk_log_SUITE.erl index 3359c41c1a..715cbd70d7 100644 --- a/lib/kernel/test/disk_log_SUITE.erl +++ b/lib/kernel/test/disk_log_SUITE.erl @@ -4885,7 +4885,7 @@ otp_6278(Conf) when is_list(Conf) -> receive {crash_report,_Pid,Report} -> ?line io:format("Unexpected: ~p\n", [Report]), - ?line ?t:fail() + ct:fail(failed) after 1000 -> ok end, diff --git a/lib/kernel/test/erl_boot_server_SUITE.erl b/lib/kernel/test/erl_boot_server_SUITE.erl index b376b98812..0267420cab 100644 --- a/lib/kernel/test/erl_boot_server_SUITE.erl +++ b/lib/kernel/test/erl_boot_server_SUITE.erl @@ -130,7 +130,7 @@ stop(Config) when is_list(Config) -> [] -> ok; NotKilled -> - test_server:fail({not_killed, NotKilled}) + ct:fail({not_killed, NotKilled}) end, ok. @@ -243,7 +243,7 @@ responses(Config) when is_list(Config) -> receive What -> ?line close_udp(S1), - ?line ?t:fail({"got unexpected response",What}) + ct:fail({"got unexpected response",What}) after 100 -> ok end, @@ -259,7 +259,7 @@ responses(Config) when is_list(Config) -> ?line [_,_,_ | ThisVer] = Rest1 after 2000 -> ?line close_udp(S2), - ?line ?t:fail("no boot server response; same vsn") + ct:fail("no boot server response; same vsn") end, %% Req from a slave with other erlang vsn. @@ -268,7 +268,7 @@ responses(Config) when is_list(Config) -> receive Anything -> ?line close_udp(S3), - ?line ?t:fail({"got unexpected response",Anything}) + ct:fail({"got unexpected response",Anything}) after 100 -> ok end, @@ -295,7 +295,7 @@ responses(Config) when is_list(Config) -> receive Huh -> ?line close_udp(S4), - ?line ?t:fail({"got unexpected response",Huh}) + ct:fail({"got unexpected response",Huh}) after 100 -> ok end @@ -307,7 +307,7 @@ responses(Config) when is_list(Config) -> %% Now wait for any late unexpected messages. receive Whatever -> - ?line ?t:fail({unexpected_message,Whatever}) + ct:fail({unexpected_message,Whatever}) after 4000 -> ?line close_udp(S1), ?line close_udp(S3), @@ -325,7 +325,7 @@ shutdown(Pid) -> after 1000 -> %% The timeout used to be 1 ms, which could be too short time for the %% SMP emulator on a slow computer with one CPU. - test_server:fail(shutdown) + ct:fail(shutdown) end. good_hosts(_Config) -> diff --git a/lib/kernel/test/erl_distribution_SUITE.erl b/lib/kernel/test/erl_distribution_SUITE.erl index 2473ebd860..10050bc54e 100644 --- a/lib/kernel/test/erl_distribution_SUITE.erl +++ b/lib/kernel/test/erl_distribution_SUITE.erl @@ -110,7 +110,7 @@ tick(Config) when is_list(Config) -> erlang:monitor_node(Node, true), receive {nodedown, Node} -> - test_server:fail("nodedown from other node") + ct:fail("nodedown from other node") after 30000 -> erlang:monitor_node(Node, false), stop_node(Node) @@ -153,13 +153,13 @@ tick(Config) when is_list(Config) -> {tick_test, Error} -> stop_node(ServNode), stop_node(Node), - test_server:fail(Error); + ct:fail(Error); {nodedown, Node} -> stop_node(ServNode), - test_server:fail("client node died"); + ct:fail("client node died"); {nodedown, ServNode} -> stop_node(Node), - test_server:fail("server node died") + ct:fail("server node died") end, ok. @@ -197,7 +197,7 @@ illegal_nodenames(Config) when is_list(Config) -> {RPid, pinged} -> ok; {nodedown, Node} -> - ?t:fail("Remote node died.") + ct:fail("Remote node died.") end, stop_node(Node), ok. @@ -301,7 +301,7 @@ tick_change(Config) when is_list(Config) -> ?line unchanged = net_kernel:set_net_ticktime(DefaultTT, 60), ?line case DefaultTT of I when is_integer(I) -> ?line ok; - _ -> ?line ?t:fail(DefaultTT) + _ -> ct:fail(DefaultTT) end, % In case other nodes are connected @@ -334,7 +334,7 @@ tick_change(Config) when is_list(Config) -> DefaultTT == net_kernel:get_net_ticktime() end), ?line process_flag(trap_exit, OTE), - ?t:fail(Reason); + ct:fail(Reason); _ -> ok end, @@ -1110,7 +1110,7 @@ receive_mn_msgs(Msgs) -> ?t:format("received ~p~n", [Msg]), case lists:member(Msg, Msgs) of true -> receive_mn_msgs(lists:delete(Msg, Msgs)); - false -> ?t:fail({unexpected_message, Msg, + false -> ct:fail({unexpected_message, Msg, expected_messages, Msgs}) end; {Dir, Node, Info} -> @@ -1118,12 +1118,12 @@ receive_mn_msgs(Msgs) -> ?t:format("received ~p~n", [Msg]), case lists:member(Msg, Msgs) of true -> receive_mn_msgs(lists:delete(Msg, Msgs)); - false -> ?t:fail({unexpected_message, Msg, + false -> ct:fail({unexpected_message, Msg, expected_messages, Msgs}) end; Msg -> ?t:format("received ~p~n", [Msg]), - ?t:fail({unexpected_message, Msg, + ct:fail({unexpected_message, Msg, expected_messages, Msgs}) end. @@ -1191,10 +1191,10 @@ monitor_node_state() -> check_no_nodedown_nodeup(TimeOut) -> ?line receive - {nodeup, _, _} = Msg -> ?line ?t:fail({unexpected_nodeup, Msg}); - {nodeup, _} = Msg -> ?line ?t:fail({unexpected_nodeup, Msg}); - {nodedown, _, _} = Msg -> ?line ?t:fail({unexpected_nodedown, Msg}); - {nodedown, _} = Msg -> ?line ?t:fail({unexpected_nodedown, Msg}) + {nodeup, _, _} = Msg -> ct:fail({unexpected_nodeup, Msg}); + {nodeup, _} = Msg -> ct:fail({unexpected_nodeup, Msg}); + {nodedown, _, _} = Msg -> ct:fail({unexpected_nodedown, Msg}); + {nodedown, _} = Msg -> ct:fail({unexpected_nodedown, Msg}) after TimeOut -> ok end. @@ -1237,7 +1237,7 @@ stop_node(Node) -> % {nodedown, Node} -> % ok % after 10000 -> -% test_server:fail({stop_node, Node}) +% ct:fail({stop_node, Node}) % end. % from(H, [H | T]) -> T; diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl index 28cca1867f..3c4fda2910 100644 --- a/lib/kernel/test/erl_prim_loader_SUITE.erl +++ b/lib/kernel/test/erl_prim_loader_SUITE.erl @@ -78,7 +78,7 @@ get_path(Config) when is_list(Config) -> {ok, Path} when is_list(Path) -> ok; _ -> - test_server:fail(get_path) + ct:fail(get_path) end, ok. @@ -104,7 +104,7 @@ get_file(Config) when is_list(Config) -> {ok,Bin,File} when is_binary(Bin), is_list(File) -> ok; _ -> - test_server:fail(get_valid_file) + ct:fail(get_valid_file) end, ?line error = erl_prim_loader:get_file("duuuuuuummmy_file"), ?line error = erl_prim_loader:get_file(duuuuuuummmy_file), @@ -193,7 +193,7 @@ inet_coming_up(Config) when is_list(Config) -> ok. wait_really_started(Node, 0) -> - test_server:fail({not_booted,Node}); + ct:fail({not_booted,Node}); wait_really_started(Node, N) -> case rpc:call(Node, init, get_status, []) of {started, _} -> @@ -230,9 +230,9 @@ inet_disconnects(Config) when is_list(Config) -> {Stopper,ok} -> ok; {Stopper,{error,Reason}} -> - ?line ?t:fail(Reason) + ct:fail(Reason) after 60000 -> - ?line ?t:fail(stopper_died) + ct:fail(stopper_died) end, %% Start new boot server to see that loading is continued. diff --git a/lib/kernel/test/error_logger_SUITE.erl b/lib/kernel/test/error_logger_SUITE.erl index 917b6a9b9e..dcf13e0120 100644 --- a/lib/kernel/test/error_logger_SUITE.erl +++ b/lib/kernel/test/error_logger_SUITE.erl @@ -286,7 +286,7 @@ reported(Tag, Type, Report) -> test_server:messages_get(), ok after 1000 -> - test_server:fail(no_report_received) + ct:fail(no_report_received) end. %%----------------------------------------------------------------- diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index b553fdb91f..f67e1228c6 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -843,7 +843,7 @@ start_node(Name, Args) -> ct:log("Trying to start ~w@~s~n", [Name,Host]), case test_server:start_node(Name, peer, [{args,Args}]) of {error,Reason} -> - test_server:fail(Reason); + ct:fail(Reason); {ok,Node} -> ct:log("Node ~p started~n", [Node]), Node @@ -1055,7 +1055,7 @@ access(Config) when is_list(Config) -> ?line {ok,Fd2} = ?FILE_MODULE:open(Name,read), ?line case catch io:format(Fd2,"XXXX",[]) of ok -> - test_server:fail({format,write}); + ct:fail({format,write}); _ -> ok end, @@ -2547,7 +2547,7 @@ write_compressed(Config) when is_list(Config) -> {ok, #file_info{size=Size}} when Size < TotalSize -> ok; {ok, #file_info{size=Size}} when Size == TotalSize -> - test_server:fail(file_not_compressed) + ct:fail(file_not_compressed) end, %% Write again to ensure that the file is truncated. @@ -2661,11 +2661,11 @@ compress_async_crash_loop(N, Path, ExpectedData) -> ?line shutdown = Reason end; {'DOWN', Ref, _, _, Reason2} -> - test_server:fail({worker_exited, Reason2}) + ct:fail({worker_exited, Reason2}) after 60000 -> exit(Pid, shutdown), erlang:demonitor(Ref, [flush]), - test_server:fail(worker_timeout) + ct:fail(worker_timeout) end, compress_async_crash_loop(N - 1, Path, ExpectedData). @@ -3061,7 +3061,7 @@ delayed_write(Config) when is_list(Config) -> {Child1, wrote} -> ok; {'DOWN', Mref1, _, _, _} = Down1a -> - ?t:fail(Down1a) + ct:fail(Down1a) end, ?t:sleep(1000), % Just in case the file system is slow {ok, Fd3} = ?FILE_MODULE:open(File, [read]), @@ -3071,7 +3071,7 @@ delayed_write(Config) when is_list(Config) -> {'DOWN', Mref1, process, Child1, normal} -> ok; {'DOWN', Mref1, _, _, _} = Down1b -> - ?t:fail(Down1b) + ct:fail(Down1b) end, ?t:sleep(1000), % Just in case the file system is slow {ok, Data1} = ?FILE_MODULE:pread(Fd3, bof, Size+1), @@ -3084,7 +3084,7 @@ delayed_write(Config) when is_list(Config) -> {Child2, wrote} -> ok; {'DOWN', Mref2, _, _, _} = Down2a -> - ?t:fail(Down2a) + ct:fail(Down2a) end, ?t:sleep(1000), % Just in case the file system is slow {ok, Fd4} = ?FILE_MODULE:open(File, [read]), @@ -3094,7 +3094,7 @@ delayed_write(Config) when is_list(Config) -> {'DOWN', Mref2, process, Child2, kill} -> ok; {'DOWN', Mref2, _, _, _} = Down2b -> - ?t:fail(Down2b) + ct:fail(Down2b) end, ?t:sleep(1000), % Just in case the file system is slow eof = ?FILE_MODULE:pread(Fd4, bof, 1), diff --git a/lib/kernel/test/gen_sctp_SUITE.erl b/lib/kernel/test/gen_sctp_SUITE.erl index 11ffdb003e..2bd1e63804 100644 --- a/lib/kernel/test/gen_sctp_SUITE.erl +++ b/lib/kernel/test/gen_sctp_SUITE.erl @@ -208,7 +208,7 @@ xfer_min(Config) when is_list(Config) -> ?line ok = gen_sctp:close(Sb), ?line receive - Msg -> test_server:fail({received,Msg}) + Msg -> ct:fail({received,Msg}) after 17 -> ok end, ok. @@ -283,7 +283,7 @@ xfer_active(Config) when is_list(Config) -> assoc_id=SbAssocId}], Data}} -> ok after Timeout -> - ?line test_server:fail({timeout,flush()}) + ct:fail({timeout,flush()}) end, ?line ok = gen_sctp:send(Sb, SbAssocId, 0, Data), ?line receive @@ -292,7 +292,7 @@ xfer_active(Config) when is_list(Config) -> assoc_id=SaAssocId}], Data}} -> ok after Timeout -> - ?line test_server:fail({timeout,flush()}) + ct:fail({timeout,flush()}) end, %% ?line ok = gen_sctp:abort(Sa, SaAssocChange), @@ -300,7 +300,7 @@ xfer_active(Config) when is_list(Config) -> #sctp_assoc_change{state=comm_lost, assoc_id=SbAssocId} -> ok; timeout -> - ?line test_server:fail({timeout,flush()}) + ct:fail({timeout,flush()}) end, ?line ok = gen_sctp:close(Sb), ?line case recv_assoc_change(Sa, Loopback, Pb, Timeout) of @@ -317,7 +317,7 @@ xfer_active(Config) when is_list(Config) -> ?line ok = gen_sctp:close(Sa), %% ?line receive - Msg -> test_server:fail({unexpected,[Msg]++flush()}) + Msg -> ct:fail({unexpected,[Msg]++flush()}) after 17 -> ok end, ok. @@ -502,7 +502,7 @@ def_sndrcvinfo(Config) when is_list(Config) -> gen_sctp:close(S2), ?line receive Msg -> - test_server:fail({received,Msg}) + ct:fail({received,Msg}) after 17 -> ok end, ok. @@ -1024,7 +1024,7 @@ xfer_stream_min(Config) when is_list(Config) -> ?line ok = gen_sctp:close(Sb), ?line receive - Msg -> test_server:fail({received,Msg}) + Msg -> ct:fail({received,Msg}) after 17 -> ok end, ok. @@ -1609,7 +1609,7 @@ socket_bailout([S|Ss]) -> socket_bailout(Ss); socket_bailout([]) -> io:format("flush: ~p.~n", [flush()]), - test_server:fail(socket_bailout). + ct:fail(socket_bailout). socket_history({State,Flush}) -> {lists:keysort( diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl index f74fffcaf9..77124c7e58 100644 --- a/lib/kernel/test/gen_tcp_api_SUITE.erl +++ b/lib/kernel/test/gen_tcp_api_SUITE.erl @@ -188,7 +188,7 @@ t_shutdown_async(Config) when is_list(Config) -> ?line case erlang:port_info(S, queue_size) of {queue_size, N} when N > 0 -> ok; {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail({unexpected, T}) + {queue_size, 0} = T -> ct:fail({unexpected, T}) end, ?line ok = gen_tcp:shutdown(S, write), @@ -196,7 +196,7 @@ t_shutdown_async(Config) when is_list(Config) -> ?line {error, closed} = gen_tcp:recv(Client, 0), ?line case length(Buf) of PayloadSize -> ok; - Sz -> ?t:fail({payload_size, + Sz -> ct:fail({payload_size, {expected, PayloadSize}, {received, Sz}}) end. @@ -324,13 +324,13 @@ implicit_inet6(S, Addr) -> timeout({M,F,A}, Lower, Upper) -> case test_server:timecall(M, F, A) of {Time, Result} when Time < Lower -> - test_server:fail({too_short_time, Time, Result}); + ct:fail({too_short_time, Time, Result}); {Time, Result} when Time > Upper -> - test_server:fail({too_long_time, Time, Result}); + ct:fail({too_long_time, Time, Result}); {_, {error, timeout}} -> ok; {_, Result} -> - test_server:fail({unexpected_result, Result}) + ct:fail({unexpected_result, Result}) end. connect_timeout({M,F,A}, Lower, Upper) -> @@ -345,17 +345,17 @@ connect_timeout({M,F,A}, Lower, Upper) -> Pinfo = erlang:port_info(Socket), Db = inet_db:lookup_socket(Socket), Peer = inet:peername(Socket), - test_server:fail({too_short_time, Time, + ct:fail({too_short_time, Time, [Result,Pinfo,Db,Peer]}); _ -> - test_server:fail({too_short_time, Time, Result}) + ct:fail({too_short_time, Time, Result}) end; {Time, Result} when Time > Upper -> - test_server:fail({too_long_time, Time, Result}); + ct:fail({too_long_time, Time, Result}); {_, {error, timeout}} -> ok; {_, Result} -> - test_server:fail({unexpected_result, Result}) + ct:fail({unexpected_result, Result}) end. %% Try to obtain an unused IP address in the local network. diff --git a/lib/kernel/test/gen_tcp_echo_SUITE.erl b/lib/kernel/test/gen_tcp_echo_SUITE.erl index 1bd5e36e2e..e10a81e727 100644 --- a/lib/kernel/test/gen_tcp_echo_SUITE.erl +++ b/lib/kernel/test/gen_tcp_echo_SUITE.erl @@ -280,7 +280,7 @@ echo_packet1(EchoSock, Type, EchoFun, Size) -> case Size of {N, Max} when N > Max -> ?line - test_server:fail( + ct:fail( {packet_through, {N, Max}}); _ -> ok end; @@ -291,11 +291,11 @@ echo_packet1(EchoSock, Type, EchoFun, Size) -> io:format(" Blocked!"); _ -> ?line - test_server:fail( + ct:fail( {packet_blocked, Size}) end; Error -> - ?line test_server:fail(Error) + ct:fail(Error) end end. @@ -317,11 +317,11 @@ active_recv(Sock, Type, [PacketEcho|Tail]) -> {Tag, Sock, PacketEcho} -> active_recv(Sock, Type, Tail); {Tag, Sock, Bad} -> - ?line test_server:fail({wrong_data, Bad, expected, PacketEcho}); + ct:fail({wrong_data, Bad, expected, PacketEcho}); {tcp_error, Sock, Reason} -> {error, Reason}; Other -> - ?line test_server:fail({unexpected_message, Other, Tag}) + ct:fail({unexpected_message, Other, Tag}) end. passive_echo(Sock, _Type, Packet, PacketEchos) -> @@ -338,13 +338,13 @@ passive_recv(Sock, [PacketEcho | Tail]) -> passive_recv(Sock, Tail); {ok, Bad} -> io:format("Expected: ~p\nGot: ~p\n",[PacketEcho,Bad]), - ?line test_server:fail({wrong_data, Bad}); + ct:fail({wrong_data, Bad}); {error,PacketEcho} -> passive_recv(Sock, Tail); % expected error {error, _}=Error -> Error; Other -> - ?line test_server:fail({unexpected_message, Other}) + ct:fail({unexpected_message, Other}) end. active_once_echo(Sock, Type, Packet, PacketEchos) -> @@ -364,11 +364,11 @@ active_once_recv(Sock, Type, [PacketEcho | Tail]) -> inet:setopts(Sock, [{active, once}]), active_once_recv(Sock, Type, Tail); {Tag, Sock, Bad} -> - ?line test_server:fail({wrong_data, Bad}); + ct:fail({wrong_data, Bad}); {tcp_error, Sock, Reason} -> {error, Reason}; Other -> - ?line test_server:fail({unexpected_message, Other, expected, {Tag, Sock, PacketEcho}}) + ct:fail({unexpected_message, Other, expected, {Tag, Sock, PacketEcho}}) end. %%% Building of random packets. diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl index 904546d567..3e953e4692 100644 --- a/lib/kernel/test/gen_tcp_misc_SUITE.erl +++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl @@ -362,7 +362,7 @@ no_accept(Config) when is_list(Config) -> {tcp_closed, Client} -> ok after 5000 -> - test_server:fail(never_closed) + ct:fail(never_closed) end. @@ -385,16 +385,16 @@ close_with_pending_output(Config) when is_list(Config) -> gen_tcp:close(A), gen_tcp:close(L); {ok, Bin} -> - test_server:fail({small_packet, + ct:fail({small_packet, byte_size(Bin)}); Error -> - test_server:fail({unexpected, Error}) + ct:fail({unexpected, Error}) end, ok; {error, no_remote_hosts} -> {skipped,"No remote hosts"}; {error, Other} -> - ?t:fail({failed_to_start_slave_node, Other}) + ct:fail({failed_to_start_slave_node, Other}) end. sender(Port, Packets, Host) -> @@ -584,17 +584,17 @@ otp_3924_receive_data(LSock, Sender, MaxDelay, Len, N) -> process_flag(priority, OP), receive {'EXIT', _, TimeoutRef} -> - test_server:fail({close_not_fast_enough,MaxDelay,N}); + ct:fail({close_not_fast_enough,MaxDelay,N}); {'EXIT', Sender, Reason} -> - test_server:fail({sender_exited, Reason}); + ct:fail({sender_exited, Reason}); {'EXIT', _Other, Reason} -> - test_server:fail({linked_process_exited, Reason}) + ct:fail({linked_process_exited, Reason}) after 0 -> case Data of {'EXIT', {A,B}} -> - test_server:fail({A,B,N}); + ct:fail({A,B,N}); {'EXIT', Failure} -> - test_server:fail(Failure); + ct:fail(Failure); _ -> Data end @@ -666,7 +666,7 @@ data_before_close(Config) when is_list(Config) -> io:format("Result: ~p", [Result]); {Wrong, Result} -> io:format("Result: ~p", [Result]), - test_server:fail({wrong_count, Wrong}) + ct:fail({wrong_count, Wrong}) end, ok. @@ -758,7 +758,7 @@ all_equal(_, [_ | _]) -> ?t:sleep(?RECOVER_SLEEP), % Wait a while and *hope* that we'll % recover so other tests won't be % affected. - ?t:fail(max_socket_mismatch); + ct:fail(max_socket_mismatch); all_equal(_Rule, []) -> ok. @@ -814,7 +814,7 @@ passive_sockets(Config) when is_list(Config) -> {ok, Sock} -> passive_sockets_read(Sock); Error -> - ?t:fail({"Could not connect to server", Error}) + ct:fail({"Could not connect to server", Error}) end. %% @@ -830,7 +830,7 @@ passive_sockets_read(Sock) -> gen_tcp:close(Sock); Error -> gen_tcp:close(Sock), - ?t:fail({"Did not get {error, closed} before other error", Error}) + ct:fail({"Did not get {error, closed} before other error", Error}) end. passive_sockets_server(Opts, Parent) -> @@ -840,7 +840,7 @@ passive_sockets_server(Opts, Parent) -> Parent ! {socket,Port}, passive_sockets_server_accept(LSock); Error -> - ?t:fail({"Could not create listen socket", Error}) + ct:fail({"Could not create listen socket", Error}) end. passive_sockets_server_accept(Sock) -> @@ -850,7 +850,7 @@ passive_sockets_server_accept(Sock) -> passive_sockets_server_send(Socket, 5), passive_sockets_server_accept(Sock); Error -> - ?t:fail({"Could not accept connection", Error}) + ct:fail({"Could not accept connection", Error}) end. passive_sockets_server_send(Socket, 0) -> @@ -863,7 +863,7 @@ passive_sockets_server_send(Socket, X) -> ?t:sleep(50), % Simulate some processing. passive_sockets_server_send(Socket, X-1); {error, _Reason} -> - ?t:fail("Failed to send data") + ct:fail("Failed to send data") end. @@ -884,7 +884,7 @@ accept_closed_by_other_process(Config) when is_list(Config) -> {Child, {error, closed}} -> ok; {Child, Other} -> - ?t:fail({"Wrong result of gen_tcp:accept", Other}) + ct:fail({"Wrong result of gen_tcp:accept", Other}) end. repeat(N, Fun) -> @@ -954,7 +954,7 @@ shutdown_common(Active) -> do_sort(P, []), receive Any -> - ?t:fail({unexpected_message,Any}) + ct:fail({unexpected_message,Any}) after 0 -> ok end. @@ -1035,7 +1035,7 @@ shutdown_pending(Config) when is_list(Config) -> io:format("~p\n", [Msg]), N = list_to_integer(Msg) - 5; Other -> - ?t:fail({unexpected,Other}) + ct:fail({unexpected,Other}) end, ok. @@ -1087,9 +1087,9 @@ show_econnreset_active(Config) when is_list(Config) -> {tcp_closed, S} -> ok; Other -> - ?t:fail({unexpected1, Other}) + ct:fail({unexpected1, Other}) after 1000 -> - ?t:fail({timeout, {server, no_tcp_closed}}) + ct:fail({timeout, {server, no_tcp_closed}}) end, %% Now test with option switched on. @@ -1108,14 +1108,14 @@ show_econnreset_active(Config) when is_list(Config) -> {tcp_closed, S1} -> ok; Other1 -> - ?t:fail({unexpected2, Other1}) + ct:fail({unexpected2, Other1}) after 1 -> - ?t:fail({timeout, {server, no_tcp_closed}}) + ct:fail({timeout, {server, no_tcp_closed}}) end; Other2 -> - ?t:fail({unexpected3, Other2}) + ct:fail({unexpected3, Other2}) after 1000 -> - ?t:fail({timeout, {server, no_tcp_error}}) + ct:fail({timeout, {server, no_tcp_error}}) end. show_econnreset_active_once(Config) when is_list(Config) -> @@ -1138,14 +1138,14 @@ show_econnreset_active_once(Config) when is_list(Config) -> {tcp_closed, S} -> ok; Other1 -> - ?t:fail({unexpected1, Other1}) + ct:fail({unexpected1, Other1}) after 1 -> - ?t:fail({timeout, {server, no_tcp_closed}}) + ct:fail({timeout, {server, no_tcp_closed}}) end; Other2 -> - ?t:fail({unexpected2, Other2}) + ct:fail({unexpected2, Other2}) after 1000 -> - ?t:fail({timeout, {server, no_tcp_error}}) + ct:fail({timeout, {server, no_tcp_error}}) end. show_econnreset_passive(Config) when is_list(Config) -> @@ -1212,7 +1212,7 @@ econnreset_after_async_send_active(Config) when is_list(Config) -> case erlang:port_info(Client, queue_size) of {queue_size, N} when N > 0 -> ok; {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) + {queue_size, 0} = T -> ct:fail(T) end, ok = gen_tcp:send(S, "Whatever"), ok = ?t:sleep(20), @@ -1225,10 +1225,10 @@ econnreset_after_async_send_active(Config) when is_list(Config) -> {tcp_closed, Client} -> ok; Other1 -> - ?t:fail({unexpected1, Other1}) + ct:fail({unexpected1, Other1}) end; Other2 -> - ?t:fail({unexpected2, Other2}) + ct:fail({unexpected2, Other2}) end, %% Now test with option switched on. @@ -1243,7 +1243,7 @@ econnreset_after_async_send_active(Config) when is_list(Config) -> case erlang:port_info(Client1, queue_size) of {queue_size, N1} when N1 > 0 -> ok; {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T1 -> ?t:fail(T1) + {queue_size, 0} = T1 -> ct:fail(T1) end, ok = gen_tcp:send(S1, "Whatever"), ok = ?t:sleep(20), @@ -1258,13 +1258,13 @@ econnreset_after_async_send_active(Config) when is_list(Config) -> {tcp_closed, Client1} -> ok; Other3 -> - ?t:fail({unexpected3, Other3}) + ct:fail({unexpected3, Other3}) end; Other4 -> - ?t:fail({unexpected4, Other4}) + ct:fail({unexpected4, Other4}) end; Other5 -> - ?t:fail({unexpected5, Other5}) + ct:fail({unexpected5, Other5}) end. econnreset_after_async_send_active_once(Config) when is_list(Config) -> @@ -1282,7 +1282,7 @@ econnreset_after_async_send_active_once(Config) when is_list(Config) -> case erlang:port_info(Client, queue_size) of {queue_size, N} when N > 0 -> ok; {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) + {queue_size, 0} = T -> ct:fail(T) end, ok = gen_tcp:send(S, "Whatever"), ok = ?t:sleep(20), @@ -1297,10 +1297,10 @@ econnreset_after_async_send_active_once(Config) when is_list(Config) -> {tcp_closed, Client} -> ok; Other -> - ?t:fail({unexpected1, Other}) + ct:fail({unexpected1, Other}) end; Other -> - ?t:fail({unexpected2, Other}) + ct:fail({unexpected2, Other}) end. econnreset_after_async_send_passive(Config) when is_list(Config) -> @@ -1321,7 +1321,7 @@ econnreset_after_async_send_passive(Config) when is_list(Config) -> case erlang:port_info(Client, queue_size) of {queue_size, N} when N > 0 -> ok; {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) + {queue_size, 0} = T -> ct:fail(T) end, ok = gen_tcp:close(S), ok = ?t:sleep(20), @@ -1367,7 +1367,7 @@ linger_zero(Config) when is_list(Config) -> case erlang:port_info(Client, queue_size) of {queue_size, N} when N > 0 -> ok; {queue_size, 0} when OS =:= win32 -> ok; - {queue_size, 0} = T -> ?t:fail(T) + {queue_size, 0} = T -> ct:fail(T) end, ok = inet:setopts(Client, [{linger, {true, 0}}]), ok = gen_tcp:close(Client), @@ -1446,7 +1446,7 @@ busy_send_loop(Server, Client, N) -> busy_send_2(Server, Client, N+1) after 10000 -> %% If this happens, see busy_send_srv - ?t:fail({timeout,{server,not_send,flush([])}}) + ct:fail({timeout,{server,not_send,flush([])}}) end end. @@ -1457,7 +1457,7 @@ busy_send_2(Server, Client, _N) -> {Server,[closed]} -> receive {Client,[0,{error,closed}]} -> ok end after 10000 -> - ?t:fail({timeout,{server,not_closed,flush([])}}) + ct:fail({timeout,{server,not_closed,flush([])}}) end. busy_send_srv(L, Master, Msg) -> @@ -1547,7 +1547,7 @@ busy_disconnect_active_send(S, Data) -> {error,closed} -> receive {tcp_closed,S} -> ok; - _Other -> ?t:fail() + _Other -> ct:fail(failed) end end. @@ -1626,7 +1626,7 @@ fill_sendq_loop(Server, Client, Reader) -> ("Got reader closed.~n"), ok after 3000 -> - ?t:fail({timeout,{closed,reader}}) + ct:fail({timeout,{closed,reader}}) end; {Reader,[{error,closed}]} -> io:format("Got reader closed.~n"), @@ -1634,10 +1634,10 @@ fill_sendq_loop(Server, Client, Reader) -> io:format("Got server closed~n"), ok after 3000 -> - ?t:fail({timeout,{closed,server}}) + ct:fail({timeout,{closed,server}}) end after 3000 -> - ?t:fail({timeout,{closed,[server,reader]}}) + ct:fail({timeout,{closed,[server,reader]}}) end end. @@ -1845,7 +1845,7 @@ test_prio_accept_async() -> spawn(?MODULE,priority_server,[{self(),Ref}]), Port = receive {Ref,P} -> P - after 5000 -> ?t:fail({error,"helper process timeout"}) + after 5000 -> ct:fail({error,"helper process timeout"}) end, receive after 3000 -> ok @@ -1859,15 +1859,15 @@ test_prio_accept_async() -> {Ref,{ok,[{priority,4},{tos,Tos1}]}} -> ok; {Ref,Error} -> - ?t:fail({missmatch,Error}) - after 5000 -> ?t:fail({error,"helper process timeout"}) + ct:fail({missmatch,Error}) + after 5000 -> ct:fail({error,"helper process timeout"}) end, receive {Ref,{ok,[{priority,4},{tos,Tos1}]}} -> ok; {Ref,Error2} -> - ?t:fail({missmatch,Error2}) - after 5000 -> ?t:fail({error,"helper process timeout"}) + ct:fail({missmatch,Error2}) + after 5000 -> ct:fail({error,"helper process timeout"}) end, {ok,[{priority,4},{tos,Tos2}]} = inet:getopts(Sock2,[priority,tos]), @@ -1927,7 +1927,7 @@ so_priority(Config) when is_list(Config) -> {unix,linux} -> case os:version() of {X,Y,_} when (X > 2) or ((X =:= 2) and (Y >= 4)) -> - ?t:fail({error, + ct:fail({error, "so_priority should work on this " "OS, but does not"}); _ -> @@ -2716,7 +2716,7 @@ otp_7731(Config) when is_list(Config) -> %% Now make sure inet_drv does not leak any internal messages. receive Msg -> - test_server:fail({unexpected, Msg}) + ct:fail({unexpected, Msg}) after 1000 -> ok end, diff --git a/lib/kernel/test/gen_udp_SUITE.erl b/lib/kernel/test/gen_udp_SUITE.erl index 0e054b9135..b3925cd83c 100644 --- a/lib/kernel/test/gen_udp_SUITE.erl +++ b/lib/kernel/test/gen_udp_SUITE.erl @@ -167,7 +167,7 @@ buffer_size_client(Server, IP, Port, true -> ok; false -> ?line - ?t:fail({reply_mismatch,Cnt,Reply,Replies, + ct:fail({reply_mismatch,Cnt,Reply,Replies, byte_size(B), inet:getopts(Socket, [sndbuf,recbuf])}) @@ -418,7 +418,7 @@ read_packets_verify(R, SP, [Msg|Msgs], read_packets_verify(_R, _SP, [], [], M) -> push(M, []); read_packets_verify(_R, _SP, Msgs, Trace, M) -> - ?t:fail({read_packets_verify,mismatch,Msgs,Trace,M}). + ct:fail({read_packets_verify,mismatch,Msgs,Trace,M}). push(0, Vs) -> Vs; @@ -457,10 +457,10 @@ open_fd(Config) when is_list(Config) -> {udp,S3,Addr,P2,Msg} -> ok after 1000 -> - ?t:fail(io_lib:format("~w", [flush()])) + ct:fail(io_lib:format("~w", [flush()])) end after 1000 -> - ?t:fail(io_lib:format("~w", [flush()])) + ct:fail(io_lib:format("~w", [flush()])) end. active_n(Config) when is_list(Config) -> diff --git a/lib/kernel/test/global_SUITE.erl b/lib/kernel/test/global_SUITE.erl index 49ac088cd8..2a5e10f00a 100644 --- a/lib/kernel/test/global_SUITE.erl +++ b/lib/kernel/test/global_SUITE.erl @@ -173,7 +173,7 @@ register_1(Config) when is_list(Config) -> I =:= I2 -> ok; true -> - test_server:fail({notsync, I, I2}) + ct:fail({notsync, I, I2}) end, ?line _ = global:unregister_name(foo), write_high_level_trace(Config), @@ -477,14 +477,14 @@ names(Config) when is_list(Config) -> receive {pong, Cp3} -> ok after - 2000 -> test_server:fail(timeout1) + 2000 -> ct:fail(timeout1) end, rpc:call(Cp1, global, send, [test, {ping, self()}]), receive {pong, Cp3} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line _ = global:unregister_name(test), @@ -582,14 +582,14 @@ names_hidden(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout1) + 2000 -> ct:fail(timeout1) end, rpc:call(Cp1, global, send, [test, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line _ = rpc:call(Cp3, global, unregister_name, [test]), @@ -650,7 +650,7 @@ locks(Config) when is_list(Config) -> Pid2 ! {set_lock_loop, test_lock, self()}, % make sure we don't have the msg receive - {got_lock, Pid2} -> test_server:fail(got_lock) + {got_lock, Pid2} -> ct:fail(got_lock) after 1000 -> ok end, @@ -661,7 +661,7 @@ locks(Config) when is_list(Config) -> after % 12000 >> 5000, which is the max time before a new retry for % set_lock - 12000 -> test_server:fail(got_lock2) + 12000 -> ct:fail(got_lock2) end, % let proc set the same lock @@ -772,7 +772,7 @@ locks_hidden(Config) when is_list(Config) -> Pid2 ! {set_lock_loop, test_lock, self()}, % make sure we don't have the msg receive - {got_lock, Pid2} -> test_server:fail(got_lock) + {got_lock, Pid2} -> ct:fail(got_lock) after 1000 -> ok end, @@ -783,7 +783,7 @@ locks_hidden(Config) when is_list(Config) -> after % 12000 >> 5000, which is the max time before a new retry for % set_lock - 12000 -> test_server:fail(got_lock2) + 12000 -> ct:fail(got_lock2) end, ?line true = req(HPid, {del_lock_sync, test_lock, self()}), @@ -1291,7 +1291,7 @@ stress_partition(Config) when is_list(Config) -> receive {nodedown, Cp5} -> ok after - 20000 -> test_server:fail({no_nodedown, Cp5}) + 20000 -> ct:fail({no_nodedown, Cp5}) end, monitor_node(Cp5, false), @@ -1973,7 +1973,7 @@ otp_6931(Config) when is_list(Config) -> ?line {global_name_server,CAf} ! {nodeup, fake_node}, timer:sleep(100), stop_node(CAf), - receive {nodeup,fake_node} -> test_server:fail({info_report, was, sent}) + receive {nodeup,fake_node} -> ct:fail({info_report, was, sent}) after 1000 -> ok end, ok. @@ -2352,7 +2352,7 @@ res({Res,Resolver}, [N1, A2, Z2], Cf) -> _ -> ?t:format("ERROR:~nMonitoredBy ~p~n" "global_name_servers ~p~n", [MonitoredByNode, Gs]), - ?t:fail(monitor_mismatch) + ct:fail(monitor_mismatch) end, ok. @@ -3254,7 +3254,7 @@ global_groups_change(Config) -> Info1ok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", Cp1}, {Info1, Info1ok}}) end, @@ -3262,7 +3262,7 @@ global_groups_change(Config) -> Info2ok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", Cp2}, {Info2, Info2ok}}) end, @@ -3270,7 +3270,7 @@ global_groups_change(Config) -> Info3ok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", Cp3}, {Info3, Info3ok}}) end, @@ -3278,7 +3278,7 @@ global_groups_change(Config) -> InfoAok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", CpA}, {InfoA, InfoAok}}) end, @@ -3286,7 +3286,7 @@ global_groups_change(Config) -> InfoBok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", CpB}, {InfoB, InfoBok}}) end, @@ -3295,7 +3295,7 @@ global_groups_change(Config) -> InfoCok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", CpC}, {InfoC, InfoCok}}) end, @@ -3303,7 +3303,7 @@ global_groups_change(Config) -> InfoDok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", CpD}, {InfoD, InfoDok}}) end, @@ -3311,7 +3311,7 @@ global_groups_change(Config) -> InfoEok -> ok; _ -> - test_server:fail({{"could not change the global groups" + ct:fail({{"could not change the global groups" " in node", CpE}, {InfoE, InfoEok}}) end, @@ -3928,7 +3928,7 @@ lost_nodes_waiter(N1, N2) -> receive {nodedown, Node} when Node =:= N1 ; Node =:= N2 -> io:format("~p went down!",[Node]), - ?line ?t:fail("Node went down.") + ct:fail("Node went down.") after 10000 -> ok end, @@ -4265,7 +4265,7 @@ start_tracer() -> Pid = spawn(fun() -> tracer([]) end), case catch register(my_tracer, Pid) of {'EXIT', _} -> - ?t:fail(re_register_my_tracer); + ct:fail(re_register_my_tracer); _ -> ok end. @@ -4306,7 +4306,7 @@ collect_tracers(Nodes) -> trace_message(M) -> case catch my_tracer ! M of {'EXIT', _} -> - ?t:fail(my_tracer_not_registered); + ct:fail(my_tracer_not_registered); _ -> ok end. diff --git a/lib/kernel/test/global_group_SUITE.erl b/lib/kernel/test/global_group_SUITE.erl index 7d01a446eb..87a4aa63f8 100644 --- a/lib/kernel/test/global_group_SUITE.erl +++ b/lib/kernel/test/global_group_SUITE.erl @@ -203,19 +203,19 @@ no_gg_proc(Config) when is_list(Config) -> ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout3) + 2000 -> ct:fail(timeout3) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout4) + 2000 -> ct:fail(timeout4) end, @@ -375,19 +375,19 @@ no_gg_proc_sync(Config) when is_list(Config) -> ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout3) + 2000 -> ct:fail(timeout3) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout4) + 2000 -> ct:fail(timeout4) end, @@ -546,19 +546,19 @@ compatible(Config) when is_list(Config) -> ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout3) + 2000 -> ct:fail(timeout3) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [test2, {ping, self()}]), ?line receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout4) + 2000 -> ct:fail(timeout4) end, @@ -684,14 +684,14 @@ one_grp(Config) when is_list(Config) -> receive {pong, Cp3} -> ok after - 2000 -> test_server:fail(timeout1) + 2000 -> ct:fail(timeout1) end, rpc:call(Cp3, global, send, [test, {ping, self()}]), receive {pong, Cp3} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line rpc:call(Cp3, global, unregister_name, [test]), @@ -902,38 +902,38 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp2, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cp3, global_group, send, [test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpx, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpy, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpz, global_group, send, [test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpx, global_group, send, [{node, Cp1nn}, test2, @@ -941,21 +941,21 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpy, global_group, send, [{node, Cp2nn}, test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpz, global_group, send, [{node, Cp3nn}, test2, {ping, self()}]), receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpx, global_group, send, [{node, Cpznn}, test, @@ -963,21 +963,21 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpy, global_group, send, [{node, Cpxnn}, test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpz, global_group, send, [{node, Cpynn}, test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line Pid2 = rpc:call(Cpx, global_group, send, [{group, nc1}, test2, @@ -985,14 +985,14 @@ two_grp(Config) when is_list(Config) -> receive {pong, Cp2} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, ?line PidX = rpc:call(Cpy, global_group, send, [{group, nc2}, test, {ping, self()}]), receive {pong, Cpx} -> ok after - 2000 -> test_server:fail(timeout2) + 2000 -> ct:fail(timeout2) end, %%------------------------------------ @@ -1410,9 +1410,9 @@ assert_loop(Cp, CpName, Name, NamePid, Loop) -> Loop -> ok; Other1 -> - test_server:fail(Other1) + ct:fail(Other1) after 5000 -> - test_server:fail(timeout) + ct:fail(timeout) end. loop_until_true(Fun) -> diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl index 1715566fac..6eb77a673f 100644 --- a/lib/kernel/test/heart_SUITE.erl +++ b/lib/kernel/test/heart_SUITE.erl @@ -113,7 +113,7 @@ start_check(Type, Name, Envs) -> Pid when is_pid(Pid) -> ok; _ -> - test_server:fail(heart_not_started) + ct:fail(heart_not_started) end, {ok, Node}. @@ -124,14 +124,14 @@ start(Config) when is_list(Config) -> rpc:call(Node, init, reboot, []), receive {nodedown, Node} -> ok - after 2000 -> test_server:fail(node_not_closed) + after 2000 -> ct:fail(node_not_closed) end, test_server:sleep(5000), case net_adm:ping(Node) of pang -> ok; _ -> - test_server:fail(node_rebooted) + ct:fail(node_rebooted) end, test_server:stop_node(Node). @@ -159,7 +159,7 @@ restart(Config) when is_list(Config) -> {nodedown, Node} -> ok after 2000 -> - test_server:fail(node_not_closed) + ct:fail(node_not_closed) end, test_server:sleep(5000), node_check_up_down(Node, 2000), @@ -181,7 +181,7 @@ reboot(Config) when is_list(Config) -> {nodedown, Node} -> ok after 2000 -> - test_server:fail(node_not_closed) + ct:fail(node_not_closed) end, test_server:sleep(5000), node_check_up_down(Node, 2000), @@ -232,7 +232,7 @@ node_start_immediately_after_crash_test(Config) when is_list(Config) -> ok %% timeout is very liberal here. nodedown is received in about 1 s. on linux (palantir) %% and in about 10 s. on solaris (carcharoth) - after (15000*test_server:timetrap_scale_factor()) -> test_server:fail(node_not_closed) + after (15000*test_server:timetrap_scale_factor()) -> ct:fail(node_not_closed) end, test_server:sleep(3000), node_check_up_down(Node, 2000), @@ -277,7 +277,7 @@ node_start_soon_after_crash_test(Config) when is_list(Config) -> rpc:cast(Node, Mod, do, []), receive {nodedown, Node} -> ok - after (15000*test_server:timetrap_scale_factor()) -> test_server:fail(node_not_closed) + after (15000*test_server:timetrap_scale_factor()) -> ct:fail(node_not_closed) end, test_server:sleep(20000), node_check_up_down(Node, 15000), @@ -292,10 +292,10 @@ node_check_up_down(Node, Tmo) -> receive {nodedown, Node} -> ok after Tmo -> - test_server:fail(node_not_closed2) + ct:fail(node_not_closed2) end; _ -> - test_server:fail(node_not_rebooted) + ct:fail(node_not_rebooted) end. %% Only tests bad command, correct behaviour is tested in reboot/1. @@ -324,14 +324,14 @@ clear_cmd(Config) when is_list(Config) -> {nodedown, Node} -> ok after 2000 -> - test_server:fail(node_not_closed) + ct:fail(node_not_closed) end, test_server:sleep(5000), case net_adm:ping(Node) of pong -> erlang:monitor_node(Node, true); _ -> - test_server:fail(node_not_rebooted) + ct:fail(node_not_rebooted) end, ok = rpc:call(Node, heart, set_cmd, ["erl -noshell -heart " ++ name(Node) ++ "&"]), @@ -341,14 +341,14 @@ clear_cmd(Config) when is_list(Config) -> {nodedown, Node} -> ok after 2000 -> - test_server:fail(node_not_closed) + ct:fail(node_not_closed) end, test_server:sleep(5000), case net_adm:ping(Node) of pang -> ok; _ -> - test_server:fail(node_rebooted) + ct:fail(node_rebooted) end, ok. @@ -390,7 +390,7 @@ callback_api(Config) when is_list(Config) -> {ok, {M2,F2}} = rpc:call(Node, heart, get_callback, []), ok = rpc:call(Node, heart, set_callback, [M2,F3]), receive {nodedown, Node} -> ok - after 5000 -> test_server:fail(node_not_killed) + after 5000 -> ct:fail(node_not_killed) end, stop_node(Node), ok. diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl index 5834c990d5..5b238095b4 100644 --- a/lib/kernel/test/inet_SUITE.erl +++ b/lib/kernel/test/inet_SUITE.erl @@ -284,7 +284,7 @@ check_elem(Val, [Val|_], _) -> ok; check_elem(Val, [_|Tests], Tests0) -> check_elem(Val, Tests, Tests0); check_elem(Val, [], Tests0) -> - ?t:fail({no_match,Val,Tests0}). + ct:fail({no_match,Val,Tests0}). t_getaddr() -> required(v4). @@ -359,7 +359,7 @@ ipv4_to_ipv6(Config) when is_list(Config) -> io:format("IPv6->IPv4: eafnosupport~n"), E; Other -> - ?line ?t:fail({ipv4_to_ipv6_lookup_failed,Other}) + ct:fail({ipv4_to_ipv6_lookup_failed,Other}) end, ?line case {IP4to6Res,inet:gethostbyname(IPStr, inet6)} of {true,{ok,HEnt}} -> @@ -899,7 +899,7 @@ control_loop_1(Op, Interval, Tag, Lookupers) -> _ -> ?line io:format("Lookuper ~p died: ~p", [Pid,Reason]), - ?line test_server:fail("Lookuper died") + ct:fail("Lookuper died") end after Interval -> ?line if Op =/= undefined -> @@ -971,7 +971,7 @@ do_getif(Osname) -> end, [], Interfaces)), ?line io:format("HWAs = ~p~n", [HWAs]), ?line (Osname =/= sunos) - andalso ((length(HWAs) > 0) orelse (?t:fail(no_HWAs))), + andalso ((length(HWAs) > 0) orelse (ct:fail(no_HWAs))), ?line Addresses = lists:sort( lists:foldl( @@ -1022,7 +1022,7 @@ getifaddrs(Config) when is_list (Config) -> lists:keymember(hwaddr, 1, Opts)]} of {{unix,sunos},[]} -> ok; {OT,[]} -> - ?t:fail({should_have_hwaddr,OT}); + ct:fail({should_have_hwaddr,OT}); _ -> ok end, ?line Addrs = @@ -1073,7 +1073,7 @@ check_ifopts([], #ifopts{name=If,flags=Flags,addrs=Raddrs}=Ifopts) -> %% See how we did... if is_list(Flags) -> ok; true -> - ?t:fail({flags_undefined,If}) + ct:fail({flags_undefined,If}) end, case lists:member(broadcast, Flags) of true -> @@ -1081,12 +1081,12 @@ check_ifopts([], #ifopts{name=If,flags=Flags,addrs=Raddrs}=Ifopts) -> {_,_,_} -> A; {T,_} when tuple_size(T) =:= 8 -> A; _ -> - ?t:fail({broaddr_missing,If,A}) + ct:fail({broaddr_missing,If,A}) end || A <- Addrs]; false -> [case A of {_,_} -> A; _ -> - ?t:fail({should_have_netmask,If,A}) + ct:fail({should_have_netmask,If,A}) end || A <- Addrs] end, R; @@ -1097,7 +1097,7 @@ check_ifopts([{flags,Fs}|Opts], #ifopts{flags=Flags}=Ifopts) -> Flags -> check_ifopts(Opts, Ifopts#ifopts{}); _ -> - ?t:fail({multiple_flags,Fs,Ifopts}) + ct:fail({multiple_flags,Fs,Ifopts}) end; check_ifopts( [{addr,Addr},{netmask,Netmask},{broadaddr,Broadaddr}|Opts], @@ -1113,7 +1113,7 @@ check_ifopts([{hwaddr,Hwaddr}|Opts], #ifopts{hwaddr=undefined}=Ifopts) when is_list(Hwaddr) -> check_ifopts(Opts, Ifopts#ifopts{hwaddr=Hwaddr}); check_ifopts([{hwaddr,HwAddr}|_], #ifopts{}=Ifopts) -> - ?t:fail({multiple_hwaddrs,HwAddr,Ifopts}). + ct:fail({multiple_hwaddrs,HwAddr,Ifopts}). %% Works just like lists:member/2, except that any {127,_,_,_} tuple %% matches any other {127,_,_,_}. We do this to handle Linux systems diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl index c7e6d9bbbd..926bf525c7 100644 --- a/lib/kernel/test/init_SUITE.erl +++ b/lib/kernel/test/init_SUITE.erl @@ -100,7 +100,7 @@ get_arguments(Config) when is_list(Config) -> check_d(Arguments); _ -> stop_node(Node), - ?t:fail(get_arguments) + ct:fail(get_arguments) end, ok. @@ -112,10 +112,10 @@ check_a(Args) -> false -> ok; _ -> - ?t:fail(check_a1) + ct:fail(check_a1) end; _ -> - ?t:fail(check_a2) + ct:fail(check_a2) end. check_b(Args) -> @@ -129,13 +129,13 @@ check_b(Args) -> false -> ok; _ -> - ?t:fail(check_b1) + ct:fail(check_b1) end; _ -> - ?t:fail(check_b2) + ct:fail(check_b2) end; _ -> - ?t:fail(check_b3) + ct:fail(check_b3) end. check_c(Args) -> @@ -149,13 +149,13 @@ check_c(Args) -> false -> ok; _ -> - ?t:fail(check_c1) + ct:fail(check_c1) end; _ -> - ?t:fail(check_c2) + ct:fail(check_c2) end; _ -> - ?t:fail(check_c3) + ct:fail(check_c3) end. check_d(Args) -> @@ -166,10 +166,10 @@ check_d(Args) -> false -> ok; _ -> - ?t:fail(check_d1) + ct:fail(check_d1) end; _ -> - ?t:fail(check_d2) + ct:fail(check_d2) end. get_argument(doc) ->[]; @@ -182,35 +182,35 @@ get_argument(Config) when is_list(Config) -> ok; _ -> stop_node(Node), - ?t:fail({get_argument, b}) + ct:fail({get_argument, b}) end, ?line case rpc:call(Node, init, get_argument, [a]) of {ok, [["kalle"]]} -> ok; _ -> stop_node(Node), - ?t:fail({get_argument, a}) + ct:fail({get_argument, a}) end, ?line case rpc:call(Node, init, get_argument, [c]) of {ok, [["4", "5", "6"], ["7", "8", "9"]]} -> ok; _ -> stop_node(Node), - ?t:fail({get_argument, c}) + ct:fail({get_argument, c}) end, ?line case rpc:call(Node, init, get_argument, [d]) of {ok, [[]]} -> ok; _ -> stop_node(Node), - ?t:fail({get_argument, d}) + ct:fail({get_argument, d}) end, ?line case rpc:call(Node, init, get_argument, [e]) of error -> ok; _ -> stop_node(Node), - ?t:fail({get_argument, e}) + ct:fail({get_argument, e}) end, stop_node(Node), ok. @@ -236,7 +236,7 @@ get_plain_arguments(Config) when is_list(Config) -> ok; As -> stop_node(Node), - ?t:fail({get_argument, As}) + ct:fail({get_argument, As}) end, stop_node(Node), @@ -332,7 +332,7 @@ loop_restart(N,Node,EHPid) -> ok after 10000 -> loose_node:stop(Node), - ?t:fail(not_stopping) + ct:fail(not_stopping) end, ?line ok = wait_for(30, Node, EHPid), ?line loop_restart(N-1,Node,rpc:call(Node,erlang,whereis,[error_logger])). @@ -399,7 +399,7 @@ restart(Config) when is_list(Config) -> ok after 10000 -> loose_node:stop(Node), - ?t:fail(not_stopping) + ct:fail(not_stopping) end, ?line ok = wait_restart(30, Node), @@ -420,7 +420,7 @@ restart(Config) when is_list(Config) -> ok; _ -> loose_node:stop(Node), - ?t:fail(processes_not_greater) + ct:fail(processes_not_greater) end, %% Test that, for instance, the same argument still exists. @@ -429,13 +429,13 @@ restart(Config) when is_list(Config) -> ok; _ -> loose_node:stop(Node), - ?t:fail({get_argument, restart_fail}) + ct:fail({get_argument, restart_fail}) end, loose_node:stop(Node), ok. wait_restart(0, _Node) -> - ?t:fail(not_restarted); + ct:fail(not_restarted); wait_restart(N, Node) -> case net_adm:ping(Node) of pong -> ok; @@ -480,7 +480,7 @@ reboot(Config) when is_list(Config) -> ok after 10000 -> stop_node(Node), - ?t:fail(not_stopping) + ct:fail(not_stopping) end, ?t:sleep(5000), ?line case net_adm:ping(Node) of @@ -488,7 +488,7 @@ reboot(Config) when is_list(Config) -> ok; _ -> stop_node(Node), - ?t:fail(system_rebooted) + ct:fail(system_rebooted) end, ok. @@ -507,7 +507,7 @@ stop(Config) when is_list(Config) -> ok after 10000 -> stop_node(Node), - ?t:fail(not_stopping) + ct:fail(not_stopping) end, ?t:sleep(5000), ?line case net_adm:ping(Node) of @@ -515,7 +515,7 @@ stop(Config) when is_list(Config) -> ok; _ -> stop_node(Node), - ?t:fail(system_rebooted) + ct:fail(system_rebooted) end, ok. @@ -534,7 +534,7 @@ get_status(Config) when is_list(Config) -> true -> ok; _ -> - ?t:fail(get_status) + ct:fail(get_status) end. %% ------------------------------------------------ @@ -548,7 +548,7 @@ script_id(Config) when is_list(Config) -> is_list(Name), is_list(Vsn) -> ok; true -> - ?t:fail(not_standard_script) + ct:fail(not_standard_script) end, ok. diff --git a/lib/kernel/test/kernel_config_SUITE.erl b/lib/kernel/test/kernel_config_SUITE.erl index 11c9fb7d76..78c3b9097b 100644 --- a/lib/kernel/test/kernel_config_SUITE.erl +++ b/lib/kernel/test/kernel_config_SUITE.erl @@ -100,7 +100,7 @@ sync(Conf) when is_list(Conf) -> io:format("~p~n", [{t2, {TT, T}}]), ?line stop_node(cp1), if - TT-T1 < 15000 -> ?line ?t:fail({too_short_time, TT-T1}); + TT-T1 < 15000 -> ct:fail({too_short_time, TT-T1}); true -> ok end, ok. @@ -108,7 +108,7 @@ sync(Conf) when is_list(Conf) -> wait_for_node(Node) -> case rpc:call(Node, init, get_status, []) of {started,_} -> ok; - {badrpc, R} -> ?line ?t:fail({rpc_failed, R}); + {badrpc, R} -> ct:fail({rpc_failed, R}); _Other -> wait_for_node(Node) end. diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl index 271ce80807..2121b2a447 100644 --- a/lib/kernel/test/os_SUITE.erl +++ b/lib/kernel/test/os_SUITE.erl @@ -81,7 +81,7 @@ space_in_cwd(Config) when is_list(Config) -> [] -> ok; % Unix. "\r\n" -> ok; % Windows. Other -> - ?line test_server:fail({unexpected, Other}) + ct:fail({unexpected, Other}) end, ?t:sleep(5), @@ -243,11 +243,11 @@ find_exe(Where, Name, Ext, Path) -> Other -> io:format("Expected ~p; got (converted to absolute) ~p", [Expected, Other]), - test_server:fail() + ct:fail(failed) end; Other -> io:format("Expected ~p; got ~p", [Expected, Other]), - test_server:fail() + ct:fail(failed) end. unix_comment_in_command(doc) -> @@ -325,7 +325,7 @@ comp(Expected, Got) -> Other -> ok = io:format("Expected: ~ts\n", [Expected]), ok = io:format("Got: ~ts\n", [Other]), - test_server:fail() + ct:fail(failed) end. %% Like lib:nonl/1, but strips \r as well as \n. diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl index ee8d5fc928..05da66e6a6 100644 --- a/lib/kernel/test/prim_file_SUITE.erl +++ b/lib/kernel/test/prim_file_SUITE.erl @@ -546,7 +546,7 @@ access(Config) when is_list(Config) -> ?line {ok,Fd2} = ?PRIM_FILE:open(Name, [read]), ?line case catch ?PRIM_FILE:write(Fd2,"XXXX") of ok -> - test_server:fail({access,write}); + ct:fail({access,write}); _ -> ok end, @@ -1833,7 +1833,7 @@ write_compressed(Config) when is_list(Config) -> {ok, #file_info{size=Size}} when Size < TotalSize -> ok; {ok, #file_info{size=Size}} when Size == TotalSize -> - test_server:fail(file_not_compressed) + ct:fail(file_not_compressed) end, %% Write again to ensure that the file is truncated. diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl index ee75c49d16..8a7de22f45 100644 --- a/lib/kernel/test/seq_trace_SUITE.erl +++ b/lib/kernel/test/seq_trace_SUITE.erl @@ -265,7 +265,7 @@ do_trace_exit(TsType) -> seq_trace:set_token([]); Other -> seq_trace:set_token([]), - ?t:fail({received, Other}) + ct:fail({received, Other}) end, ?line Self = self(), ?line Result = stop_tracer(2), @@ -299,7 +299,7 @@ do_distributed_exit(TsType) -> seq_trace:set_token([]); Other -> seq_trace:set_token([]), - ?t:fail({received, Other}) + ct:fail({received, Other}) end, ?line Self = self(), ?line Result = rpc:call(Node, ?MODULE, stop_tracer, [1]), @@ -424,7 +424,7 @@ do_port(TsType, Config) -> ok; Other -> ?line seq_trace:reset_trace(), - ?line ?t:fail({unexpected,Other}) + ct:fail({unexpected,Other}) end, %% OTP-4218 Messages from ports should not affect seq trace token. %% @@ -440,7 +440,7 @@ do_port(TsType, Config) -> check_ts(TsType, Ts1), ok; Other1 -> - ?line ?t:fail({unexpected,Other1}) + ct:fail({unexpected,Other1}) end, @@ -452,7 +452,7 @@ do_port(TsType, Config) -> {seq_trace,0,{print,_,_,[],Huge}} -> ok; Other2 -> - ?line ?t:fail({unexpected,Other2}) + ct:fail({unexpected,Other2}) end, unlink(Port), exit(Port,kill), @@ -463,9 +463,9 @@ get_port_message(Port) -> {Port,{data,Bin}} when is_binary(Bin) -> binary_to_term(Bin); Other -> - ?t:fail({unexpected,Other}) + ct:fail({unexpected,Other}) after 5000 -> - ?t:fail(timeout) + ct:fail(timeout) end. @@ -831,7 +831,7 @@ check_ts(no_timestamp, Ts) -> no_timestamp = Ts catch _ : _ -> - ?t:fail({unexpected_timestamp, Ts}) + ct:fail({unexpected_timestamp, Ts}) end, ok; check_ts(timestamp, Ts) -> @@ -842,7 +842,7 @@ check_ts(timestamp, Ts) -> true = is_integer(Us) catch _ : _ -> - ?t:fail({unexpected_timestamp, Ts}) + ct:fail({unexpected_timestamp, Ts}) end, ok; check_ts(monotonic_timestamp, Ts) -> @@ -850,7 +850,7 @@ check_ts(monotonic_timestamp, Ts) -> true = is_integer(Ts) catch _ : _ -> - ?t:fail({unexpected_timestamp, Ts}) + ct:fail({unexpected_timestamp, Ts}) end, ok; check_ts(strict_monotonic_timestamp, Ts) -> @@ -860,7 +860,7 @@ check_ts(strict_monotonic_timestamp, Ts) -> true = is_integer(UMI) catch _ : _ -> - ?t:fail({unexpected_timestamp, Ts}) + ct:fail({unexpected_timestamp, Ts}) end, ok. diff --git a/lib/kernel/test/wrap_log_reader_SUITE.erl b/lib/kernel/test/wrap_log_reader_SUITE.erl index 31fe91f372..40b11ba0c7 100644 --- a/lib/kernel/test/wrap_log_reader_SUITE.erl +++ b/lib/kernel/test/wrap_log_reader_SUITE.erl @@ -542,23 +542,23 @@ blog_terms(File, Terms) -> rec1(M, Where) -> receive {M, C} -> C; - Else -> test_server:fail({error, {Where, Else}}) - after 1000 -> test_server:fail({error, {Where, time_out}}) + Else -> ct:fail({error, {Where, Else}}) + after 1000 -> ct:fail({error, {Where, time_out}}) end. rec2(M, Where) -> receive {C, M} -> C; - Else -> test_server:fail({error, {Where, Else}}) - after 1000 -> test_server:fail({error, {Where, time_out}}) + Else -> ct:fail({error, {Where, Else}}) + after 1000 -> ct:fail({error, {Where, time_out}}) end. rec(M, Where) -> receive M -> ok; - Else -> ?t:fail({error, {Where, Else}}) - after 5000 -> ?t:fail({error, {Where, time_out}}) + Else -> ct:fail({error, {Where, Else}}) + after 5000 -> ct:fail({error, {Where, time_out}}) end. pps() -> diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl index 3b029107b9..0ef95ab176 100644 --- a/lib/kernel/test/zlib_SUITE.erl +++ b/lib/kernel/test/zlib_SUITE.erl @@ -122,7 +122,7 @@ api_open_close(Config) when is_list(Config) -> ?line Fd3 = zlib:open(), ?m(ok,zlib:close(Fd3)), receive - Any -> ?line ?t:fail({unexpected_message,Any}) + Any -> ct:fail({unexpected_message,Any}) after 10 -> ok end. -- cgit v1.2.3