From 9b6b82abfaae479849902ba60c4c54a526840a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Tue, 8 Mar 2016 21:01:40 +0100 Subject: Eliminate use of test_server:fail/0,1 --- erts/emulator/test/after_SUITE.erl | 8 +-- erts/emulator/test/alloc_SUITE.erl | 8 +-- erts/emulator/test/beam_SUITE.erl | 9 ++- erts/emulator/test/bif_SUITE.erl | 44 ++++++------ erts/emulator/test/big_SUITE.erl | 5 +- erts/emulator/test/binary_SUITE.erl | 18 +++-- erts/emulator/test/bs_construct_SUITE.erl | 13 ++-- erts/emulator/test/bs_match_int_SUITE.erl | 2 +- erts/emulator/test/bs_match_misc_SUITE.erl | 7 +- erts/emulator/test/bs_utf_SUITE.erl | 22 +++--- erts/emulator/test/busy_port_SUITE.erl | 27 ++++---- erts/emulator/test/call_trace_SUITE.erl | 41 +++++------ erts/emulator/test/code_SUITE.erl | 8 +-- erts/emulator/test/ddll_SUITE.erl | 15 ++-- erts/emulator/test/distribution_SUITE.erl | 26 +++---- erts/emulator/test/driver_SUITE.erl | 104 +++++++++++++--------------- erts/emulator/test/efile_SUITE.erl | 2 +- erts/emulator/test/erl_drv_thread_SUITE.erl | 9 ++- erts/emulator/test/erl_link_SUITE.erl | 10 +-- erts/emulator/test/evil_SUITE.erl | 2 +- erts/emulator/test/exception_SUITE.erl | 8 +-- erts/emulator/test/float_SUITE.erl | 2 +- erts/emulator/test/fun_SUITE.erl | 47 ++++++------- erts/emulator/test/fun_r13_SUITE.erl | 2 +- erts/emulator/test/guard_SUITE.erl | 19 ++--- erts/emulator/test/hibernate_SUITE.erl | 19 +++-- erts/emulator/test/list_bif_SUITE.erl | 22 ++---- erts/emulator/test/match_spec_SUITE.erl | 7 +- erts/emulator/test/monitor_SUITE.erl | 36 +++++----- erts/emulator/test/nested_SUITE.erl | 2 +- erts/emulator/test/nif_SUITE.erl | 32 ++++----- erts/emulator/test/node_container_SUITE.erl | 6 +- erts/emulator/test/old_scheduler_SUITE.erl | 16 ++--- erts/emulator/test/op_SUITE.erl | 2 +- erts/emulator/test/port_SUITE.erl | 103 +++++++++++++-------------- erts/emulator/test/port_bif_SUITE.erl | 39 +++++------ erts/emulator/test/process_SUITE.erl | 48 ++++++------- erts/emulator/test/receive_SUITE.erl | 3 +- erts/emulator/test/ref_SUITE.erl | 2 +- erts/emulator/test/save_calls_SUITE.erl | 2 +- erts/emulator/test/scheduler_SUITE.erl | 6 +- erts/emulator/test/send_term_SUITE.erl | 5 +- erts/emulator/test/sensitive_SUITE.erl | 2 +- erts/emulator/test/signal_SUITE.erl | 4 +- erts/emulator/test/smoke_test_SUITE.erl | 4 +- erts/emulator/test/statistics_SUITE.erl | 6 +- erts/emulator/test/system_profile_SUITE.erl | 8 +-- erts/emulator/test/time_SUITE.erl | 26 ++++--- erts/emulator/test/timer_bif_SUITE.erl | 8 +-- erts/emulator/test/trace_SUITE.erl | 24 +++---- erts/emulator/test/trace_bif_SUITE.erl | 70 ++++++++----------- erts/emulator/test/trace_local_SUITE.erl | 8 +-- erts/emulator/test/trace_meta_SUITE.erl | 8 +-- erts/emulator/test/trace_nif_SUITE.erl | 57 ++++++--------- erts/emulator/test/trace_port_SUITE.erl | 24 +++---- erts/emulator/test/tuple_SUITE.erl | 6 +- erts/emulator/test/unique_SUITE.erl | 2 +- erts/emulator/test/z_SUITE.erl | 10 +-- 58 files changed, 499 insertions(+), 576 deletions(-) diff --git a/erts/emulator/test/after_SUITE.erl b/erts/emulator/test/after_SUITE.erl index 71edaa25c3..40fd2e6500 100644 --- a/erts/emulator/test/after_SUITE.erl +++ b/erts/emulator/test/after_SUITE.erl @@ -57,9 +57,9 @@ t_after(Config) when is_list(Config) -> report(Period, Before, After) -> case erlang:convert_time_unit(After - Before, native, 100*1000) / Period of Percent when Percent > 100.10 -> - test_server:fail({too_inaccurate, Percent}); + ct:fail({too_inaccurate, Percent}); Percent when Percent < 100.0 -> - test_server:fail({too_early, Percent}); + ct:fail({too_early, Percent}); Percent -> Comment = io_lib:format("Elapsed/expected: ~.2f %", [Percent]), {comment, lists:flatten(Comment)} @@ -153,7 +153,7 @@ receive_var_zero(Config) when is_list(Config) -> receive x -> ok; Other -> - ?line ?t:fail({bad_message,Other}) + ct:fail({bad_message,Other}) end. zero() -> 0. @@ -174,7 +174,7 @@ receive_zero(Config) when is_list(Config) -> receive x -> ok; Other -> - ?line ?t:fail({bad_message,Other}) + ct:fail({bad_message,Other}) end. multi_timeout(doc) -> diff --git a/erts/emulator/test/alloc_SUITE.erl b/erts/emulator/test/alloc_SUITE.erl index 75ae687ffc..6ee2f98884 100644 --- a/erts/emulator/test/alloc_SUITE.erl +++ b/erts/emulator/test/alloc_SUITE.erl @@ -325,11 +325,11 @@ handle_result(_State, Result0) -> flush_log(), case Result0 of {'EXIT', Error} -> - ?line ?t:fail(Error); + ct:fail(Error); {'EXIT', error, Error} -> - ?line ?t:fail(Error); + ct:fail(Error); {failed, Comment} -> - ?line ?t:fail(Comment); + ct:fail(Comment); {skipped, Comment} -> ?line {skipped, Comment}; {succeeded, ""} -> @@ -378,6 +378,6 @@ free_memory() -> TotFree div (1024*1024) catch error : undef -> - ?t:fail({"os_mon not built"}) + ct:fail({"os_mon not built"}) end. diff --git a/erts/emulator/test/beam_SUITE.erl b/erts/emulator/test/beam_SUITE.erl index 499b05d658..d3180a40cf 100644 --- a/erts/emulator/test/beam_SUITE.erl +++ b/erts/emulator/test/beam_SUITE.erl @@ -61,7 +61,7 @@ apply_last(Config) when is_list(Config) -> {Pid, finished} -> stack_size(Pid) after 30000 -> - ?t:fail("applied/2 timed out.") + ct:fail("applied/2 timed out.") end, Pid ! die, ?t:format("Size: ~p~n", [Size]), @@ -69,7 +69,7 @@ apply_last(Config) when is_list(Config) -> Size < 700 -> ok; true -> - ?t:fail("10000 apply() grew stack too much.") + ct:fail("10000 apply() grew stack too much.") end, ok. @@ -132,8 +132,7 @@ verify_packed_regs([], _, -1) -> ok; verify_packed_regs([{Term, N}| T], Term, N) -> verify_packed_regs(T, Term, N-1); verify_packed_regs(L, Term, N) -> - ok = io:format("Expected [{~p, ~p}|T]; got\n~p\n", [Term, N, L]), - test_server:fail(). + ct:fail("Expected [{~p, ~p}|T]; got\n~p\n", [Term, N, L]). buildo_mucho(Config) when is_list(Config) -> buildo_mucho_1(), @@ -319,7 +318,7 @@ fconv(Config) when is_list(Config) -> do_fconv(Type) -> try do_fconv(Type, 1.0), - test_server:fail() + ct:fail(no_badarith) catch error:badarith -> ok diff --git a/erts/emulator/test/bif_SUITE.erl b/erts/emulator/test/bif_SUITE.erl index ccde904fbc..ec8c7155b5 100644 --- a/erts/emulator/test/bif_SUITE.erl +++ b/erts/emulator/test/bif_SUITE.erl @@ -93,7 +93,7 @@ erl_bif_types_2(List) -> [_|_] -> io:put_chars("Bifs with bad arity\n"), io:format("~p\n", [BadArity]), - ?line ?t:fail({length(BadArity),bad_arity}) + ?line ct:fail({length(BadArity),bad_arity}) end. erl_bif_types_3(List) -> @@ -117,7 +117,7 @@ erl_bif_types_3(List) -> io:put_chars("Bifs with failing calls to erlang_bif_types:type/3 " "(or with bogus return values):\n"), io:format("~p\n", [BadSmokeTest]), - ?line ?t:fail({length(BadSmokeTest),bad_smoke_test}) + ?line ct:fail({length(BadSmokeTest),bad_smoke_test}) end. guard_bifs_in_erl_bif_types(_Config) -> @@ -138,7 +138,7 @@ guard_bifs_in_erl_bif_types(_Config) -> "The following guard BIFs have no type information " "in erl_bif_types:\n\n", [io_lib:format(" ~p/~p\n", [F,A]) || {F,A} <- Not]]), - ?t:fail() + ct:fail(erl_bif_types) end. shadow_comments(_Config) -> @@ -178,7 +178,7 @@ shadow_comments(_Config) -> "obvious.\n\nThe following comments are missing:\n\n", [io_lib:format("%% Shadowed by erl_bif_types: ~p:~p/~p\n", [M,F,A]) || {M,F,A} <- NoComments]]), - ?t:fail() + ct:fail(bif_stub) end, case NoBifSpecs of @@ -192,7 +192,7 @@ shadow_comments(_Config) -> "Therefore, the following comments should be removed:\n\n", [io_lib:format("%% Shadowed by erl_bif_types: ~p:~p/~p\n", [M,F,A]) || {M,F,A} <- NoBifSpecs]]), - ?t:fail() + ct:fail(erl_bif_types) end. extract_comments(Mod, Path) -> @@ -214,7 +214,7 @@ ensure_erl_bif_types_compiled() -> case erlang:function_exported(erl_bif_types, module_info, 0) of false -> %% Fail cleanly. - ?t:fail("erl_bif_types not compiled"); + ct:fail("erl_bif_types not compiled"); true -> ok end. @@ -252,7 +252,7 @@ specs(_) -> [_|_] -> io:put_chars("The following BIFs don't have specs:\n"), [print_mfa(MFA) || MFA <- NoSpecs], - ?t:fail() + ct:fail(no_spec) end. is_operator({erlang,F,A}) -> @@ -312,7 +312,7 @@ auto_imports([{erlang,F,A}|T], Errors) -> auto_imports([], 0) -> ok; auto_imports([], Errors) -> - ?t:fail({Errors,inconsistencies}). + ct:fail({Errors,inconsistencies}). extract_functions(M, Abstr) -> [{{M,F,A},Body} || {function,_,F,A,Body} <- Abstr]. @@ -331,7 +331,7 @@ check_stub({_,F,A}, B) -> io:put_chars(erl_pp:function(Func)), io:nl(), io:put_chars("The body should be: erlang:nif_error(undef)"), - ?t:fail() + ct:fail(invalid_body) end. t_list_to_existing_atom(Config) when is_list(Config) -> @@ -340,7 +340,7 @@ t_list_to_existing_atom(Config) when is_list(Config) -> ?line UnlikelyStr = "dsfj923874390867er869fds9864y97jhg3973qerueoru", try ?line list_to_existing_atom(UnlikelyStr), - ?line ?t:fail() + ?line ct:fail(atom_exists) catch error:badarg -> ok end, @@ -364,7 +364,7 @@ os_env(Config) when is_list(Config) -> ?line case os:getenv(EnvVar1) of "" -> ?line ok; false -> ?line ok; - BadVal -> ?line ?t:fail(BadVal) + BadVal -> ?line ct:fail(BadVal) end, true = os:putenv(EnvVar1, "mors"), true = os:unsetenv(EnvVar1), @@ -523,14 +523,14 @@ binary_to_existing_atom(Config) when is_list(Config) -> ?line UnlikelyBin = <<"ou0897979655678dsfj923874390867er869fds973qerueoru">>, try ?line binary_to_existing_atom(UnlikelyBin, latin1), - ?line ?t:fail() + ?line ct:fail(atom_exists) catch error:badarg -> ok end, try ?line binary_to_existing_atom(UnlikelyBin, utf8), - ?line ?t:fail() + ?line ct:fail(atom_exists) catch error:badarg -> ok end, @@ -626,31 +626,31 @@ min_max(Config) when is_list(Config) -> erlang_halt(Config) when is_list(Config) -> try erlang:halt(undefined) of - _-> ?t:fail({erlang,halt,{undefined}}) + _-> ct:fail({erlang,halt,{undefined}}) catch error:badarg -> ok end, try halt(undefined) of - _-> ?t:fail({halt,{undefined}}) + _-> ct:fail({halt,{undefined}}) catch error:badarg -> ok end, try erlang:halt(undefined, []) of - _-> ?t:fail({erlang,halt,{undefined,[]}}) + _-> ct:fail({erlang,halt,{undefined,[]}}) catch error:badarg -> ok end, try halt(undefined, []) of - _-> ?t:fail({halt,{undefined,[]}}) + _-> ct:fail({halt,{undefined,[]}}) catch error:badarg -> ok end, try halt(0, undefined) of - _-> ?t:fail({halt,{0,undefined}}) + _-> ct:fail({halt,{0,undefined}}) catch error:badarg -> ok end, try halt(0, [undefined]) of - _-> ?t:fail({halt,{0,[undefined]}}) + _-> ct:fail({halt,{0,[undefined]}}) catch error:badarg -> ok end, try halt(0, [{undefined,true}]) of - _-> ?t:fail({halt,{0,[{undefined,true}]}}) + _-> ct:fail({halt,{0,[{undefined,true}]}}) catch error:badarg -> ok end, try halt(0, [{flush,undefined}]) of - _-> ?t:fail({halt,{0,[{flush,undefined}]}}) + _-> ct:fail({halt,{0,[{flush,undefined}]}}) catch error:badarg -> ok end, try halt(0, [{flush,true,undefined}]) of - _-> ?t:fail({halt,{0,[{flush,true,undefined}]}}) + _-> ct:fail({halt,{0,[{flush,true,undefined}]}}) catch error:badarg -> ok end, H = hostname(), {ok,N1} = slave:start(H, halt_node1), diff --git a/erts/emulator/test/big_SUITE.erl b/erts/emulator/test/big_SUITE.erl index 9b611a136c..37e90df60e 100644 --- a/erts/emulator/test/big_SUITE.erl +++ b/erts/emulator/test/big_SUITE.erl @@ -104,7 +104,7 @@ test(File, Nodes) -> file:close(Fd), case Res of {0,Cases} -> {comment, integer_to_list(Cases) ++ " cases"}; - {_,_} -> test_server:fail() + {_,_} -> ct:fail("failed") end. test(File, Fd, Ns) -> @@ -245,8 +245,7 @@ t_div(Config) when is_list(Config) -> {result, Result} -> 'try'(Iter-1, Fun, Result, [0|Filler]); {result, Other} -> - io:format("Expected ~p; got ~p~n", [Result, Other]), - test_server:fail() + ct:fail("Expected ~p; got ~p~n", [Result, Other]) end. init(ReplyTo, Fun, _Filler) -> diff --git a/erts/emulator/test/binary_SUITE.erl b/erts/emulator/test/binary_SUITE.erl index c5e3226a13..6ace683fe7 100644 --- a/erts/emulator/test/binary_SUITE.erl +++ b/erts/emulator/test/binary_SUITE.erl @@ -113,7 +113,7 @@ copy_terms(Config) when is_list(Config) -> Term -> ok; Other -> io:format("Sent: ~P\nGot back:~P", [Term,12,Other,12]), - ?t:fail(bad_term) + ct:fail(bad_term) end end, ?line test_terms(F), @@ -236,7 +236,7 @@ going_center(_List, _Bin, _From, _To) -> compare([X|Rest1], [X|Rest2], Left) when Left > 0 -> ?line compare(Rest1, Rest2, Left-1); compare([_X|_], [_Y|_], _Left) -> - ?line test_server:fail(); + ct:fail("compare fail"); compare(_List, [], 0) -> ok. @@ -405,8 +405,7 @@ test_hash_1(Bin, Sbin, Unaligned, Hash) when is_function(Hash, 2) -> case {Hash(Bin, N),Hash(Sbin, N),Hash(Unaligned, N)} of {H,H,H} -> ok; {H1,H2,H3} -> - io:format("Different hash values: ~p, ~p, ~p\n", [H1,H2,H3]), - ?t:fail() + ct:fail("Different hash values: ~p, ~p, ~p\n", [H1,H2,H3]) end. bad_size(doc) -> "Try bad arguments to size/1."; @@ -505,9 +504,8 @@ external_size(Config) when is_list(Config) -> case {erlang:external_size(Bin),erlang:external_size(Unaligned)} of {X,X} -> ok; {Sz1,Sz2} -> - io:format(" Aligned size: ~p\n", [Sz1]), - io:format("Unaligned size: ~p\n", [Sz2]), - ?line ?t:fail() + ct:fail(" Aligned size: ~p\n" + "Unaligned size: ~p\n", [Sz1,Sz2]) end, true = (erlang:external_size(Bin) =:= erlang:external_size(Bin, [{minor_version, 1}])), true = (erlang:external_size(Unaligned) =:= erlang:external_size(Unaligned, [{minor_version, 1}])). @@ -591,7 +589,7 @@ bad_binary_to_term_2(Config) when is_list(Config) -> {badrpc, {'EXIT', _}} -> ok; _Other -> - test_server:fail({rpcresult, R}) + ct:fail({rpcresult, R}) end, ?line test_server:stop_node(N), ok. @@ -707,7 +705,7 @@ more_bad_terms(Config) when is_list(Config) -> ?line {'EXIT',{badarg,_}} = (catch binary_to_term_stress(Bin)), ok; Other -> - ?line ?t:fail(Other) + ?line ct:fail(Other) end. otp_5484(Config) when is_list(Config) -> @@ -1217,7 +1215,7 @@ gc_test1(Pid) -> receive {Pid,done} -> ok after 10000 -> - ?line ?t:fail() + ct:fail("timeout") end. %% Like split binary, but returns REFC binaries. Only useful for gc_test/1. diff --git a/erts/emulator/test/bs_construct_SUITE.erl b/erts/emulator/test/bs_construct_SUITE.erl index 2d93bace15..42a710aaf9 100644 --- a/erts/emulator/test/bs_construct_SUITE.erl +++ b/erts/emulator/test/bs_construct_SUITE.erl @@ -175,7 +175,7 @@ one_test({C_bin, E_bin, Str, Bytes}) when is_list(Bytes) -> true -> io:format("ERROR: Compiled: ~p. Expected ~p. Got ~p.~n", [Str, Bytes, binary_to_list(C_bin)]), - test_server:fail(comp) + ct:fail(comp) end, if E_bin == Bin -> @@ -183,7 +183,7 @@ one_test({C_bin, E_bin, Str, Bytes}) when is_list(Bytes) -> true -> io:format("ERROR: Interpreted: ~p. Expected ~p. Got ~p.~n", [Str, Bytes, binary_to_list(E_bin)]), - test_server:fail(comp) + ct:fail(comp) end; one_test({C_bin, E_bin, Str, Result}) -> io:format(" ~s ~p~n", [Str, C_bin]), @@ -204,7 +204,7 @@ one_test({C_bin, E_bin, Str, Result}) -> io:format("ERROR: Compiled not equal to interpreted:" "~n ~p, ~p.~n", [binary_to_list(C_bin), binary_to_list(E_bin)]), - test_server:fail(comp); + ct:fail(comp); 0 -> ok; %% For situations where the final bits may not matter, like @@ -239,14 +239,14 @@ fail_check({'EXIT',{badarg,_}}, Str, Vars) -> try evaluate(Str, Vars) of Res -> io:format("Interpreted result: ~p", [Res]), - ?t:fail(did_not_fail_in_intepreted_code) + ct:fail(did_not_fail_in_intepreted_code) catch error:badarg -> ok end; fail_check(Res, _, _) -> io:format("Compiled result: ~p", [Res]), - ?t:fail(did_not_fail_in_compiled_code). + ct:fail(did_not_fail_in_compiled_code). %%% Simple working cases test1(suite) -> []; @@ -666,8 +666,7 @@ copy_writable_binary_1(_) -> receive {Pid,Bin0,Bin0} -> ok; Other -> - io:format("Unexpected message: ~p", [Other]), - ?line ?t:fail() + ct:fail("Unexpected message: ~p", [Other]) end, ok. diff --git a/erts/emulator/test/bs_match_int_SUITE.erl b/erts/emulator/test/bs_match_int_SUITE.erl index 48c2b4644e..6f8a5b1916 100644 --- a/erts/emulator/test/bs_match_int_SUITE.erl +++ b/erts/emulator/test/bs_match_int_SUITE.erl @@ -151,7 +151,7 @@ more_dynamic(Config) when is_list(Config) -> io:format("Bin = ~p,", [Bin]), io:format("SkipBef = ~p, N = ~p", [SkipBef,N]), io:format("Expected ~p, got ~p", [Int,Other]), - ?t:fail() + ct:fail(signed_big_endian_fail) end end, ?line more_dynamic1(Signed, erlang:md5(mkbin([43]))), diff --git a/erts/emulator/test/bs_match_misc_SUITE.erl b/erts/emulator/test/bs_match_misc_SUITE.erl index 967325842c..8979a69322 100644 --- a/erts/emulator/test/bs_match_misc_SUITE.erl +++ b/erts/emulator/test/bs_match_misc_SUITE.erl @@ -383,9 +383,9 @@ x0_2(_, Bin) -> x0_3(_, Bin) -> case Bin of <<_:72,7:8,_/binary>> -> - ?line ?t:fail(); + ct:fail(bs_matched_1); <<_:64,0:16,_/binary>> -> - ?line ?t:fail(); + ct:fail(bs_matched_2); <<_:64,42:16,123456:32,_/binary>> -> ok end. @@ -498,8 +498,7 @@ do_otp_7198(FillerSize) -> {'DOWN',Ref,process,Pid,normal} -> ok; {'DOWN',Ref,process,Pid,Reason} -> - io:format("unexpected: ~p", [Reason]), - ?line ?t:fail() + ct:fail("unexpected: ~p", [Reason]) end. do_otp_7198_test(_) -> diff --git a/erts/emulator/test/bs_utf_SUITE.erl b/erts/emulator/test/bs_utf_SUITE.erl index f03115c3c8..5447944306 100644 --- a/erts/emulator/test/bs_utf_SUITE.erl +++ b/erts/emulator/test/bs_utf_SUITE.erl @@ -204,9 +204,9 @@ overlong(_, _, _) -> ok. overlong(Char, NumBytes) when NumBytes < 5 -> case int_to_utf8(Char, NumBytes) of <>=Bin -> - ?t:fail({illegal_encoding_accepted,Bin,Char}); + ct:fail({illegal_encoding_accepted,Bin,Char}); <>=Bin -> - ?t:fail({illegal_encoding_accepted,Bin,Char,OtherChar}); + ct:fail({illegal_encoding_accepted,Bin,Char,OtherChar}); _ -> ok end, overlong(Char, NumBytes+1); @@ -217,7 +217,7 @@ fail(Bin) -> fail_1(make_unaligned(Bin)). fail_1(<>=Bin) -> - ?t:fail({illegal_encoding_accepted,Bin,Char}); + ct:fail({illegal_encoding_accepted,Bin,Char}); fail_1(_) -> ok. @@ -241,9 +241,9 @@ lonely_hi_surrogate(Char, End) when Char =< End -> BinLittle = <>, case {BinBig,BinLittle} of {<>,_} -> - ?t:fail({lonely_hi_surrogate_accepted,Bad}); + ct:fail({lonely_hi_surrogate_accepted,Bad}); {_,<>} -> - ?t:fail({lonely_hi_surrogate_accepted,Bad}); + ct:fail({lonely_hi_surrogate_accepted,Bad}); {_,_} -> ok end, @@ -260,9 +260,9 @@ leading_lo_surrogate(HiSurr, LoSurr, End) when LoSurr =< End -> BinLittle = <>, case {BinBig,BinLittle} of {<>,_} -> - ?t:fail({leading_lo_surrogate_accepted,Bad}); + ct:fail({leading_lo_surrogate_accepted,Bad}); {_,<>} -> - ?t:fail({leading_lo_surrogate_accepted,Bad}); + ct:fail({leading_lo_surrogate_accepted,Bad}); {_,_} -> ok end, @@ -280,9 +280,9 @@ utf32_fail_range(Char, End) when Char =< End -> {'EXIT',_} = (catch <>), case {<>,<>} of {<>,_} -> - ?line ?t:fail(Unexpected); + ?line ct:fail(Unexpected); {_,<>} -> - ?line ?t:fail(Unexpected); + ?line ct:fail(Unexpected); {_,_} -> ok end, utf32_fail_range(Char+1, End); @@ -363,14 +363,14 @@ fail_check({'EXIT',{badarg,_}}, Str, Vars) -> try evaluate(Str, Vars) of Res -> io:format("Interpreted result: ~p", [Res]), - ?t:fail(did_not_fail_in_intepreted_code) + ct:fail(did_not_fail_in_intepreted_code) catch error:badarg -> ok end; fail_check(Res, _, _) -> io:format("Compiled result: ~p", [Res]), - ?t:fail(did_not_fail_in_compiled_code). + ct:fail(did_not_fail_in_compiled_code). evaluate(Str, Vars) -> {ok,Tokens,_} = diff --git a/erts/emulator/test/busy_port_SUITE.erl b/erts/emulator/test/busy_port_SUITE.erl index 9bd4f7e136..172936dd82 100644 --- a/erts/emulator/test/busy_port_SUITE.erl +++ b/erts/emulator/test/busy_port_SUITE.erl @@ -131,7 +131,7 @@ message_order(Config) when is_list(Config) -> {Busy, first} -> ok; Other -> - test_server:fail({unexpected_message, Other}) + ct:fail({unexpected_message, Other}) end, ok. @@ -233,13 +233,13 @@ no_trap_exit(Config) when is_list(Config) -> io:format("Process ~w created port ~w", [Pid, Port]), ?line exit(Port, die); Other1 -> - test_server:fail({unexpected_message, Other1}) + ct:fail({unexpected_message, Other1}) end, ?line receive {'EXIT', Pid, die} -> ok; Other2 -> - test_server:fail({unexpected_message, Other2}) + ct:fail({unexpected_message, Other2}) end, ok. @@ -257,13 +257,13 @@ no_trap_exit_unlinked(Config) when is_list(Config) -> io:format("Process ~w created port ~w", [Pid, Port]), ?line exit(Port, die); Other1 -> - test_server:fail({unexpected_message, Other1}) + ct:fail({unexpected_message, Other1}) end, ?line receive {'EXIT', Pid, normal} -> ok; Other2 -> - test_server:fail({unexpected_message, Other2}) + ct:fail({unexpected_message, Other2}) end, ok. @@ -302,13 +302,13 @@ trap_exit(Config) when is_list(Config) -> ?line {status, suspended} = process_info(Pid, status), ?line exit(Port, die); Other1 -> - test_server:fail({unexpected_message, Other1}) + ct:fail({unexpected_message, Other1}) end, ?line receive {Pid, ok} -> ok; Other2 -> - test_server:fail({unexpected_message, Other2}) + ct:fail({unexpected_message, Other2}) end, ok. @@ -379,8 +379,7 @@ hs_test(Config, HardBusy) when is_list(Config) -> case erl_ddll:load_driver(Path, DrvName) of ok -> ok; {error, Error} -> - io:format("~s\n", [erl_ddll:format_error(Error)]), - ?line ?t:fail() + ct:fail(erl_ddll:format_error(Error)) end, ?line Port = open_port({spawn, DrvName}, []), @@ -721,8 +720,7 @@ port_scheduling(Scenario,Validation,Path) -> case erl_ddll:load_driver(Path, DrvName) of ok -> ok; {error, Error} -> - io:format("~s\n", [erl_ddll:format_error(Error)]), - ?line ?t:fail() + ct:fail(erl_ddll:format_error(Error)) end, Data = run_scenario(lists:flatten(Scenario),[{drvname,DrvName}]), @@ -828,7 +826,7 @@ wait_for(Pids) -> {'EXIT', Pid, normal} -> wait_for(lists:delete(Pid, Pids)); Other -> - test_server:fail({bad_exit, Other}) + ct:fail({bad_exit, Other}) end. fun_spawn(Fun) -> @@ -869,8 +867,7 @@ load_busy_driver(Config) when is_list(Config) -> case erl_ddll:load_driver(DataDir, "busy_drv") of ok -> ok; {error, Error} -> - io:format("~s\n", [erl_ddll:format_error(Error)]), - ?line ?t:fail() + ct:fail(erl_ddll:format_error(Error)) end. %%% Interface functions. @@ -881,7 +878,7 @@ start_busy_driver(Config) when is_list(Config) -> {Pid, started} -> ok; Other -> - test_server:fail({unexpected_message, Other}) + ct:fail({unexpected_message, Other}) end. unlock_slave() -> diff --git a/erts/emulator/test/call_trace_SUITE.erl b/erts/emulator/test/call_trace_SUITE.erl index 1b67bcd83e..d99bba32cd 100644 --- a/erts/emulator/test/call_trace_SUITE.erl +++ b/erts/emulator/test/call_trace_SUITE.erl @@ -140,7 +140,7 @@ call_worker(Pid, Arg) -> receive {result,Res} -> Res after 5000 -> - ?line ?t:fail(no_answer_from_worker) + ?line ct:fail(no_answer_from_worker) end. worker_loop() -> @@ -228,7 +228,7 @@ basic() -> ?line ?MODULE:expect({trace,Self,call,{erlang,list_to_integer,["777"]}}), receive Any -> - ?line ?t:fail({unexpected_message,Any}) + ?line ct:fail({unexpected_message,Any}) after 1 -> ok end, @@ -444,9 +444,7 @@ flag_test(Test) -> ok; _Diff -> %% Too large difference. - io:format("Now = ~p\n", [Now]), - io:format("Ts = ~p\n", [Ts]), - ?line ?t:fail() + ct:fail("Now = ~p, Ts = ~p", [Now, Ts]) end, flag_test_cpu_timestamp(Test). @@ -465,8 +463,7 @@ flag_test_cpu_timestamp(Test) -> %% test that all CPU timestamps should pass. ok; _Time -> - io:format("Strange CPU timestamp: ~p", [Ts]), - ?line ?t:fail() + ct:fail("Strange CPU timestamp: ~p", [Ts]) end, io:format("Turned off CPU timestamps") catch @@ -493,7 +490,7 @@ expect_badarg_pid(What, How, Flags) -> Other -> io:format("trace(~p, ~p, ~p) -> ~p", [What,How,Flags,Other]), - ?t:fail({unexpected,Other}) + ct:fail({unexpected,Other}) end. expect_badarg_func(MFA, Pattern) -> @@ -505,7 +502,7 @@ expect_badarg_func(MFA, Pattern) -> Other -> io:format("trace_pattern(~p, ~p) -> ~p", [MFA, Pattern, Other]), - ?t:fail({unexpected,Other}) + ct:fail({unexpected,Other}) end. pam(doc) -> "Basic test of PAM."; @@ -825,7 +822,7 @@ deep_exception() -> %% ?line io:format("== Subtest: ~w", [?LINE]), ?line try lists:reverse(LongImproperList, []) of - R1 -> test_server:fail({returned,abbr(R1)}) + R1 -> ct:fail({returned,abbr(R1)}) catch error:badarg -> ok end, ?line expect(fun ({trace,S,call,{lists,reverse,[L1,L2]}}) @@ -889,7 +886,7 @@ deep_exception() -> exception_from, {error,badarg}), ?line io:format("== Subtest: ~w", [?LINE]), ?line try apply(lists, reverse, [LongImproperList, []]) of - R2 -> test_server:fail({returned,abbr(R2)}) + R2 -> ct:fail({returned,abbr(R2)}) catch error:badarg -> ok end, ?line expect(fun ({trace,S,call,{lists,reverse,[L1,L2]}}) @@ -968,7 +965,7 @@ deep_exception() -> exception_from, {error,{badmatch,2}}), ?line io:format("== Subtest: ~w", [?LINE]), ?line try apply(fun() -> lists:reverse(LongImproperList, []) end, []) of - R3 -> test_server:fail({returned,abbr(R3)}) + R3 -> ct:fail({returned,abbr(R3)}) catch error:badarg -> ok end, ?line expect(fun ({trace,S,call,{lists,reverse,[L1,L2]}}) @@ -1113,7 +1110,7 @@ exception_nocatch() -> get_deep_4_loc(Arg) -> try deep_4(Arg), - ?t:fail(should_not_return_to_here) + ct:fail(should_not_return_to_here) catch _:_ -> [{?MODULE,deep_4,1,Loc0}|_] = erlang:get_stacktrace(), @@ -1182,7 +1179,7 @@ expect() -> case flush() of [] -> ok; Msgs -> - test_server:fail({unexpected,abbr(Msgs)}) + ct:fail({unexpected,abbr(Msgs)}) end. expect({trace_ts,Pid,Type,MFA,Term,ts}=Message) -> @@ -1194,11 +1191,11 @@ expect({trace_ts,Pid,Type,MFA,Term,ts}=Message) -> Ts; _ -> io:format("Expected ~p; got ~p", [abbr(Message),abbr(M)]), - test_server:fail({unexpected,abbr([M|flush()])}) + ct:fail({unexpected,abbr([M|flush()])}) end after 5000 -> io:format("Expected ~p; got nothing", [abbr(Message)]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect({trace_ts,Pid,Type,MFA,ts}=Message) -> receive @@ -1209,11 +1206,11 @@ expect({trace_ts,Pid,Type,MFA,ts}=Message) -> Ts; _ -> io:format("Expected ~p; got ~p", [abbr(Message),abbr(M)]), - test_server:fail({unexpected,abbr([M|flush()])}) + ct:fail({unexpected,abbr([M|flush()])}) end after 5000 -> io:format("Expected ~p; got nothing", [abbr(Message)]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect(Validator) when is_function(Validator) -> receive @@ -1226,11 +1223,11 @@ expect(Validator) when is_function(Validator) -> expect(Validator); {unexpected,Message} -> io:format("Expected ~p; got ~p", [abbr(Message),abbr(M)]), - test_server:fail({unexpected,abbr([M|flush()])}) + ct:fail({unexpected,abbr([M|flush()])}) end after 5000 -> io:format("Expected ~p; got nothing", [abbr(Validator('_'))]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect(Message) -> receive @@ -1241,11 +1238,11 @@ expect(Message) -> Other -> io:format("Expected ~p; got ~p", [abbr(Message),abbr(Other)]), - test_server:fail({unexpected,abbr([Other|flush()])}) + ct:fail({unexpected,abbr([Other|flush()])}) end after 5000 -> io:format("Expected ~p; got nothing", [abbr(Message)]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end. trace_info(What, Key) -> diff --git a/erts/emulator/test/code_SUITE.erl b/erts/emulator/test/code_SUITE.erl index 3d2cc000a8..a040eee50a 100644 --- a/erts/emulator/test/code_SUITE.erl +++ b/erts/emulator/test/code_SUITE.erl @@ -288,9 +288,9 @@ do_check_process_code_ets(Config) -> receive funs_dropped -> ok; - Other -> ?t:fail({unexpected,Other}) + Other -> ct:fail({unexpected,Other}) after 10000 -> - ?line ?t:fail(no_funs_dropped_answer) + ?line ct:fail(no_funs_dropped_answer) end, ?line false = erlang:check_process_code(Pid, my_code_test), @@ -477,7 +477,7 @@ constant_pools(Config) when is_list(Config) -> {'EXIT',NoOldHeap,{A,B,C}} -> ok; Other -> - ?line ?t:fail({unexpected,Other}) + ?line ct:fail({unexpected,Other}) end, ?line {module,literals} = erlang:load_module(literals, Code), @@ -567,7 +567,7 @@ constant_refc_binaries(Config) when is_list(Config) -> %% the size of allocated binaries. if Diff > 64*1024 -> - ?t:fail(binary_leak); + ct:fail(binary_leak); true -> ok end. diff --git a/erts/emulator/test/ddll_SUITE.erl b/erts/emulator/test/ddll_SUITE.erl index 36c779c8e3..0288c9d243 100644 --- a/erts/emulator/test/ddll_SUITE.erl +++ b/erts/emulator/test/ddll_SUITE.erl @@ -846,7 +846,7 @@ reference_count(Config) when is_list(Config) -> Pid1=spawn_link(?MODULE, echo_loader, [Path, self()]), receive {Pid1, echo_loaded} -> ok - after 2000 -> test_server:fail("echo_loader failed to start.") + after 2000 -> ct:fail("echo_loader failed to start.") end, Pid1 ! {self(), die}, @@ -891,7 +891,7 @@ kill_port(Config) when is_list(Config) -> ok after 3000 -> ?line exit(Pid1, kill), - ?line test_server:fail("echo_loader failed to start.") + ?line ct:fail("echo_loader failed to start.") end, % Spawn off a port that uses the driver. @@ -908,7 +908,7 @@ kill_port(Config) when is_list(Config) -> {'EXIT', Port, Reason} -> io:format("Port exited with reason ~w", [Reason]) after 5000 -> - ?line test_server:fail("Echo port did not terminate.") + ?line ct:fail("Echo port did not terminate.") end, ok. @@ -926,7 +926,7 @@ dont_kill_port(Config) when is_list(Config) -> ok after 3000 -> ?line exit(Pid1, kill), - ?line test_server:fail("echo_loader failed to start.") + ?line ct:fail("echo_loader failed to start.") end, % Spawn off a port that uses the driver. @@ -947,7 +947,7 @@ dont_kill_port(Config) when is_list(Config) -> {'EXIT', Port, Reason} -> io:format("Port exited with reason ~w", [Reason]) after 5000 -> - ?line test_server:fail("Echo port did not terminate.") + ?line ct:fail("Echo port did not terminate.") end, ok. @@ -960,7 +960,7 @@ properties(Config) when is_list(Config) -> Pid=spawn_link(?MODULE, echo_loader, [Path, self()]), receive {Pid, echo_loaded} -> ok - after 2000 -> test_server:fail("echo_loader failed to start.") + after 2000 -> ct:fail("echo_loader failed to start.") end, % Try to unload the driver from this process (the wrong one). @@ -970,8 +970,7 @@ properties(Config) when is_list(Config) -> true -> ok; false -> - test_server:fail("Unload from wrong process " - "succeeded.") + ct:fail("Unload from wrong process succeeded.") end, % Unload the driver and terminate dummy process. diff --git a/erts/emulator/test/distribution_SUITE.erl b/erts/emulator/test/distribution_SUITE.erl index 6165cf70bc..fd47b6b235 100644 --- a/erts/emulator/test/distribution_SUITE.erl +++ b/erts/emulator/test/distribution_SUITE.erl @@ -159,7 +159,7 @@ bulk_sendsend(Terms, BinSize) -> {comment,Comment}; true -> io:put_chars(Comment), - ?line ?t:fail(ratio_too_low) + ?line ct:fail(ratio_too_low) end. bulk_sendsend2(Terms, BinSize, BusyBufSize) -> @@ -294,7 +294,7 @@ local_send_legal(Config) when is_list(Config) -> {Times, TotalSize} -> ok; _ -> - test_server:fail("Wrong number of msgs received.") + ct:fail("Wrong number of msgs received.") end, ok. @@ -469,7 +469,7 @@ do_busy_test(Node, Fun) -> {'DOWN', M, process, P, Reason} -> ?t:format("~p died with exit reason ~p~n", [P, Reason]) end, - ?t:fail(premature_death); + ct:fail(premature_death); _ -> %% Don't match arity; it is different in debug and %% optimized emulator @@ -592,9 +592,9 @@ link_to_dead(Config) when is_list(Config) -> {'EXIT', Pid, noproc} -> ok; Other -> - ?line test_server:fail({unexpected_message, Other}) + ?line ct:fail({unexpected_message, Other}) after 5000 -> - ?line test_server:fail(nothing_received) + ?line ct:fail(nothing_received) end, ?line {links, Links} = process_info(self(), links), ?line io:format("Pid=~p, links=~p", [Pid, Links]), @@ -602,7 +602,7 @@ link_to_dead(Config) when is_list(Config) -> ?line stop_node(Node), ?line receive Message -> - ?line test_server:fail({unexpected_message, Message}) + ?line ct:fail({unexpected_message, Message}) after 3000 -> ok end, @@ -629,9 +629,9 @@ link_to_dead_new_node(Config) when is_list(Config) -> {'EXIT', Pid, noproc} -> ok; Other -> - ?line test_server:fail({unexpected_message, Other}) + ?line ct:fail({unexpected_message, Other}) after 5000 -> - ?line test_server:fail(nothing_received) + ?line ct:fail(nothing_received) end, %% Make sure that the link wasn't created. @@ -641,7 +641,7 @@ link_to_dead_new_node(Config) when is_list(Config) -> ?line stop_node(Node), ?line receive Message -> - ?line test_server:fail({unexpected_message, Message}) + ?line ct:fail({unexpected_message, Message}) after 3000 -> ok end, @@ -688,9 +688,9 @@ ref_port_roundtrip(Config) when is_list(Config) -> ok; Other -> ?line io:format("Term after: ~p", [show_term(Term)]), - ?line test_server:fail({unexpected, Other}) + ?line ct:fail({unexpected, Other}) after 10000 -> - ?line test_server:fail(timeout) + ?line ct:fail(timeout) end, ok. @@ -2116,13 +2116,13 @@ verify_still_up(A, B) -> verify_no_down(A, B) -> receive {nodedown, A, B, _} = Msg0 -> - ?t:fail(Msg0) + ct:fail(Msg0) after 0 -> ok end, receive {nodedown, B, A, _} = Msg1 -> - ?t:fail(Msg1) + ct:fail(Msg1) after 0 -> ok end. diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl index 23c5114d40..b00ceaed50 100644 --- a/erts/emulator/test/driver_SUITE.erl +++ b/erts/emulator/test/driver_SUITE.erl @@ -357,17 +357,16 @@ ov_send_and_test(Port, Data, ExpectedResult) -> io:format("~p returned ~P", [Port,ReturnData,12]), compare(ReturnData, ExpectedResult); {Port,{data,OtherData}} -> - io:format("~p returned WRONG data ~p", [Port,OtherData]), - ?line test_server:fail(); + ct:fail("~p returned WRONG data ~p", [Port,OtherData]); Wrong -> - ?line test_server:fail({unexpected_port_or_data,Wrong}) + ct:fail({unexpected_port_or_data,Wrong}) end. compare(Got, Expected) -> case {list_to_binary([Got]),list_to_binary([Expected])} of {B,B} -> ok; {_Gb,_Eb} -> - ?t:fail(got_bad_data) + ct:fail(got_bad_data) end. @@ -396,14 +395,14 @@ try_timeouts(Port, Timeout) -> io:format("Elapsed: ~p Timeout: ~p\n", [Elapsed, Timeout]), if Elapsed < Timeout -> - ?line ?t:fail(too_short); + ?line ct:fail(too_short); Elapsed > Timeout + ?delay -> - ?line ?t:fail(too_long); + ?line ct:fail(too_long); true -> try_timeouts(Port, Timeout div 2) end after Timeout + ?delay -> - ?line test_server:fail("driver failed to timeout") + ?line ct:fail("driver failed to timeout") end. timer_cancel(doc) -> ["Try cancelling timers set in a driver."]; @@ -421,12 +420,12 @@ try_cancel(Port, Timeout) -> Port ! {self(),{command,<>}}, receive {Port, {data, [?TIMER]}} -> - ?line test_server:fail("driver timed out before cancelling it") + ?line ct:fail("driver timed out before cancelling it") after Timeout -> Port ! {self(), {command, [?CANCEL_TIMER]}}, receive {Port, {data, [?TIMER]}} -> - ?line test_server:fail("driver timed out after cancelling it"); + ?line ct:fail("driver timed out after cancelling it"); {Port, {data, [?CANCELLED]}} -> ?line Time_milli_secs = erl_millisecs() - T_before, @@ -434,12 +433,12 @@ try_cancel(Port, Timeout) -> [Time_milli_secs, Timeout]), if Time_milli_secs > (Timeout + ?delay) -> - ?line test_server:fail("too long real time"); + ?line ct:fail("too long real time"); Timeout == 0 -> ok; true -> try_cancel(Port, Timeout div 2) end after ?delay -> - test_server:fail("No message from driver") + ct:fail("No message from driver") end end. @@ -465,9 +464,9 @@ timer_delay(Config) when is_list(Config) -> [Elapsed,Timeout]), if Elapsed < Timeout -> - ?line ?t:fail(too_short); + ?line ct:fail(too_short); Elapsed > Timeout + ?delay -> - ?line ?t:fail(too_long); + ?line ct:fail(too_long); true -> ok end @@ -500,14 +499,14 @@ try_change_timer(Port, Timeout) -> io:format("Elapsed: ~p Timeout: ~p\n", [Elapsed,Timeout]), if Elapsed < Timeout -> - ?line ?t:fail(too_short); + ?line ct:fail(too_short); Elapsed > Timeout + ?delay -> - ?line ?t:fail(too_long); + ?line ct:fail(too_long); true -> try_timeouts(Port, Timeout div 2) end after Timeout + ?delay -> - ?line test_server:fail("driver failed to timeout") + ct:fail("driver failed to timeout") end. @@ -635,11 +634,10 @@ feed_driver(Port, [{Method0,Data}|T], Expected_return, Qb_before) -> case Qb_before + Size of Qb_in_driver -> ok; Sum -> - io:format("Qb_before: ~p\n" - "Qb_before+Size: ~p\n" - "Qb_in_driver: ~p", - [Qb_before,Sum,Qb_in_driver]), - ?t:fail() + ct:fail("Qb_before: ~p\n" + "Qb_before+Size: ~p\n" + "Qb_in_driver: ~p", + [Qb_before,Sum,Qb_in_driver]) end, X_return = case Method of ?ENQ -> list_to_binary([Expected_return,Data]); @@ -668,9 +666,7 @@ compare_return(Port, QueuedInPort0, Len_to_get, DeqSize) -> case bytes_queued(Port) of Len_to_get -> ok; BytesInQueue -> - io:format("Len_to_get: ~p", [Len_to_get]), - io:format("Bytes in queue: ~p", [BytesInQueue]), - ?line test_server:fail() + ct:fail("Len_to_get: ~p\nBytes in queue: ~p", [Len_to_get,BytesInQueue]) end, BytesToDequeue = if (DeqSize > Len_to_get) -> Len_to_get; true -> DeqSize @@ -682,10 +678,8 @@ compare_return(Port, QueuedInPort0, Len_to_get, DeqSize) -> <<_:BytesToDequeue/binary,QueuedInPort/binary>> = QueuedInPort0, compare_return(Port, QueuedInPort, Len_to_get - BytesToDequeue, DeqSize); false -> - io:format("Bytes to dequeue: ~p", [BytesToDequeue]), - io:format("Dequeued: ~p", [Dequeued]), - io:format("Queued in port: ~P", [QueuedInPort0,12]), - ?t:fail() + ct:fail("Bytes to dequeue: ~p\nDequeued: ~p\nQueued in port: ~P", + [BytesToDequeue, Dequeued, QueuedInPort0,12]) end. %% bin_prefix(PrefixBinary, Binary) @@ -704,7 +698,7 @@ queue_op(Port, Method, Data) -> bytes_queued(Port) -> case erlang:port_control(Port, ?BYTES_QUEUED, []) of <> -> I; - Bad -> ?t:fail({bad_result,Bad}) + Bad -> ct:fail({bad_result,Bad}) end. deq(Port, Size) -> @@ -774,7 +768,7 @@ io_ready_exit(Config) when is_list(Config) -> ready_input_driver_failure -> ?t:format("Exited in input_ready()~n"), ?line ok; - Error -> ?line ?t:fail(Error) + Error -> ?line ct:fail(Error) end end, receive after 2000 -> ok end, @@ -788,7 +782,7 @@ io_ready_exit(Config) when is_list(Config) -> ?line {skipped, "Not yet implemented for this OS"}; Error -> ?line process_flag(trap_exit, OTE), - ?line ?t:fail({unexpected_control_result, Error}) + ?line ct:fail({unexpected_control_result, Error}) end. @@ -814,7 +808,7 @@ use_fallback_pollset(Config) when is_list(Config) -> {fallback_poll_set_size, N}} when N > 0 -> ?line ok; Error -> - ?line ?t:fail({failed_to_use_fallback, Error}) + ?line ct:fail({failed_to_use_fallback, Error}) end end, ?line {BckupTest, Handel, OkRes} @@ -895,7 +889,7 @@ steal_control_test(Hndl = {erts_poll_info, Before}) -> ?line ok; StopErr -> ?line chk_chkio_port(Port), - ?line ?t:fail({stop_error, StopErr}) + ?line ct:fail({stop_error, StopErr}) end, ?line close_chkio_port(Port), ?line Res; @@ -907,7 +901,7 @@ steal_control_test(Hndl = {erts_poll_info, Before}) -> Before}; StartErr -> ?line chk_chkio_port(Port), - ?line ?t:fail({start_error, StartErr}) + ?line ct:fail({start_error, StartErr}) end. chkio_test_init(Config) when is_list(Config) -> @@ -944,15 +938,15 @@ close_chkio_port(Port) when is_port(Port) -> {'EXIT', Port, normal} -> ok; {'EXIT', Port, Reason} -> - ?t:fail({abnormal_port_exit, Port, Reason}); + ct:fail({abnormal_port_exit, Port, Reason}); {Port, Message} -> - ?t:fail({strange_message_from_port, Message}) + ct:fail({strange_message_from_port, Message}) end. chk_chkio_port(Port) -> receive {'EXIT', Port, Reason} when Reason /= normal -> - ?t:fail({port_exited, Port, Reason}) + ct:fail({port_exited, Port, Reason}) after 0 -> ok end. @@ -998,7 +992,7 @@ chkio_test({erts_poll_info, Before}, end; StopErr -> ?line chk_chkio_port(Port), - ?line ?t:fail({stop_error, StopErr}) + ?line ct:fail({stop_error, StopErr}) end; [$s,$k,$i,$p,$:,$\ |Skip] -> ?line chk_chkio_port(Port), @@ -1008,7 +1002,7 @@ chkio_test({erts_poll_info, Before}, Before}; StartErr -> ?line chk_chkio_port(Port), - ?line ?t:fail({start_error, StartErr}) + ?line ct:fail({start_error, StartErr}) end. verify_chkio_state(Before, After) -> @@ -1117,9 +1111,9 @@ driver_system_info_test(Config, Name) -> [$o,$k,$:,_ | Result] -> ?line check_driver_system_info_result(Result); [$e,$r,$r,$o,$r,$:,_ | Error] -> - ?line ?t:fail(Error); + ?line ct:fail(Error); Unexpected -> - ?line ?t:fail({unexpected_result, Unexpected}) + ?line ct:fail({unexpected_result, Unexpected}) end, ?line stop_driver(Port, Name), ?line ok. @@ -1203,7 +1197,7 @@ check_si_res(["dirty_sched", _Value]) -> true; check_si_res(Unexpected) -> - ?line ?t:fail({unexpected_result, Unexpected}). + ?line ct:fail({unexpected_result, Unexpected}). -define(MON_OP_I_AM_IPID,1). -define(MON_OP_MONITOR_ME,2). @@ -1396,7 +1390,7 @@ ioq_exit_test(Config, TestNo) -> Drv) of ok -> ?line ok; {error, permanent} -> ?line ok; - LoadError -> ?line ?t:fail({load_error, LoadError}) + LoadError -> ?line ct:fail({load_error, LoadError}) end, case open_port({spawn, Drv}, []) of Port when is_port(Port) -> @@ -1410,7 +1404,7 @@ ioq_exit_test(Config, TestNo) -> [$s,$k,$i,$p,$:,$ | Comment] -> ?line throw({skipped, Comment}); [$e,$r,$r,$o,$r,$:,$ | Error] -> - ?line ?t:fail(Error) + ?line ct:fail(Error) after Port ! {self(), close}, receive {Port, closed} -> ok end, @@ -1418,7 +1412,7 @@ ioq_exit_test(Config, TestNo) -> ok end; Error -> - ?line ?t:fail({open_port_failed, Error}) + ?line ct:fail({open_port_failed, Error}) end end catch @@ -1539,7 +1533,7 @@ peek_non_existing_queue(Config) when is_list(Config) -> Drv) of ok -> ?line ok; {error, permanent} -> ?line ok; - LoadError -> ?line ?t:fail({load_error, LoadError}) + LoadError -> ?line ct:fail({load_error, LoadError}) end, case open_port({spawn, Drv}, []) of Port1 when is_port(Port1) -> @@ -1549,13 +1543,13 @@ peek_non_existing_queue(Config) when is_list(Config) -> [$s,$k,$i,$p,$p,$e,$d,$:,$ | SkipReason] -> ?line throw({skipped, SkipReason}); [$e,$r,$r,$o,$r,$:,$ | Error1] -> - ?line ?t:fail(Error1) + ?line ct:fail(Error1) after exit(Port1, kill), receive {'EXIT', Port1, _} -> ok end end; Error1 -> - ?line ?t:fail({open_port1_failed, Error1}) + ?line ct:fail({open_port1_failed, Error1}) end, case open_port({spawn, Drv}, []) of Port2 when is_port(Port2) -> @@ -1563,14 +1557,14 @@ peek_non_existing_queue(Config) when is_list(Config) -> "ok" -> ?line ok; [$e,$r,$r,$o,$r,$:,$ | Error2] -> - ?line ?t:fail(Error2) + ?line ct:fail(Error2) after receive {Port2, test_successful} -> ok end, Port2 ! {self(), close}, receive {Port2, closed} -> ok end end; Error2 -> - ?line ?t:fail({open_port2_failed, Error2}) + ?line ct:fail({open_port2_failed, Error2}) end end catch @@ -1609,7 +1603,7 @@ otp_6879(Config) when is_list(Config) -> {P, ok} -> ?line ok; {P, Error} -> - ?line ?t:fail({P, Error}) + ?line ct:fail({P, Error}) end end, Procs), @@ -1620,7 +1614,7 @@ otp_6879(Config) when is_list(Config) -> ?line ok = otp_6879_call(Port, Data, 10), ?line erlang:port_close(Port); _ -> - ?line ?t:fail(open_port_failed) + ?line ct:fail(open_port_failed) end, ?line erl_ddll:unload_driver(Drv), ?line ok. @@ -2071,7 +2065,7 @@ thr_msg_blast(Config) when is_list(Config) -> End = os:timestamp(), receive Garbage -> - ?t:fail({received_garbage, Port, Garbage}) + ct:fail({received_garbage, Port, Garbage}) after 2000 -> ok end, @@ -2096,7 +2090,7 @@ thr_msg_blast(Config) when is_list(Config) -> "lock checking~n", [?MODULE,?LINE]); false -> - ?t:fail({unexpected_sched_counts, VaLuE_}) + ct:fail({unexpected_sched_counts, VaLuE_}) end end). @@ -2542,7 +2536,7 @@ stop_driver(Port, Name) -> ?line true = erlang:port_close(Port), receive {Port,Message} -> - ?t:fail({strange_message_from_port,Message}) + ct:fail({strange_message_from_port,Message}) after 0 -> ok end, diff --git a/erts/emulator/test/efile_SUITE.erl b/erts/emulator/test/efile_SUITE.erl index cb26e8e736..79a2d20fe0 100644 --- a/erts/emulator/test/efile_SUITE.erl +++ b/erts/emulator/test/efile_SUITE.erl @@ -145,7 +145,7 @@ iter_max_files(Config) when is_list(Config) -> all_equal(L), Head = hd(L), if Head >= 2 -> ok; - true -> ?line test_server:fail(too_few_files) + true -> ct:fail(too_few_files) end, {comment, "Max files: " ++ integer_to_list(hd(L))}. diff --git a/erts/emulator/test/erl_drv_thread_SUITE.erl b/erts/emulator/test/erl_drv_thread_SUITE.erl index a56741adc6..3497760515 100644 --- a/erts/emulator/test/erl_drv_thread_SUITE.erl +++ b/erts/emulator/test/erl_drv_thread_SUITE.erl @@ -86,8 +86,7 @@ run_drv_case(Config, CaseName, Command, TimeTrap) -> case erl_ddll:load_driver(DataDir, CaseName) of ok -> ok; {error, Error} -> - io:format("~s\n", [erl_ddll:format_error(Error)]), - ?line ?t:fail() + ct:fail(erl_ddll:format_error(Error)) end, ?line Port = open_port({spawn, atom_to_list(CaseName)}, []), ?line true = is_port(Port), @@ -107,11 +106,11 @@ receive_drv_result(Port, CaseName) -> ?line ?t:format("~s", [Str]), ?line receive_drv_result(Port, CaseName); {'EXIT', Port, Error} -> - ?line ?t:fail(Error); + ?line ct:fail(Error); {'EXIT', error, Error} -> - ?line ?t:fail(Error); + ?line ct:fail(Error); {failed, Port, CaseName, Comment} -> - ?line ?t:fail(Comment); + ?line ct:fail(Comment); {skipped, Port, CaseName, Comment} -> ?line {skipped, Comment}; {succeeded, Port, CaseName, ""} -> diff --git a/erts/emulator/test/erl_link_SUITE.erl b/erts/emulator/test/erl_link_SUITE.erl index a3f44e7313..62ae83f9e2 100644 --- a/erts/emulator/test/erl_link_SUITE.erl +++ b/erts/emulator/test/erl_link_SUITE.erl @@ -223,7 +223,7 @@ monitor_nodes(Config) when is_list(Config) -> ?line check_monitor_node(self(), B, 0), ?line receive {nodedown, X} -> - ?line ?t:fail({unexpected_nodedown, X}) + ?line ct:fail({unexpected_nodedown, X}) after 0 -> ?line ok end, @@ -242,9 +242,9 @@ process_monitors(Config) when is_list(Config) -> ?line [] = find_erl_monitor(self(), Mon2), ?line receive {'DOWN', Mon1, _, _, _} = Msg -> - ?line ?t:fail({unexpected_down_msg, Msg}); + ?line ct:fail({unexpected_down_msg, Msg}); {'DOWN', Mon2, _, _, _} = Msg -> - ?line ?t:fail({unexpected_down_msg, Msg}) + ?line ct:fail({unexpected_down_msg, Msg}) after 500 -> ?line true = erlang:demonitor(Mon1), ?line true = erlang:demonitor(Mon2), @@ -449,7 +449,7 @@ otp_5772_link_test(Node) -> end, ?line receive {'EXIT', TP1, _} = Exit -> - ?line ?t:fail({got_late_exit_message, Exit}) + ?line ct:fail({got_late_exit_message, Exit}) after 1000 -> ?line ok end, @@ -485,7 +485,7 @@ otp_5772_monitor_test(Node) -> end, ?line receive {'DOWN', M1, _, _, _} = Down -> - ?line ?t:fail({got_late_down_message, Down}) + ?line ct:fail({got_late_down_message, Down}) after 1000 -> ?line ok end, diff --git a/erts/emulator/test/evil_SUITE.erl b/erts/emulator/test/evil_SUITE.erl index 95a5ff3f52..02175e6bed 100644 --- a/erts/emulator/test/evil_SUITE.erl +++ b/erts/emulator/test/evil_SUITE.erl @@ -52,7 +52,7 @@ heap_frag(Config) when is_list(Config) -> ?line Res = my_appender(N); Garbage -> io:format("Garbage: ~p\n", [Garbage]), - ?line ?t:fail(got_garbage) + ct:fail(got_garbage) end. diff --git a/erts/emulator/test/exception_SUITE.erl b/erts/emulator/test/exception_SUITE.erl index c2b2c50cd5..0face2dfe8 100644 --- a/erts/emulator/test/exception_SUITE.erl +++ b/erts/emulator/test/exception_SUITE.erl @@ -110,7 +110,7 @@ pending_catched(First, Second, Expected) -> {'EXIT', Reason} -> pending(Reason, bad_guy, [First, Second], Expected); Other -> - test_server:fail({not_exit, Other}) + ct:fail({not_exit, Other}) end. pending_exit_message(Args, Expected) -> @@ -122,9 +122,9 @@ pending_exit_message(Args, Expected) -> {'EXIT', Pid, Reason} -> pending(Reason, bad_guy, Args, Expected); Other -> - test_server:fail({unexpected_message, Other}) + ct:fail({unexpected_message, Other}) after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end, process_flag(trap_exit, false). @@ -144,7 +144,7 @@ pending({Code,[{?MODULE,Func,Arity,Loc}|_]}, Func, Args, Code) when length(Args) =:= Arity, is_list(Loc) -> ok; pending(Reason, _Function, _Args, _Code) -> - test_server:fail({bad_exit_reason,Reason}). + ct:fail({bad_exit_reason,Reason}). %% Test that doing arithmetics on [] gives a badarith EXIT and not a crash. diff --git a/erts/emulator/test/float_SUITE.erl b/erts/emulator/test/float_SUITE.erl index de889baeab..9eb4456de0 100644 --- a/erts/emulator/test/float_SUITE.erl +++ b/erts/emulator/test/float_SUITE.erl @@ -411,7 +411,7 @@ unify(Other, Info) -> -define(epsilon, 1.0e-20). check_epsilon(R,Val) -> if erlang:abs(R-Val) < ?epsilon -> ok; - true -> ?t:fail({R,Val}) + true -> ct:fail({R,Val}) end. t_mul_add_ops(Config) when is_list(Config) -> diff --git a/erts/emulator/test/fun_SUITE.erl b/erts/emulator/test/fun_SUITE.erl index 103244d6ca..9020c7f7b9 100644 --- a/erts/emulator/test/fun_SUITE.erl +++ b/erts/emulator/test/fun_SUITE.erl @@ -70,7 +70,7 @@ bad_apply_fc(Fun, Args) -> ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res]); Other -> ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res]), - ?t:fail({bad_result,Other}) + ct:fail({bad_result,Other}) end. bad_apply_badarg(Fun, Args) -> @@ -82,7 +82,7 @@ bad_apply_badarg(Fun, Args) -> ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res]); Other -> ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res]), - ?t:fail({bad_result, Other}) + ct:fail({bad_result, Other}) end. bad_fun_call(doc) -> @@ -109,7 +109,7 @@ bad_call_fc(Fun) -> ok = io:format("~p(~p) -> ~p\n", [Fun,Args,Res]); Other -> ok = io:format("~p(~p) -> ~p\n", [Fun,Args,Res]), - ?t:fail({bad_result,Other}) + ct:fail({bad_result,Other}) end. %% Call and apply valid funs with wrong number of arguments. @@ -129,7 +129,7 @@ badarity(Config) when is_list(Config) -> ?line ok = io:format("~p(~p) -> ~p\n", [Fun,Args,Res]); _ -> ?line ok = io:format("~p(~p) -> ~p\n", [Fun,Args,Res]), - ?line ?t:fail({bad_result,Res}) + ?line ct:fail({bad_result,Res}) end, %% Apply. @@ -142,7 +142,7 @@ badarity(Config) when is_list(Config) -> ?line ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res2]); _ -> ?line ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res2]), - ?line ?t:fail({bad_result,Res2}) + ?line ct:fail({bad_result,Res2}) end, ok. @@ -163,7 +163,7 @@ ext_badarity(Config) when is_list(Config) -> ?line ok = io:format("~p(~p) -> ~p\n", [Fun,Args,Res]); _ -> ?line ok = io:format("~p(~p) -> ~p\n", [Fun,Args,Res]), - ?line ?t:fail({bad_result,Res}) + ?line ct:fail({bad_result,Res}) end, %% Apply. @@ -176,7 +176,7 @@ ext_badarity(Config) when is_list(Config) -> ?line ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res2]); _ -> ?line ok = io:format("apply(~p, ~p) -> ~p\n", [Fun,Args,Res2]), - ?line ?t:fail({bad_result,Res2}) + ?line ct:fail({bad_result,Res2}) end, ok. @@ -405,7 +405,7 @@ fun_to_port(Config, IoList) -> Port = open_port(AFile, [out]), case catch port_command(Port, IoList) of {'EXIT',{badarg,_}} -> ok; - Other -> ?t:fail({unexpected_retval,Other}) + Other -> ct:fail({unexpected_retval,Other}) end. build_io_list(0) -> []; @@ -534,7 +534,7 @@ refc(Config) when is_list(Config) -> ?line Pid = spawn_link(fun() -> {refc,4} = erlang:fun_info(F1, refc) end), receive {'EXIT',Pid,normal} -> ok; - Other -> ?line ?t:fail({unexpected,Other}) + Other -> ?line ct:fail({unexpected,Other}) end, ?line process_flag(trap_exit, false), ?line {refc,3} = erlang:fun_info(F1, refc), @@ -609,7 +609,7 @@ refc_dist(Config) when is_list(Config) -> ?line Pid ! F, F2 = receive {'EXIT',Pid,{normal,Fun}} -> Fun; - Other -> ?line ?t:fail({unexpected,Other}) + Other -> ?line ct:fail({unexpected,Other}) end, %% dist.c:net_mess2 have a reference to Fun for a while since %% Fun is passed in an exit signal. Wait until it is gone. @@ -633,7 +633,7 @@ refc_dist_send(Node, F) -> Pid ! {self(),F}, F2 = receive Fun when is_function(Fun) -> Fun; - Other -> ?line ?t:fail({unexpected,Other}) + Other -> ?line ct:fail({unexpected,Other}) end, receive {'EXIT',Pid,normal} -> ok end, %% No reference from dist.c:net_mess2 since Fun is passed @@ -663,7 +663,7 @@ refc_dist_reg_send(Node, F) -> {my_fun_tester,Node} ! {self(),F}, F2 = receive Fun when is_function(Fun) -> Fun; - Other -> ?line ?t:fail({unexpected,Other}) + Other -> ?line ct:fail({unexpected,Other}) end, receive {'EXIT',Pid,normal} -> ok end, @@ -691,7 +691,7 @@ my_cmp({Fun,Fun}) -> ok; my_cmp({Fun1,Fun2}) -> io:format("Fun1: ~p", [erlang:fun_info(Fun1)]), io:format("Fun2: ~p", [erlang:fun_info(Fun2)]), - ?t:fail(). + ct:fail(no_match). t_arity(Config) when is_list(Config) -> ?line 0 = fun_arity(fun() -> ok end), @@ -748,15 +748,14 @@ t_fun_info(Config) when is_list(Config) -> ?line F = fun t_fun_info/1, ?line try F(blurf) of FAny -> - io:format("should fail; returned ~p\n", [FAny]), - ?line ?t:fail() + ct:fail("should fail; returned ~p\n", [FAny]) catch error:function_clause -> ok end, ?line {module,?MODULE} = erlang:fun_info(F, module), ?line case erlang:fun_info(F, name) of undefined -> - ?line ?t:fail(); + ct:fail(no_fun_info); _ -> ok end, ?line {arity,1} = erlang:fun_info(F, arity), @@ -772,8 +771,7 @@ t_fun_info(Config) when is_list(Config) -> ?line FF = fun ?MODULE:t_fun_info/1, ?line try FF(blurf) of FFAny -> - io:format("should fail; returned ~p\n", [FFAny]), - ?line ?t:fail() + ct:fail("should fail; returned ~p\n", [FFAny]) catch error:function_clause -> ok end, @@ -821,8 +819,7 @@ t_fun_info_mfa(Config) when is_list(Config) -> bad_info(Term) -> try erlang:fun_info(Term, module) of Any -> - io:format("should fail; returned ~p\n", [Any]), - ?t:fail() + ict:fail("should fail; returned ~p\n", [Any]) catch error:badarg -> ok end. @@ -833,7 +830,7 @@ verify_undef(Fun, Tag) -> verify_not_undef(Fun, Tag) -> case erlang:fun_info(Fun, Tag) of {Tag,undefined} -> - ?t:fail(); + ct:fail("tag ~w not defined in fun_info", [Tag]); {Tag,_} -> ok end. @@ -858,15 +855,15 @@ spawn_call(Node, AFun) -> Pid ! {AFun,AFun,AFun}, Res = receive {result,R} -> R; - Other -> ?t:fail({bad_message,Other}) + Other -> ct:fail({bad_message,Other}) after 10000 -> - ?t:fail(timeout_waiting_for_result) + ct:fail(timeout_waiting_for_result) end, receive {'EXIT',Pid,normal} -> ok; - Other2 -> ?t:fail({bad_message_waiting_for_exit,Other2}) + Other2 -> ct:fail({bad_message_waiting_for_exit,Other2}) after 10000 -> - ?t:fail(timeout_waiting_for_exit) + ct:fail(timeout_waiting_for_exit) end, Res. diff --git a/erts/emulator/test/fun_r13_SUITE.erl b/erts/emulator/test/fun_r13_SUITE.erl index 32d58355e0..3ee7b90686 100644 --- a/erts/emulator/test/fun_r13_SUITE.erl +++ b/erts/emulator/test/fun_r13_SUITE.erl @@ -65,7 +65,7 @@ do_dist_old(Config) when is_list(Config) -> {ok,Fun,R12BFun} -> ?line [a,b,c] = R12BFun(a); Other -> - ?line ?t:fail({bad_message,Other}) + ?line ct:fail({bad_message,Other}) end, ok. diff --git a/erts/emulator/test/guard_SUITE.erl b/erts/emulator/test/guard_SUITE.erl index 78c65c5157..f43c30e421 100644 --- a/erts/emulator/test/guard_SUITE.erl +++ b/erts/emulator/test/guard_SUITE.erl @@ -130,10 +130,9 @@ a_receive() -> {'EXIT', Pid, {result, Result}} -> ?line 'try'(Iter-1, Fun, Args, Result, [0|Filler]); {result, Other} -> - ?line io:format("Expected ~p; got ~p~n", [Result, Other]), - ?line test_server:fail(); + ct:fail("Expected ~p; got ~p~n", [Result, Other]); Other -> - ?line test_server:fail({unexpected_message, Other}) + ct:fail({unexpected_message, Other}) end. init(Fun, Args, Filler) -> @@ -400,9 +399,7 @@ try_gbif(Id, X, Y) -> {Id, X, Y} -> io:format("guard_bif(~p, ~p, ~p) -- ok", [Id, X, Y]); Other -> - ?line ok = io:format("guard_bif(~p, ~p, ~p) -- bad result: ~p\n", - [Id, X, Y, Other]), - ?line test_server:fail() + ct:fail("guard_bif(~p, ~p, ~p) -- bad result: ~p\n", [Id, X, Y, Other]) end. try_fail_gbif(Id, X, Y) -> @@ -410,9 +407,7 @@ try_fail_gbif(Id, X, Y) -> {'EXIT',{function_clause,[{?MODULE,guard_bif,[Id,X,Y],_}|_]}} -> io:format("guard_bif(~p, ~p, ~p) -- ok", [Id,X,Y]); Other -> - ?line ok = io:format("guard_bif(~p, ~p, ~p) -- bad result: ~p\n", - [Id, X, Y, Other]), - ?line test_server:fail() + ct:fail("guard_bif(~p, ~p, ~p) -- bad result: ~p\n", [Id, X, Y, Other]) end. guard_bif('abs/1', X, Y) when abs(X) == Y -> @@ -455,9 +450,7 @@ type_tests(Config) when is_list(Config) -> {0, N} -> {comment, integer_to_list(N) ++ " standard violation(s)"}; {Errors, Violations} -> - io:format("~p sub test(s) failed, ~p violation(s)", - [Errors, Violations]), - ?line test_server:fail() + ct:fail("~p sub test(s) failed, ~p violation(s)", [Errors, Violations]) end. type_tests([{Test, AllowedTypes}| T], AllTypes) -> @@ -484,7 +477,7 @@ type_tests(Test, [Type|T], Allowed) -> when is_list(Loc) -> ok; {'EXIT',Other} -> - ?line test_server:fail({unexpected_error_reason,Other}); + ct:fail({unexpected_error_reason,Other}); tuple when is_function(Value) -> io:format("Standard violation: Test ~p(~p) should fail", [Test, Value]), diff --git a/erts/emulator/test/hibernate_SUITE.erl b/erts/emulator/test/hibernate_SUITE.erl index ea4cc79701..177468fdfd 100644 --- a/erts/emulator/test/hibernate_SUITE.erl +++ b/erts/emulator/test/hibernate_SUITE.erl @@ -84,13 +84,13 @@ hibernate_wake_up(N, ExpectedHeapSz, Child) -> if size(Bin) > 1000 -> io:format("~s\n", [binary_to_list(Bin)]), - ?line ?t:fail(stack_is_growing); + ?line ct:fail(stack_is_growing); true -> hibernate_wake_up(N-1, ExpectedHeapSz, Child) end; Other -> ?line io:format("~p\n", [Other]), - ?line ?t:fail(unexpected_message) + ?line ct:fail(unexpected_message) end. basic_hibernator(Info) -> @@ -199,8 +199,7 @@ min_heap_size_1(Config) when is_list(Config) -> AfterSize >= 15000 -> ok end; Other -> - io:format("Unexpected: ~p\n", [Other]), - ?line ?t:fail() + ct:fail("Unexpected: ~p\n", [Other]) end. min_hibernator({Parent,_Ref}) -> @@ -244,7 +243,7 @@ bad_args(Mod, Name, Args) -> io:format("erlang:hibernate(~p, ~p, ~p) -> ~p\n", [Mod,Name,Args,Res]); Other -> io:format("erlang:hibernate(~p, ~p, ~p) -> ~p\n", [Mod,Name,Args,Res]), - ?t:fail({bad_result,Other}) + ct:fail({bad_result,Other}) end. @@ -262,7 +261,7 @@ messages_in_queue(Config) when is_list(Config) -> done -> ok; Other -> ?line io:format("~p\n", [Other]), - ?line ?t:fail(unexpected_message) + ?line ct:fail(unexpected_message) end. messages_in_queue_1(Parent, ExpectedMsg) -> @@ -279,7 +278,7 @@ messages_in_queue_restart(Parent, ExpectedMessage) -> Parent ! done; Other -> io:format("~p\n", [Other]), - ?t:fail(unexpected_message) + ct:fail(unexpected_message) end, ok. @@ -301,7 +300,7 @@ undefined_mfa(Config) when is_list(Config) -> ok; Other -> ?line io:format("~p\n", [Other]), - ?line ?t:fail(unexpected_message) + ?line ct:fail(unexpected_message) end, undefined_mfa_1(). @@ -319,7 +318,7 @@ undefined_mfa_1() -> ok; Other -> ?line io:format("~p\n", [Other]), - ?line ?t:fail(unexpected_message) + ?line ct:fail(unexpected_message) end, ok. @@ -369,7 +368,7 @@ wake_up_and_bif_trap(Config) when is_list(Config) -> ?line receive {ok, Pid0} when Pid0 =:= Pid -> ok after 5000 -> - ?line ?t:fail(process_blocked) + ?line ct:fail(process_blocked) end, ?line unlink(Pid), ?line exit(Pid, bye). diff --git a/erts/emulator/test/list_bif_SUITE.erl b/erts/emulator/test/list_bif_SUITE.erl index c6221b8c66..7410cde99b 100644 --- a/erts/emulator/test/list_bif_SUITE.erl +++ b/erts/emulator/test/list_bif_SUITE.erl @@ -61,9 +61,7 @@ hd_test(Config) when is_list(Config) -> ?line case catch hd(id($h)) of {'EXIT', {badarg, _}} -> ok; Res -> - Str=io_lib:format("hd/1 with incorrect args "++ - "succeeded.~nResult: ~p", [Res]), - test_server:fail(Str) + ct:fail("hd/1 with incorrect args succeeded.~nResult: ~p", [Res]) end, ok. @@ -75,9 +73,7 @@ tl_test(Config) when is_list(Config) -> {'EXIT', {badarg, _}} -> ok; Res -> - Str=io_lib:format("tl/1 with incorrect args "++ - "succeeded.~nResult: ~p", [Res]), - test_server:fail(Str) + ct:fail("tl/1 with incorrect args succeeded.~nResult: ~p", [Res]) end, ok. @@ -98,9 +94,7 @@ t_length(Config) when is_list(Config) -> {'EXIT', {badarg, _}} -> ok; Res -> - Str = io_lib:format("length/1 with incorrect args "++ - "succeeded.~nResult: ~p", [Res]), - ?line test_server:fail(Str) + ct:fail("length/1 with incorrect args succeeded.~nResult: ~p", [Res]) end, ok. @@ -115,10 +109,7 @@ t_list_to_pid(Config) when is_list(Config) -> {'EXIT', {badarg, _}} -> ok; Res -> - Str=io_lib:format("list_to_pid/1 with incorrect "++ - "arg succeeded.~nResult: ~p", - [Res]), - test_server:fail(Str) + ct:fail("list_to_pid/1 with incorrect arg succeeded.~nResult: ~p", [Res]) end, ok. @@ -131,10 +122,7 @@ t_list_to_float(Config) when is_list(Config) -> ?line case catch list_to_float(id("58")) of {'EXIT', {badarg, _}} -> ok; Res -> - Str=io_lib:format("list_to_float with incorrect "++ - "arg succeeded.~nResult: ~p", - [Res]), - test_server:fail(Str) + ct:fail("list_to_float with incorrect arg succeeded.~nResult: ~p", [Res]) end, ok. diff --git a/erts/emulator/test/match_spec_SUITE.erl b/erts/emulator/test/match_spec_SUITE.erl index 22425bd66d..1e8bba99af 100644 --- a/erts/emulator/test/match_spec_SUITE.erl +++ b/erts/emulator/test/match_spec_SUITE.erl @@ -731,7 +731,7 @@ errchk(Pat) -> {'EXIT', {badarg, _}} -> ok; Other -> - test_server:fail({noerror, Other}) + ct:fail({noerror, Other}) end. unary_minus(suite) -> @@ -870,8 +870,7 @@ fpe(Config) when is_list(Config) -> MS = [{{'$1'},[],[{'/','$1',0}]}], case catch (['EXIT','EXIT'] = ets:match_spec_run([{1},{2}],ets:match_spec_compile(MS))) of - {'EXIT',_} -> test_server:fail({error, - "Floating point exceptions faulty"}); + {'EXIT',_} -> ct:fail({error, "Floating point exceptions faulty"}); _ -> ok end. @@ -1034,7 +1033,7 @@ flush(Reason) -> ?t:format("In queue: ~p~n", [M]), flush(Reason) after 17 -> - ?t:fail(Reason) + ct:fail(Reason) end. start_collect(P) -> diff --git a/erts/emulator/test/monitor_SUITE.erl b/erts/emulator/test/monitor_SUITE.erl index ce4c40ee02..05dfc34ed7 100644 --- a/erts/emulator/test/monitor_SUITE.erl +++ b/erts/emulator/test/monitor_SUITE.erl @@ -91,7 +91,7 @@ case_2(Config) when is_list(Config) -> ?line receive {'EXIT', _} -> ok; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end, ?line expect_down(R, B, normal), ok. @@ -104,7 +104,7 @@ case_2a(Config) when is_list(Config) -> ?line receive {'EXIT', _} -> ok; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end, ?line expect_down(R, B, normal), ok. @@ -119,7 +119,7 @@ expect_down(Ref, P) -> {'DOWN', Ref, process, P, Reason} -> Reason; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end. expect_down(Ref, P, Reason) -> @@ -127,13 +127,13 @@ expect_down(Ref, P, Reason) -> {'DOWN', Ref, process, P, Reason} -> ok; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end. expect_no_msg() -> receive Msg -> - test_server:fail({msg, Msg}) + ct:fail({msg, Msg}) after 0 -> ok end. @@ -166,7 +166,7 @@ mon_error(Type, Item) -> {'EXIT', _} -> ok; Other -> - test_server:fail({err, Other}) + ct:fail({err, Other}) end. %%% Error cases for demonitor/1 @@ -195,7 +195,7 @@ demon_e_1(Config) when is_list(Config) -> ?line demon_error(R2, badarg), ?line P2 ! {self(), stop}; Other2 -> - test_server:fail({rec, Other2}) + ct:fail({rec, Other2}) end, ?line true = test_server:stop_node(N), @@ -206,7 +206,7 @@ demon_error(Ref, Reason) -> {'EXIT', {Reason, _}} -> ok; Other -> - test_server:fail({err, Other}) + ct:fail({err, Other}) end. %%% No-op cases for demonitor/1 @@ -237,7 +237,7 @@ demon_2(Config) when is_list(Config) -> ?line case expect_down(R2, P2) of normal -> ?line ok; noproc -> ?line ok; - BadReason -> ?line ?t:fail({bad_reason, BadReason}) + BadReason -> ?line ct:fail({bad_reason, BadReason}) end, %% OTP-5772 @@ -308,7 +308,7 @@ demonitor_flush_test(Node) -> ?line receive {'DOWN', M, _, _, _} =DM when M == M1, M == M3 -> - ?line ?t:fail({unexpected_down_message, DM}) + ?line ct:fail({unexpected_down_message, DM}) after 100 -> ?line ok end. @@ -395,7 +395,7 @@ mon_1(Config) when is_list(Config) -> ?line case expect_down(R2, P2) of normal -> ?line ok; noproc -> ?line ok; - BadReason -> ?line ?t:fail({bad_reason, BadReason}) + BadReason -> ?line ct:fail({bad_reason, BadReason}) end, ?line {P2A,R2A} = spawn_monitor(timer, sleep, [1]), ?line expect_down(R2A, P2A, normal), @@ -529,7 +529,7 @@ f() -> X == S -> ok; true -> - test_server:fail({X, S}) + ct:fail({X, S}) end; Other -> ?line io:format(" -> ~p~n", [Other]), @@ -801,7 +801,7 @@ otp_5827(Config) when is_list(Config) -> Ok -> ?line ok after 1000 -> - ?line ?t:fail("erlang:monitor/2 hangs") + ?line ct:fail("erlang:monitor/2 hangs") end. monitor_time_offset(Config) when is_list(Config) -> @@ -823,7 +823,7 @@ monitor_time_offset(Config) when is_list(Config) -> {no_change_message_received, P} -> ok; {'DOWN', M, process, P, Reason} -> - ?t:fail(Reason) + ct:fail(Reason) end end, PMs), preliminary = rpc:call(Node, erlang, system_flag, [time_offset, finalize]), @@ -832,7 +832,7 @@ monitor_time_offset(Config) when is_list(Config) -> {change_messages_received, P} -> erlang:demonitor(M, [flush]); {'DOWN', M, process, P, Reason} -> - ?t:fail(Reason) + ct:fail(Reason) end end, PMs), stop_node(Node), @@ -966,7 +966,7 @@ start_jeeves({Name, Node}) {Pid, Ref} -> ok; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end, Pid; start_jeeves(Name) when is_atom(Name) -> @@ -983,7 +983,7 @@ ask_jeeves(Pid, Request) when is_pid(Pid) -> {Pid, Response} -> Response; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end. @@ -993,7 +993,7 @@ expect_jeeves(Pid, Request, Response) when is_pid(Pid) -> {Pid, Response} -> ok; Other -> - test_server:fail({rec, Other}) + ct:fail({rec, Other}) end. diff --git a/erts/emulator/test/nested_SUITE.erl b/erts/emulator/test/nested_SUITE.erl index 5b59a9f3d7..f9a913ecc8 100644 --- a/erts/emulator/test/nested_SUITE.erl +++ b/erts/emulator/test/nested_SUITE.erl @@ -52,7 +52,7 @@ search_any([Key|Rest], List) -> false -> error; Other -> - test_server:fail({other_result, Other}) + ct:fail({other_result, Other}) end, ?line search_any(Rest, List); search_any([], _) -> diff --git a/erts/emulator/test/nif_SUITE.erl b/erts/emulator/test/nif_SUITE.erl index 78922af956..05c393e65f 100644 --- a/erts/emulator/test/nif_SUITE.erl +++ b/erts/emulator/test/nif_SUITE.erl @@ -1519,7 +1519,7 @@ consume_timeslice(Config) when is_list(Config) -> io:format("Reductions = ~p~n", [Reductions]), ok; {RedDiff, Reductions} -> - ?t:fail({unexpected_reduction_count, Reductions}) + ct:fail({unexpected_reduction_count, Reductions}) end, none = next_msg(P), @@ -1583,7 +1583,7 @@ dirty_nif_exception(Config) when is_list(Config) -> %% dirty NIF returns the result of enif_make_badarg %% directly call_dirty_nif_exception(1), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> [{?MODULE,call_dirty_nif_exception,[1],_}|_] = @@ -1595,7 +1595,7 @@ dirty_nif_exception(Config) when is_list(Config) -> %% dirty NIF calls enif_make_badarg at some point but then %% returns a value that isn't an exception call_dirty_nif_exception(0), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> [{?MODULE,call_dirty_nif_exception,[0],_}|_] = @@ -1617,7 +1617,7 @@ nif_exception(Config) when is_list(Config) -> %% calls enif_make_badarg at some point but then tries to return a %% value that isn't an exception call_nif_exception(0), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> ok @@ -1630,21 +1630,21 @@ nif_nan_and_inf(Config) when is_list(Config) -> ensure_lib_loaded(Config), try call_nif_nan_or_inf(nan), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> ok end, try call_nif_nan_or_inf(inf), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> ok end, try call_nif_nan_or_inf(tuple), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> ok @@ -1654,14 +1654,14 @@ nif_atom_too_long(Config) when is_list(Config) -> ensure_lib_loaded(Config), try call_nif_atom_too_long(all), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> ok end, try call_nif_atom_too_long(len), - ?t:fail(expected_badarg) + ct:fail(expected_badarg) catch error:badarg -> ok @@ -1721,9 +1721,7 @@ verify_tmpmem(MemInfo) -> ok end; Other -> - io:format("Expected: ~p", [MemInfo]), - io:format("Actual: ~p", [Other]), - ?t:fail() + ct:fail("Expected: ~p\nActual: ~p", [MemInfo, Other]) end. call(Pid,Cmd) -> @@ -1755,7 +1753,7 @@ nif_raise_exceptions(NifFunc) -> lists:foldl(fun(Term, ok) -> try erlang:apply(?MODULE,NifFunc,[Term]), - ?t:fail({expected,Term}) + ct:fail({expected,Term}) catch error:Term -> [{?MODULE,NifFunc,[Term],_}|_] = erlang:get_stacktrace(), @@ -1787,7 +1785,7 @@ chk_mtime([TU|TUs]) -> true = B =< C catch _ : _ -> - ?t:fail({monotonic_time_missmatch, TU, A, B, C}) + ct:fail({monotonic_time_missmatch, TU, A, B, C}) end, chk_mtime(TUs). @@ -1812,7 +1810,7 @@ chk_toffs([TU|TUs]) -> false -> case erlang:system_info(time_warp_mode) of no_time_warp -> - ?t:fail({time_offset_mismatch, TU, TO, NifTO}); + ct:fail({time_offset_mismatch, TU, TO, NifTO}); _ -> %% Most frequent time offset change %% is currently only every 15:th @@ -1823,7 +1821,7 @@ chk_toffs([TU|TUs]) -> true -> ok; false -> - ?t:fail({time_offset_mismatch, TU, TO, NifTO, NTO}) + ct:fail({time_offset_mismatch, TU, TO, NifTO, NTO}) end end end, @@ -1900,7 +1898,7 @@ chk_ctu(Time, FromTU, [ToTU|ToTUs]) -> TN = convert_time_unit(T, FromTU, ToTU), case TE =:= TN of false -> - ?t:fail({conversion_mismatch, FromTU, T, ToTU, TE, TN}); + ct:fail({conversion_mismatch, FromTU, T, ToTU, TE, TN}); true -> chk_ctu(Time, FromTU, ToTUs) end. diff --git a/erts/emulator/test/node_container_SUITE.erl b/erts/emulator/test/node_container_SUITE.erl index 30f75b4cbc..3bf1e207de 100644 --- a/erts/emulator/test/node_container_SUITE.erl +++ b/erts/emulator/test/node_container_SUITE.erl @@ -953,7 +953,7 @@ nc_refc_check(Node) when is_atom(Node) -> receive {Ref, ErrorMsg, failed} -> ?t:format("~s~n", [ErrorMsg]), - ?t:fail(reference_count_check_failed); + ct:fail(reference_count_check_failed); {Ref, succeded} -> ?t:format("Reference count check of node ~w succeded!~n", [Node]), ok @@ -1035,7 +1035,7 @@ get_node_references({NodeName, Creation} = Node) when is_atom(NodeName), DistRefs, fun (ErrMsg) -> ?t:format("~s", [ErrMsg]), - ?t:fail(reference_count_check_failed) + ct:fail(reference_count_check_failed) end), find_references(Node, NodeRefs). @@ -1047,7 +1047,7 @@ get_dist_references(NodeName) when is_atom(NodeName) -> DistRefs, fun (ErrMsg) -> ?line ?t:format("~s", [ErrMsg]), - ?line ?t:fail(reference_count_check_failed) + ?line ct:fail(reference_count_check_failed) end), ?line find_references(NodeName, DistRefs). diff --git a/erts/emulator/test/old_scheduler_SUITE.erl b/erts/emulator/test/old_scheduler_SUITE.erl index d62928c31d..5fef53a564 100644 --- a/erts/emulator/test/old_scheduler_SUITE.erl +++ b/erts/emulator/test/old_scheduler_SUITE.erl @@ -117,7 +117,7 @@ equal(Config) when is_list(Config) -> %% runtime ratio between normal and low should be ~8 if Ratio < 7.5 ; Ratio > 8.5 -> - ?t:fail({bad_ratio,Ratio}); + ct:fail({bad_ratio,Ratio}); true -> ok(Config) end. @@ -148,7 +148,7 @@ many_low(Config) when is_list(Config) -> io:format("Reports: ~w normal (~w/proc), ~w low (~w/proc). Ratio: ~w~n", [NRs,NAvg,LRs,LAvg,Ratio]), if Ratio < 7.5 ; Ratio > 8.5 -> - ?t:fail({bad_ratio,Ratio}); + ct:fail({bad_ratio,Ratio}); true -> ok(Config) end. @@ -179,7 +179,7 @@ few_low(Config) when is_list(Config) -> io:format("Reports: ~w normal (~w/proc), ~w low (~w/proc). Ratio: ~w~n", [NRs,NAvg,LRs,LAvg,Ratio]), if Ratio < 7.0 ; Ratio > 8.5 -> - ?t:fail({bad_ratio,Ratio}); + ct:fail({bad_ratio,Ratio}); true -> ok(Config) end. @@ -214,7 +214,7 @@ max(Config) when is_list(Config) -> io:format("Reports: ~w max (~w/proc), ~w high (~w/proc). Ratio: ~w~n", [M1Rs,M1Avg,HRs,HAvg,Ratio1]), if Ratio1 < 1.0 -> - ?t:fail({bad_ratio,Ratio1}); + ct:fail({bad_ratio,Ratio1}); true -> ok(Config) end, @@ -232,7 +232,7 @@ max(Config) when is_list(Config) -> io:format("Reports: ~w max (~w/proc), ~w normal (~w/proc). Ratio: ~w~n", [M2Rs,M2Avg,NRs,NAvg,Ratio2]), if Ratio2 < 1.0 -> - ?t:fail({bad_ratio,Ratio2}); + ct:fail({bad_ratio,Ratio2}); true -> ok end, @@ -250,7 +250,7 @@ max(Config) when is_list(Config) -> io:format("Reports: ~w max (~w/proc), ~w low (~w/proc). Ratio: ~w~n", [M3Rs,M3Avg,LRs,LAvg,Ratio3]), if Ratio3 < 1.0 -> - ?t:fail({bad_ratio,Ratio3}); + ct:fail({bad_ratio,Ratio3}); true -> ok(Config) end. @@ -284,7 +284,7 @@ high(Config) when is_list(Config) -> io:format("Reports: ~w high (~w/proc), ~w normal (~w/proc). Ratio: ~w~n", [H1Rs,H1Avg,NRs,NAvg,Ratio1]), if Ratio1 < 1.0 -> - ?t:fail({bad_ratio,Ratio1}); + ct:fail({bad_ratio,Ratio1}); true -> ok end, @@ -302,7 +302,7 @@ high(Config) when is_list(Config) -> io:format("Reports: ~w high (~w/proc), ~w low (~w/proc). Ratio: ~w~n", [H2Rs,H2Avg,LRs,LAvg,Ratio2]), if Ratio2 < 1.0 -> - ?t:fail({bad_ratio,Ratio2}); + ct:fail({bad_ratio,Ratio2}); true -> ok(Config) end. diff --git a/erts/emulator/test/op_SUITE.erl b/erts/emulator/test/op_SUITE.erl index 9948c13ce2..a12066f9fa 100644 --- a/erts/emulator/test/op_SUITE.erl +++ b/erts/emulator/test/op_SUITE.erl @@ -296,7 +296,7 @@ run_function(Mod, Name) -> case catch Mod:Name() of {'EXIT',Reason} -> io:format("~p", [get(last)]), - ?t:fail({'EXIT',Reason}); + ct:fail({'EXIT',Reason}); _Other -> ok end. diff --git a/erts/emulator/test/port_SUITE.erl b/erts/emulator/test/port_SUITE.erl index 365c63b468..25452598e3 100644 --- a/erts/emulator/test/port_SUITE.erl +++ b/erts/emulator/test/port_SUITE.erl @@ -261,7 +261,7 @@ bad_packet(PortTest, HeaderSize, PacketSize) -> P ! {self(), {command, make_zero_packet(PacketSize)}}, receive {'EXIT', P, einval} -> ok; - Other -> test_server:fail({unexpected_message, Other}) + Other -> ct:fail({unexpected_message, Other}) end. make_zero_packet(0) -> []; @@ -288,7 +288,7 @@ bad_message(PortTest, Message) -> P ! Message, receive {'EXIT',P,badsig} -> ok; - Other -> test_server:fail({unexpected_message, Other}) + Other -> ct:fail({unexpected_message, Other}) end. %% Tests various options (stream and {packet, Number} are implicitly @@ -448,7 +448,7 @@ wait_for(Pids) -> {'EXIT', Pid, normal} -> wait_for(lists:delete(Pid, Pids)); Other -> - test_server:fail({bad_exit, Other}) + ct:fail({bad_exit, Other}) end. %% Tests starting port programs that terminate by themselves. @@ -708,10 +708,10 @@ open_ports(Name, Settings) -> enomem -> []; Other -> - test_server:fail({open_ports, Other}) + ct:fail({open_ports, Other}) end; Other -> - test_server:fail({open_ports, Other}) + ct:fail({open_ports, Other}) end. %% Tests that exit(Port, Term) works (has been known to crash the emulator). @@ -724,7 +724,7 @@ t_exit(Config) when is_list(Config) -> {'EXIT', Pid, die} -> ok; Other -> - test_server:fail({bad_message, Other}) + ct:fail({bad_message, Other}) end. suicide_port(Config) when is_list(Config) -> @@ -760,7 +760,7 @@ tps(Port, Packet, N) -> {Port, {data, Packet}} -> tps(Port, Packet, N-1); Other -> - test_server:fail({bad_message, Other}) + ct:fail({bad_message, Other}) end. %% Line I/O test @@ -893,10 +893,9 @@ env_slave(File, Env, Body) -> {Port,{data,{eol,"ok"}}} -> ok; {Port,{data,{eol,Error}}} -> - io:format("~p\n", [Error]), - test_server:fail(); + ct:fail("eol error ~p\n", [Error]); Other -> - test_server:fail(Other) + ct:fail(Other) end. env_slave_main([File]) -> @@ -989,10 +988,10 @@ cd(Config) when is_list(Config) -> true -> ok; false -> - test_server:fail({cd, String}) + ct:fail({cd, String}) end; Other2 -> - test_server:fail({env, Other2}) + ct:fail({env, Other2}) end, _ = open_port({spawn, Cmd}, [{cd, unicode:characters_to_binary(TestDir)}, @@ -1003,10 +1002,10 @@ cd(Config) when is_list(Config) -> true -> ok; false -> - test_server:fail({cd, String2}) + ct:fail({cd, String2}) end; Other3 -> - test_server:fail({env, Other3}) + ct:fail({env, Other3}) end, ok. @@ -1104,7 +1103,7 @@ otp_3906(Config, OSName) -> succeded -> ok; _ -> - test_server:fail(Result) + ct:fail(Result) end; _ -> {skipped, "No C compiler found"} @@ -1253,7 +1252,7 @@ otp_4389(Config) when is_list(Config) -> fun (P) -> receive {P, ok} -> ok; - {P, Err} -> ?t:fail(Err) + {P, Err} -> ct:fail(Err) end end, lists:map( @@ -1340,7 +1339,7 @@ spawn_driver(Config) when is_list(Config) -> io:format("~p~n", [Msg1]), ok; Other -> - test_server:fail({unexpected, Other}) + ct:fail({unexpected, Other}) end, Port ! {self(), close}, receive {Port, closed} -> ok end, @@ -1352,7 +1351,7 @@ spawn_driver(Config) when is_list(Config) -> io:format("~p~n", [Msg2]), ok; Other2 -> - test_server:fail({unexpected2, Other2}) + ct:fail({unexpected2, Other2}) end, Port2 ! {self(), close}, receive {Port2, closed} -> ok end, @@ -1377,7 +1376,7 @@ parallelism_option(Config) when is_list(Config) -> io:format("~p~n", [Msg1]), ok; Other -> - test_server:fail({unexpected, Other}) + ct:fail({unexpected, Other}) end, ?line Port ! {self(), close}, ?line receive {Port, closed} -> ok end, @@ -1390,7 +1389,7 @@ parallelism_option(Config) when is_list(Config) -> io:format("~p~n", [Msg2]), ok; Other2 -> - test_server:fail({unexpected2, Other2}) + ct:fail({unexpected2, Other2}) end, ?line Port2 ! {self(), close}, ?line receive {Port2, closed} -> ok end, @@ -1650,7 +1649,7 @@ mix_up_ports(Config) when is_list(Config) -> io:format("~p~n", [Msg1]), ok; Other -> - test_server:fail({unexpected, Other}) + ct:fail({unexpected, Other}) end, Port ! {self(), close}, receive {Port, closed} -> ok end, @@ -1669,7 +1668,7 @@ mix_up_ports(Config) when is_list(Config) -> Port ! {self(), {command, "Hello again port!"}}, receive Msg2 -> - test_server:fail({unexpected, Msg2}) + ct:fail({unexpected, Msg2}) after 1000 -> ok end, @@ -1794,7 +1793,7 @@ otp_6224(Config) when is_list(Config) -> case Reason of {driver_failed, _} -> ok; driver_failed -> ok; - _ -> ?t:fail({unexpected_exit_reason, + _ -> ct:fail({unexpected_exit_reason, Reason}) end end, @@ -1873,7 +1872,7 @@ exit_status_msb_test(Config, SleepSecs) when is_list(Config) -> Err == enomem -> noop; Error -> - ?t:fail(Error) + ct:fail(Error) end end, lists:seq(1, NoPortsPerProc)), @@ -1904,17 +1903,17 @@ exit_status_msb_test(Config, SleepSecs) when is_list(Config) -> PrtSIds), Parent ! {self(), done} end, - Procs = lists:map(fun (N) -> - spawn_opt(ProcFun, - [link, - {scheduler, - (N rem NoSchedsOnln)+1}]) - end, - lists:seq(1, NoProcs)), + Procs = lists:map(fun (N) -> + spawn_opt(ProcFun, + [link, + {scheduler, + (N rem NoSchedsOnln)+1}]) + end, + lists:seq(1, NoProcs)), SIds = lists:map(fun (P) -> - receive {P, started, SIds} -> SIds end - end, - Procs), + receive {P, started, SIds} -> SIds end + end, + Procs), StartedTime = (erlang:monotonic_time(micro_seconds) - Start)/1000000, ?t:format("StartedTime = ~p~n", [StartedTime]), true = StartedTime < SleepSecs, @@ -1929,10 +1928,8 @@ exit_status_msb_test(Config, SleepSecs) when is_list(Config) -> {N, N} -> ok; {N, M} -> - ?t:fail("Failed to create ports on all" - ++ integer_to_list(M) ++ " available" - "schedulers. Only created ports on " - ++ integer_to_list(N) ++ " schedulers.") + ct:fail("Failed to create ports on all ~w available" + "schedulers. Only created ports on ~w schedulers.", [M, N]) end. save_sid(SIds) -> @@ -1953,15 +1950,15 @@ sid_proc(SIds) -> verify_multi_scheduling_blocked() -> Procs = lists:map(fun (_) -> - spawn_link(fun () -> sid_proc([]) end) - end, - lists:seq(1, 3*erlang:system_info(schedulers_online))), + spawn_link(fun () -> sid_proc([]) end) + end, + lists:seq(1, 3*erlang:system_info(schedulers_online))), receive after 1000 -> ok end, SIds = lists:map(fun (P) -> - P ! {self(), want_sids}, - receive {P, sids, PSIds} -> PSIds end - end, - Procs), + P ! {self(), want_sids}, + receive {P, sids, PSIds} -> PSIds end + end, + Procs), 1 = length(lists:usort(lists:flatten(SIds))), ok. @@ -2085,7 +2082,7 @@ receive_all(Port, [Expect|Rest]) -> {Port, {data, Other}} -> io:format("Received ~s; expected ~s", [format(Other), format(Expect)]), - test_server:fail(bad_message); + ct:fail(bad_message); Other -> %% (We're not yet prepared for receiving both 'eol' and %% 'exit_status'; remember that they may appear in any order.) @@ -2099,7 +2096,7 @@ receive_all(Port, [Expect|Rest]) -> _ -> %%% io:format("Unexpected message: ~s", [format(Other)]), io:format("Unexpected message: ~w", [Other]), - test_server:fail(unexpected_message) + ct:fail(unexpected_message) end end, receive_all(Port, Rest); @@ -2119,7 +2116,7 @@ stream_receive_all1(Port, Expect) -> Remaining = compare(Data, Expect), stream_receive_all1(Port, Remaining); Other -> - test_server:fail({bad_message, Other}) + ct:fail({bad_message, Other}) end. compare(B1, B2) when is_binary(B1), is_binary(B2), byte_size(B1) =< byte_size(B2) -> @@ -2127,18 +2124,18 @@ compare(B1, B2) when is_binary(B1), is_binary(B2), byte_size(B1) =< byte_size(B2 {B1,Remaining} -> Remaining; _Other -> - test_server:fail(nomatch) + ct:fail(nomatch) end; compare(B1, B2) when is_binary(B1), is_binary(B2) -> - test_server:fail(too_much_data); + ct:fail(too_much_data); compare([X|Rest1], [X|Rest2]) -> compare(Rest1, Rest2); compare([_|_], [_|_]) -> - test_server:fail(nomatch); + ct:fail(nomatch); compare([], Remaining) -> Remaining; compare(_Data, []) -> - test_server:fail(too_much_data). + ct:fail(too_much_data). maybe_to_list(Bin) when is_binary(Bin) -> binary_to_list(Bin); @@ -2324,7 +2321,7 @@ ports_verify(Ports, PortsAfter, EventList) -> ports_verify(Ports, [P | PortsAfter], Tail); [] -> - test_server:fail("Inconsistent snapshot from erlang:ports()") + ct:fail("Inconsistent snapshot from erlang:ports()") end end. diff --git a/erts/emulator/test/port_bif_SUITE.erl b/erts/emulator/test/port_bif_SUITE.erl index c7659eed9e..bdadfc48ac 100644 --- a/erts/emulator/test/port_bif_SUITE.erl +++ b/erts/emulator/test/port_bif_SUITE.erl @@ -66,10 +66,10 @@ do_command(P, Data) -> {P,{data,Data0}} -> case {list_to_binary(Data0),list_to_binary([Data])} of {B,B} -> ok; - _ -> test_server:fail({unexpected_data,Data0}) + _ -> ct:fail({unexpected_data,Data0}) end; Other -> - test_server:fail({unexpected_message,Other}) + ct:fail({unexpected_message,Other}) end. @@ -85,9 +85,9 @@ command_e_1(Config) when is_list(Config) -> {'EXIT', Pid, {badarg, _}} when is_pid(Pid) -> ok; Other -> - test_server:fail(Other) + ct:fail(Other) after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end, ok. @@ -107,9 +107,9 @@ command_e_2(Config) when is_list(Config) -> {'EXIT', Pid, {badarg, _}} when is_pid(Pid) -> ok; Other -> - test_server:fail(Other) + ct:fail(Other) after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end, ok. @@ -131,9 +131,9 @@ command_e_3(Config) when is_list(Config) -> {'EXIT', Port, einval} when is_port(Port) -> ok; Other -> - test_server:fail(Other) + ct:fail(Other) after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end, ok. @@ -148,9 +148,9 @@ command_e_4(Config) when is_list(Config) -> {'EXIT', Pid, {einval, _}} when is_pid(Pid) -> ok; Other -> - test_server:fail(Other) + ct:fail(Other) after 10000 -> - test_server:fail(timeout) + ct:fail(timeout) end, ok. @@ -227,7 +227,7 @@ do_port_info_os_pid() -> {os_pid, InfoOSPid} = erlang:port_info(P, os_pid), EchoPidStr = receive {P, {data, EchoPidStr0}} -> EchoPidStr0 - after 10000 -> test_server:fail(timeout) + after 10000 -> ct:fail(timeout) end, {ok, [EchoPid], []} = io_lib:fread("~u\n", EchoPidStr), {value,{os_pid, InfoOSPid}}=lists:keysearch(os_pid, 1, A), @@ -262,10 +262,9 @@ output_test(_, _, Input, Output) when Output > 16#1fffffff -> output_test(P, Bin, Input0, Output0) -> erlang:port_command(P, Bin), receive - {P,{data,Bin}} -> ok; - Other -> - io:format("~p", [Other]), - ?t:fail() + {P,{data,Bin}} -> ok; + Other -> + ct:fail("~p", [Other]) end, Input = Input0 + size(Bin), Output = Output0 + size(Bin), @@ -275,8 +274,8 @@ output_test(P, Bin, Input0, Output0) -> %% We can't test much here, but hopefully a debug-built emulator will crasch %% if there is something wrong with the heap allocation. case erlang:statistics(io) of - {{input,In},{output,Out}} when is_integer(In), is_integer(Out) -> - ok + {{input,In},{output,Out}} when is_integer(In), is_integer(Out) -> + ok end, output_test(P, Bin, Input, Output). @@ -324,7 +323,7 @@ connect(Config) when is_list(Config) -> exit(P, you_should_die), receive {'EXIT',RecPid,you_should_die} -> ok; - Other -> ?line ?t:fail({bad_message,Other}) + Other -> ct:fail({bad_message,Other}) end, %% Done. @@ -401,9 +400,9 @@ echo_to_busy(Config) when is_list(Config) -> {Echoer, done} -> ok; {Echoer, Other} -> - test_server:fail(Other); + ct:fail(Other); Other -> - test_server:fail({unexpected_message, Other}) + ct:fail({unexpected_message, Other}) end, ok. diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl index d0af5f39b1..1ee57f07b5 100644 --- a/erts/emulator/test/process_SUITE.erl +++ b/erts/emulator/test/process_SUITE.erl @@ -198,13 +198,13 @@ t_exit_2_other_normal(Config) when is_list(Config) -> exit(Pid, normal), receive {'EXIT', Pid, Reason} -> - test_server:fail({process_died, Reason}) + ct:fail({process_died, Reason}) after 1000 -> ok end, case process_info(Pid) of undefined -> - test_server:fail(process_died_on_normal); + ct:fail(process_died_on_normal); List when is_list(List) -> ok end, @@ -236,7 +236,7 @@ normal_suicide_exit(Config) when is_list(Config) -> Pid = fun_spawn(fun() -> exit(self(), normal) end), receive {'EXIT', Pid, normal} -> ok; - Other -> test_server:fail({bad_message, Other}) + Other -> ct:fail({bad_message, Other}) end. %% Tests exit(self(), Term) is equivalent to exit(Term) for a process @@ -247,7 +247,7 @@ abnormal_suicide_exit(Config) when is_list(Config) -> Pid = fun_spawn(fun() -> exit(self(), Garbage) end), receive {'EXIT', Pid, Garbage} -> ok; - Other -> test_server:fail({bad_message, Other}) + Other -> ct:fail({bad_message, Other}) end. %% Tests that exit(self(), die) cannot be catched. @@ -256,11 +256,11 @@ t_exit_2_catch(Config) when is_list(Config) -> Pid = fun_spawn(fun() -> catch exit(self(), die) end), receive {'EXIT', Pid, normal} -> - test_server:fail(catch_worked); + ct:fail(catch_worked); {'EXIT', Pid, die} -> ok; Other -> - test_server:fail({bad_message, Other}) + ct:fail({bad_message, Other}) end. %% Tests trapping of an 'EXIT' message generated by a bad argument to @@ -283,7 +283,7 @@ trap_exit_badarg() -> ok; Other -> ok = io:format("Bad EXIT message: ~P", [Other, 30]), - test_server:fail(bad_exit_message) + ct:fail(bad_exit_message) end. bad_guy(Arg) -> @@ -326,7 +326,7 @@ trap_exit_badarg_bif() -> {'EXIT', Pid, {badarg, _}} -> ok; Other -> - test_server:fail({unexpected, Other}) + ct:fail({unexpected, Other}) end. %% The following sequences of events have crasched Beam. @@ -356,7 +356,7 @@ eat_wait_for(Low, High) -> {'EXIT', High, normal} -> eat_wait_for(Low, High); Other -> - test_server:fail({bad_message, Other}) + ct:fail({bad_message, Other}) end. eat_low(_Parent) -> @@ -402,11 +402,11 @@ etwice_wait_for(Low, High) -> {'EXIT', Low, first} -> ok; {'EXIT', Low, Other} -> - test_server:fail({wrong_exit_reason, Other}); + ct:fail({wrong_exit_reason, Other}); {'EXIT', High, normal} -> etwice_wait_for(Low, High); Other -> - test_server:fail({bad_message, Other}) + ct:fail({bad_message, Other}) end. etwice_low() -> @@ -731,7 +731,7 @@ process_info_lock_reschedule(Config) when is_list(Config) -> exit(Target2, bang), OkStatus; {status, BadStatus} -> - ?t:fail(BadStatus) + ct:fail(BadStatus) end. pi_loop(_Name, _Pid, 0) -> @@ -833,7 +833,7 @@ process_info_lock_reschedule3(Config) when is_list(Config) -> exit(Target2, bang), OkStatus; {status, BadStatus} -> - ?t:fail(BadStatus) + ct:fail(BadStatus) end. process_status_exiting(Config) when is_list(Config) -> @@ -977,10 +977,10 @@ bump_reductions(Config) when is_list(Config) -> case R2-R1 of Diff when Diff < 100 -> ok = io:format("R1 = ~w, R2 = ~w", [R1, R2]), - test_server:fail({small_diff, Diff}); + ct:fail({small_diff, Diff}); Diff when Diff > 110 -> ok = io:format("R1 = ~w, R2 = ~w", [R1, R2]), - test_server:fail({big_diff, Diff}); + ct:fail({big_diff, Diff}); Diff -> io:format("~p\n", [Diff]), ok @@ -1109,7 +1109,7 @@ yield_test() -> {Diff, _} -> ok = io:format("R1 = ~w, R2 = ~w, Schedcnt = ~w", [R1, R2, Schedcnt]), - test_server:fail({measurement_error, Diff, Schedcnt}) + ct:fail({measurement_error, Diff, Schedcnt}) end. call_yield() -> @@ -1198,7 +1198,7 @@ yield2(Config) when is_list(Config) -> io:format("Reductions = ~p~n", [Reductions]), ok; {RedDiff, Reductions} -> - ?t:fail({unexpected_reduction_count, Reductions}) + ct:fail({unexpected_reduction_count, Reductions}) end, none = next_tmsg(P), @@ -1460,7 +1460,7 @@ processes_large_tab_test(Config) -> #ptab_list_bif_info{debug_level = Lvl} when Lvl > MaxDbgLvl -> 20; #ptab_list_bif_info{debug_level = Lvl} when Lvl < 0 -> - ?t:fail({debug_level, Lvl}); + ct:fail({debug_level, Lvl}); #ptab_list_bif_info{debug_level = Lvl} -> Lvl end, @@ -1478,7 +1478,7 @@ processes_large_tab_test(Config) -> [processes_bif_info]) of #ptab_list_bif_info{tab_chunks = Chunks} when is_integer(Chunks), Chunks > 1 -> ok; - PBInfo -> ?t:fail(PBInfo) + PBInfo -> ct:fail(PBInfo) end, stop_node(LargeNode), chk_processes_bif_test_res(Res). @@ -1525,7 +1525,7 @@ processes_this_tab(Config) when is_list(Config) -> chk_processes_bif_test_res(ok) -> ok; chk_processes_bif_test_res({comment, _} = Comment) -> Comment; -chk_processes_bif_test_res(Failure) -> ?t:fail(Failure). +chk_processes_bif_test_res(Failure) -> ct:fail(Failure). print_processes_bif_info(#ptab_list_bif_info{min_start_reds = MinStartReds, tab_chunks = TabChunks, @@ -1596,7 +1596,7 @@ processes_unexpected_result(CorrectProcs, Procs) -> end] end, SuperfluousProcs)]), - ?t:fail(unexpected_result). + ct:fail(unexpected_result). hangaround(Cleaner, Type) -> %% Type is only used to distinguish different processes from @@ -2229,7 +2229,7 @@ do_otp_7738_test(Type) -> after 2000 -> I = process_info(R, [status, message_queue_len]), ?t:format("~p~n", [I]), - ?t:fail(no_progress) + ct:fail(no_progress) end, ok. @@ -2316,7 +2316,7 @@ no_priority_inversion2(Config) when is_list(Config) -> RH = request_gc(PL, high), receive {garbage_collect, _, _} -> - ?t:fail(unexpected_gc) + ct:fail(unexpected_gc) after 1000 -> ok end, @@ -2425,7 +2425,7 @@ gc_request_when_gc_disabled(Config) when is_list(Config) -> async = garbage_collect(P, [{async, ReqId}]), receive {garbage_collect, ReqId, Result} -> - ?t:fail({unexpected_gc, Result}); + ct:fail({unexpected_gc, Result}); {P, gc_state, true} -> ok end, diff --git a/erts/emulator/test/receive_SUITE.erl b/erts/emulator/test/receive_SUITE.erl index d471bbecc9..6097e54219 100644 --- a/erts/emulator/test/receive_SUITE.erl +++ b/erts/emulator/test/receive_SUITE.erl @@ -55,8 +55,7 @@ call_with_huge_message_queue(Config) when is_list(Config) -> Q when Q < 10 -> ok; Q -> - io:format("Best Q = ~p", [Q]), - ?t:fail() + ct:fail("Best Q = ~p", [Q]) end, ok. diff --git a/erts/emulator/test/ref_SUITE.erl b/erts/emulator/test/ref_SUITE.erl index 1bf94b9a3f..e84d53a89e 100644 --- a/erts/emulator/test/ref_SUITE.erl +++ b/erts/emulator/test/ref_SUITE.erl @@ -39,7 +39,7 @@ wrap_1(Config) when is_list(Config) -> ?line spawn_link(?MODULE, loop_ref, [self()]), ?line receive done -> - test_server:fail(wrapfast) + ct:fail(wrapfast) after 30000 -> ok end, diff --git a/erts/emulator/test/save_calls_SUITE.erl b/erts/emulator/test/save_calls_SUITE.erl index b40a5f0a56..fdf6e6fda0 100644 --- a/erts/emulator/test/save_calls_SUITE.erl +++ b/erts/emulator/test/save_calls_SUITE.erl @@ -151,7 +151,7 @@ save_calls_1() -> {?MODULE,do_bepp,0}] -> ok; X -> - test_server:fail({l21, X}) + ct:fail({l21, X}) end, ?line erlang:process_flag(self(), save_calls, 10), diff --git a/erts/emulator/test/scheduler_SUITE.erl b/erts/emulator/test/scheduler_SUITE.erl index 03e546c00d..776bf172ee 100644 --- a/erts/emulator/test/scheduler_SUITE.erl +++ b/erts/emulator/test/scheduler_SUITE.erl @@ -821,7 +821,7 @@ update_cpu_info(Config) when is_list(Config) -> ?line unchanged = adjust_schedulers_online(), ?line ok; Fail -> - ?line ?t:fail(Fail) + ?line ct:fail(Fail) end end after @@ -1896,7 +1896,7 @@ chk_result([{low, L, Lmin, _Lmax}, chk_lim(Min, V, Max, _What) when Min =< V, V =< Max -> ok; chk_lim(_Min, V, _Max, What) -> - ?t:fail({bad, What, V}). + ct:fail({bad, What, V}). snd(_Msg, []) -> []; @@ -2259,7 +2259,7 @@ cmp_aux(T0, T1) when is_tuple(T0), is_tuple(T1), size(T0) == size(T1) -> cmp_aux(X, X) -> ok; cmp_aux(F0, F1) -> - ?t:fail({no_match, F0, F1}). + ct:fail({no_match, F0, F1}). cmp_tuple(_T0, _T1, N, Sz) when N > Sz -> ok; diff --git a/erts/emulator/test/send_term_SUITE.erl b/erts/emulator/test/send_term_SUITE.erl index de453e090a..1915b44b4b 100644 --- a/erts/emulator/test/send_term_SUITE.erl +++ b/erts/emulator/test/send_term_SUITE.erl @@ -127,8 +127,7 @@ basic(Config) when is_list(Config) -> ?line [] = term(P, 127), ?line receive Any -> - ?line io:format("Unexpected: ~p\n", [Any]), - ?line ?t:fail() + ct:fail("Unexpected: ~p\n", [Any]) after 0 -> ok end, @@ -198,7 +197,7 @@ stop_driver(Port, Name) -> ?line true = erlang:port_close(Port), receive {Port,Message} -> - ?t:fail({strange_message_from_port,Message}) + ct:fail({strange_message_from_port,Message}) after 0 -> ok end, diff --git a/erts/emulator/test/sensitive_SUITE.erl b/erts/emulator/test/sensitive_SUITE.erl index a5cc25f55a..618044c153 100644 --- a/erts/emulator/test/sensitive_SUITE.erl +++ b/erts/emulator/test/sensitive_SUITE.erl @@ -65,7 +65,7 @@ stickiness(Config) when is_list(Config) -> case process_info(self(), dictionary) of {dictionary,[]} -> ok; - {dictionary,_} -> ?line ?t:fail(sensitive_flag_cleared) + {dictionary,_} -> ?line ct:fail(sensitive_flag_cleared) end, NewTracer = spawn_link(fun() -> receive after infinity -> ok end end), diff --git a/erts/emulator/test/signal_SUITE.erl b/erts/emulator/test/signal_SUITE.erl index 63996fb9f2..e6ec79141b 100644 --- a/erts/emulator/test/signal_SUITE.erl +++ b/erts/emulator/test/signal_SUITE.erl @@ -200,7 +200,7 @@ pending_exit_test(From, Type) -> {Pid, Ref, Type} -> ?line ok after 0 -> - ?line ?t:fail(premature_exit) + ?line ct:fail(premature_exit) end, ?line case Type of exit -> @@ -275,7 +275,7 @@ exit_before_pending_exit(Config) when is_list(Config) -> ?line process_flag(trap_exit, OTE), ?line ok; Msg -> - ?line ?t:fail({unexpected_message, Msg}) + ?line ct:fail({unexpected_message, Msg}) end, NoScheds = integer_to_list(erlang:system_info(schedulers_online)), {comment, diff --git a/erts/emulator/test/smoke_test_SUITE.erl b/erts/emulator/test/smoke_test_SUITE.erl index 751129c7bb..7e5345fd49 100644 --- a/erts/emulator/test/smoke_test_SUITE.erl +++ b/erts/emulator/test/smoke_test_SUITE.erl @@ -97,7 +97,7 @@ native_atomics(Config) when is_list(Config) -> {value,{DWNAKey, DWNA, _}} = lists:keysearch(DWNAKey, 1, EthreadInfo), case {erlang:system_info(build_type), erlang:system_info(smp_support), NA32, NA64, DWNA} of {opt, true, "no", "no", _} -> - ?t:fail(optimized_smp_runtime_without_native_atomics); + ct:fail(optimized_smp_runtime_without_native_atomics); {_, false, "no", "no", _} -> {comment, "No native atomics"}; _ -> @@ -114,7 +114,7 @@ jump_table(Config) when is_list(Config) -> false -> case erlang:system_info(build_type) of opt -> - ?t:fail(optimized_without_beam_jump_table); + ct:fail(optimized_without_beam_jump_table); BT -> {comment, "No beam jump table, but build type is " ++ atom_to_list(BT)} end diff --git a/erts/emulator/test/statistics_SUITE.erl b/erts/emulator/test/statistics_SUITE.erl index 12b35cbcdf..b99d567772 100644 --- a/erts/emulator/test/statistics_SUITE.erl +++ b/erts/emulator/test/statistics_SUITE.erl @@ -91,7 +91,7 @@ wall_clock_zero_diff1(N) when N > 0 -> _ -> wall_clock_zero_diff1(N-1) end; wall_clock_zero_diff1(0) -> - ?line test_server:fail("Difference never zero."). + ct:fail("Difference never zero."). wall_clock_update(doc) -> "Test that the time differences returned by two calls to " @@ -136,7 +136,7 @@ runtime_zero_diff1(N) when N > 0 -> _ -> runtime_zero_diff1(N-1) end; runtime_zero_diff1(0) -> - ?line test_server:fail("statistics(runtime) never returned zero difference"). + ct:fail("statistics(runtime) never returned zero difference"). runtime_update(doc) -> "Test that the statistics(runtime) returns a substanstially " @@ -272,7 +272,7 @@ run_queue_one_test(Config) when is_list(Config) -> ?line receive after 100 -> ok end, % Give hog a head start. ?line case statistics(run_queue) of N when N >= 1 -> ok; - Other -> ?line ?t:fail({unexpected,Other}) + Other -> ct:fail({unexpected,Other}) end, ok. diff --git a/erts/emulator/test/system_profile_SUITE.erl b/erts/emulator/test/system_profile_SUITE.erl index 4ac48872df..0becf88f7a 100644 --- a/erts/emulator/test/system_profile_SUITE.erl +++ b/erts/emulator/test/system_profile_SUITE.erl @@ -452,7 +452,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) -> @@ -463,7 +463,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) -> @@ -471,7 +471,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) -> @@ -481,7 +481,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/erts/emulator/test/time_SUITE.erl b/erts/emulator/test/time_SUITE.erl index f6f99a0c81..c27de24690 100644 --- a/erts/emulator/test/time_SUITE.erl +++ b/erts/emulator/test/time_SUITE.erl @@ -334,7 +334,7 @@ timestamp(Config) when is_list(Config) -> true -> {skip, "Seems to be time warp test run..."}; false -> - test_server:fail(Failure) + ct:fail(Failure) end end. @@ -368,9 +368,7 @@ repeating_timestamp_check(N) -> C < 1000000 -> ok; true -> - test_server:fail( - lists:flatten( - io_lib:format("Strange return from os:timestamp/0 ~w~n",[TS]))) + ct:fail("Strange return from os:timestamp/0 ~w~n",[TS]) end, %% I assume the now and timestamp should not differ more than 1 hour, %% which is safe assuming the system has not had a large time-warp @@ -409,7 +407,7 @@ now_unique(Config) when is_list(Config) -> now_unique(N, Previous, Result) when N > 0 -> ?line case now() of Previous -> - test_server:fail("now/0 returned the same value twice"); + ct:fail("now/0 returned the same value twice"); New -> now_unique(N-1, New, [New|Result]) end; @@ -426,7 +424,7 @@ fast_now_unique(0, _) -> ok; fast_now_unique(N, Then) -> case now() of Then -> - ?line ?t:fail("now/0 returned the same value twice"); + ?line ct:fail("now/0 returned the same value twice"); Now -> fast_now_unique(N-1, Now) end. @@ -474,7 +472,7 @@ now_update1(N) when N > 0 -> _ -> now_update1(N-1) end; now_update1(0) -> - ?line test_server:fail(). + ct:fail("now_update zero"). time_warp_modes(Config) when is_list(Config) -> %% All time warp modes always supported in @@ -551,14 +549,14 @@ check_time_warp_mode(Config, TimeCorrection, TimeWarpMode) -> io:format("Uptime inconsistency", []), case {TimeCorrection, erlang:system_info(time_correction)} of {true, true} -> - ?t:fail(uptime_inconsistency); + ct:fail(uptime_inconsistency); {true, false} -> _ = erlang:time_offset(), receive {'CHANGE', Mon, time_offset, clock_service, _} -> ignore after 1000 -> - ?t:fail(uptime_inconsistency) + ct:fail(uptime_inconsistency) end; _ -> ignore @@ -728,7 +726,7 @@ check_time_offset_res_conv(Mon, Res) -> TORes2 -> case check_time_offset_change(Mon, TO, 1000) of {TO, false} -> - ?t:fail({time_unit_conversion_inconsistency, + ct:fail({time_unit_conversion_inconsistency, TO, TORes, TORes2}); {_NewTO, true} -> ?t:format("time_offset changed", []), @@ -787,7 +785,7 @@ chk_random_values(FR, TR) -> {true, true} -> ok; Failure -> - ?t:fail({Failure, CV, V, FR, TR}) + ct:fail({Failure, CV, V, FR, TR}) end end, lists:foreach(CheckFun, Values). @@ -801,7 +799,7 @@ chk_values_per_value(_FromRes, _ToRes, case ((MinFromValuesPerToValue =< FromValueCount) andalso (FromValueCount =< MaxFromValuesPerToValue)) of false -> - ?t:fail({MinFromValuesPerToValue, + ct:fail({MinFromValuesPerToValue, FromValueCount, MaxFromValuesPerToValue}); true -> @@ -821,7 +819,7 @@ chk_values_per_value(FromRes, ToRes, Value, EndValue, case ((MinFromValuesPerToValue =< FromValueCount) andalso (FromValueCount =< MaxFromValuesPerToValue)) of false -> - ?t:fail({MinFromValuesPerToValue, + ct:fail({MinFromValuesPerToValue, FromValueCount, MaxFromValuesPerToValue}); true -> @@ -878,7 +876,7 @@ do_check_erlang_timestamp(Done, Mon, TO) -> "checking for time_offset change...", []), case check_time_offset_change(Mon, TO, 1000) of {TO, false} -> - ?t:fail(timestamp_inconsistency); + ct:fail(timestamp_inconsistency); {NewTO, true} -> ?t:format("time_offset changed", []), check_erlang_timestamp(Done, Mon, NewTO) diff --git a/erts/emulator/test/timer_bif_SUITE.erl b/erts/emulator/test/timer_bif_SUITE.erl index dca44a1891..adc25b9426 100644 --- a/erts/emulator/test/timer_bif_SUITE.erl +++ b/erts/emulator/test/timer_bif_SUITE.erl @@ -108,7 +108,7 @@ start_timer_big(Config) when is_list(Config) -> Diff when Diff >= 200, Diff < 10000 -> ok; _Diff -> - test_server:fail({big, Big, Left}) + ct:fail({big, Big, Left}) end, ok. @@ -122,7 +122,7 @@ send_after_big(Config) when is_list(Config) -> Diff when Diff >= 200, Diff < 10000 -> ok; _Diff -> - test_server:fail({big, Big, Left}) + ct:fail({big, Big, Left}) end, ok. @@ -232,7 +232,7 @@ read_timer(Config) when is_list(Config) -> Diff when Diff >= 200, Diff < 10000 -> ok; _Diff -> - test_server:fail({big, Big, Left}) + ct:fail({big, Big, Left}) end, process_flag(scheduler, 0), ok. @@ -264,7 +264,7 @@ read_timer_async(Config) when is_list(Config) -> Diff when Diff >= 200, Diff < 10000 -> ok; _Diff -> - test_server:fail({big, Big, Left}) + ct:fail({big, Big, Left}) end, process_flag(scheduler, 0), ok. diff --git a/erts/emulator/test/trace_SUITE.erl b/erts/emulator/test/trace_SUITE.erl index b74d1b383a..5982383f13 100644 --- a/erts/emulator/test/trace_SUITE.erl +++ b/erts/emulator/test/trace_SUITE.erl @@ -524,7 +524,7 @@ do_system_monitor_long_schedule() -> {Self,L} when is_list(L) -> ok after 1000 -> - ?t:fail(no_trace_of_pid) + ct:fail(no_trace_of_pid) end, "ok" = erlang:port_control(Port,1,[]), "ok" = erlang:port_control(Port,2,[]), @@ -532,7 +532,7 @@ do_system_monitor_long_schedule() -> {Port,LL} when is_list(LL) -> ok after 1000 -> - ?t:fail(no_trace_of_port) + ct:fail(no_trace_of_port) end, port_close(Port), erlang:system_monitor(undefined), @@ -613,11 +613,11 @@ long_gc(LoadFun, ExpectMonMsg) -> {ok, true} when Pid =/= Self -> ok; {ok, false} -> - ?line ?t:fail(unexpected_system_monitor_message_received); + ?line ct:fail(unexpected_system_monitor_message_received); {undefined, false} -> ok; {undefined, true} -> - ?line ?t:fail(no_system_monitor_message_received) + ?line ct:fail(no_system_monitor_message_received) end. long_gc_check(Pid, Time, Result) -> @@ -707,11 +707,11 @@ large_heap(LoadFun, ExpectMonMsg) -> {ok, true} when Pid =/= Self -> ?line ok; {ok, false} -> - ?line ?t:fail(unexpected_system_monitor_message_received); + ?line ct:fail(unexpected_system_monitor_message_received); {undefined, false} -> ?line ok; {undefined, true} -> - ?line ?t:fail(no_system_monitor_message_received) + ?line ct:fail(no_system_monitor_message_received) end, ok. @@ -808,7 +808,7 @@ do_suspend(Pid, N) -> {status, runnable} -> ?line ok; {status, running} -> ?line ok; {status, garbage_collecting} -> ?line ok; - ST -> ?line ?t:fail(ST) + ST -> ?line ct:fail(ST) end, ?line erlang:yield(), ?line do_suspend(Pid, N-1). @@ -1070,7 +1070,7 @@ suspend_until_system_limit(P, N, M) -> ?line ?t:format("system limit at ~p~n", [N]), ?line resume_from_system_limit(P, N, 0); Error -> - ?line ?t:fail(Error) + ?line ct:fail(Error) end. resume_from_system_limit(P, 0, _) -> @@ -1221,7 +1221,7 @@ suspend_count(Suspender, Suspendee) -> case lists:keysearch(Suspendee, 1, SList) of {value, {_Suspendee, 0, 0}} -> - ?line ?t:fail({bad_suspendee_list, SList}); + ?line ct:fail({bad_suspendee_list, SList}); {value, {Suspendee, Count, 0}} when is_integer(Count), Count > 0 -> {status, suspended} = process_info(Suspendee, status), Count; @@ -1231,7 +1231,7 @@ suspend_count(Suspender, Suspendee) -> false -> 0; Error -> - ?line ?t:fail({bad_suspendee_list, Error, SList}) + ?line ct:fail({bad_suspendee_list, Error, SList}) end. repeat_acc(Fun, N, Acc) -> @@ -1318,7 +1318,7 @@ trace_delivered(Config) when is_list(Config) -> ?line NoOfTraceMessages = drop_trace_until_down(Tok, Mon), ?line receive Msg -> - ?line ?t:fail({unexpected_message, Msg}) + ?line ct:fail({unexpected_message, Msg}) after 1000 -> ?line ok end. @@ -1363,7 +1363,7 @@ receive_first() -> receive_nothing() -> receive Any -> - test_server:fail({unexpected_message, Any}) + ct:fail({unexpected_message, Any}) after 200 -> ok end. diff --git a/erts/emulator/test/trace_bif_SUITE.erl b/erts/emulator/test/trace_bif_SUITE.erl index ae98cc7189..e3e4e2e6d8 100644 --- a/erts/emulator/test/trace_bif_SUITE.erl +++ b/erts/emulator/test/trace_bif_SUITE.erl @@ -256,59 +256,49 @@ do_trace_bif_return(TsType, TsFlags) -> receive_trace_msg(Mess) -> receive - Mess -> - ok; - Other -> - io:format("Expected: ~p,~nGot: ~p~n", [Mess, Other]), - ?t:fail() + Mess -> + ok; + Other -> + ct:fail("Expected: ~p,~nGot: ~p~n", [Mess, Other]) after 5000 -> - io:format("Expected: ~p,~nGot: timeout~n", [Mess]), - ?t:fail() + ct:fail("Expected: ~p,~nGot: timeout~n", [Mess]) end. receive_trace_msg_ts({trace_ts, Pid, call, {erlang,F,A}}, PrevTs, TsType) -> receive - {trace_ts, Pid, call, {erlang, F, A}, Ts} -> - check_ts(TsType, PrevTs, Ts), - Ts; - Other -> - io:format("Expected: {trace, ~p, call, {~p, ~p, ~p}, TimeStamp}},~n" - "Got: ~p~n", - [Pid, erlang, F, A, Other]), - ?t:fail() - after 5000 -> - io:format("Got timeout~n", []), - ?t:fail() + {trace_ts, Pid, call, {erlang, F, A}, Ts} -> + check_ts(TsType, PrevTs, Ts), + Ts; + Other -> + ct:fail("Expected: {trace, ~p, call, {~p, ~p, ~p}, TimeStamp}},~n" + "Got: ~p~n", + [Pid, erlang, F, A, Other]) + after 5000 -> + ct:fail("Got timeout~n", []) end. receive_trace_msg_ts_return_from({trace_ts, Pid, return_from, {erlang,F,A}}, PrevTs, TsType) -> receive - {trace_ts, Pid, return_from, {erlang, F, A}, _Value, Ts} -> - check_ts(TsType, PrevTs, Ts), - Ts; - Other -> - io:format("Expected: {trace_ts, ~p, return_from, {~p, ~p, ~p}, Value, TimeStamp}},~n" - "Got: ~p~n", - [Pid, erlang, F, A, Other]), - ?t:fail() - after 5000 -> - io:format("Got timeout~n", []), - ?t:fail() + {trace_ts, Pid, return_from, {erlang, F, A}, _Value, Ts} -> + check_ts(TsType, PrevTs, Ts), + Ts; + Other -> + ct:fail("Expected: {trace_ts, ~p, return_from, {~p, ~p, ~p}, Value, TimeStamp}},~n" + "Got: ~p~n", [Pid, erlang, F, A, Other]) + after 5000 -> + ct:fail("Got timeout~n", []) end. receive_trace_msg_ts_return_to({trace_ts, Pid, return_to, {M,F,A}}, PrevTs, TsType) -> receive - {trace_ts, Pid, return_to, {M, F, A}, Ts} -> - check_ts(TsType, PrevTs, Ts), - Ts; - Other -> - io:format("Expected: {trace_ts, ~p, return_to, {~p, ~p, ~p}, TimeStamp}},~n" - "Got: ~p~n", - [Pid, M, F, A, Other]), - ?t:fail() - after 5000 -> - io:format("Got timeout~n", []), - ?t:fail() + {trace_ts, Pid, return_to, {M, F, A}, Ts} -> + check_ts(TsType, PrevTs, Ts), + Ts; + Other -> + ct:fail("Expected: {trace_ts, ~p, return_to, {~p, ~p, ~p}, TimeStamp}},~n" + "Got: ~p~n", [Pid, M, F, A, Other]) + after 5000 -> + ct:fail("Got timeout~n", []) end. make_ts(timestamp) -> diff --git a/erts/emulator/test/trace_local_SUITE.erl b/erts/emulator/test/trace_local_SUITE.erl index 193efba99c..2b142596a3 100644 --- a/erts/emulator/test/trace_local_SUITE.erl +++ b/erts/emulator/test/trace_local_SUITE.erl @@ -611,9 +611,7 @@ verify_trace_info({LocalFlag,Bool}, _, Local) when is_boolean(Bool) -> Bool = lists:member(LocalFlag, Local) catch error:_ -> - io:format("Line ~p: {~p,~p}, false, ~p\n", - [?LINE,LocalFlag,Bool,Local]), - ?t:fail() + ct:fail("Line ~p: {~p,~p}, false, ~p\n", [?LINE,LocalFlag,Bool,Local]) end; verify_trace_info({meta,Pid}, false, Local) when is_pid(Pid) -> true = lists:member(meta, Local); @@ -1323,12 +1321,12 @@ receive_next(TO) -> M -> M after TO -> - ?t:fail(timeout) + ct:fail(timeout) end. receive_no_next(TO) -> receive M -> - ?t:fail({unexpected_message,[M|flush(TO)]}) + ct:fail({unexpected_message,[M|flush(TO)]}) after TO -> ok end. diff --git a/erts/emulator/test/trace_meta_SUITE.erl b/erts/emulator/test/trace_meta_SUITE.erl index eababe02fe..a2db701d36 100644 --- a/erts/emulator/test/trace_meta_SUITE.erl +++ b/erts/emulator/test/trace_meta_SUITE.erl @@ -530,7 +530,7 @@ combo_test() -> {?RT(Slave,{?MODULE,receiver,1}), ?RF(Slave,{erlang,phash2,2},0)} -> ok; - Error1 -> ?t:fail({unexpected_message, Error1}) + Error1 -> ct:fail({unexpected_message, Error1}) end, case {receive_next_bytag(LocalTracer), receive_next_bytag(LocalTracer)} of @@ -540,7 +540,7 @@ combo_test() -> {?RT(Slave,{?MODULE,slave,1}), ?RF(Slave,{?MODULE,receiver,1},Ref)} -> ok; - Error2 -> ?t:fail({unexpected_message, Error2}) + Error2 -> ct:fail({unexpected_message, Error2}) end, shutdown(), ?NM, @@ -729,13 +729,13 @@ receive_next(TO) -> M -> M after TO -> - ?t:fail(timeout) + ct:fail(timeout) end. receive_no_next(TO) -> receive M -> - ?t:fail({unexpected_message, M}) + ct:fail({unexpected_message, M}) after TO -> ok diff --git a/erts/emulator/test/trace_nif_SUITE.erl b/erts/emulator/test/trace_nif_SUITE.erl index 3ac891b1dd..f61e11595f 100644 --- a/erts/emulator/test/trace_nif_SUITE.erl +++ b/erts/emulator/test/trace_nif_SUITE.erl @@ -220,14 +220,12 @@ trace_nif_return(Config) when is_list(Config) -> receive_trace_msg(Mess) -> receive - Mess -> - ok; - Other -> - io:format("Expected: ~p,~nGot: ~p~n", [Mess, Other]), - ?t:fail() + Mess -> + ok; + Other -> + ct:fail("Expected: ~p,~nGot: ~p~n", [Mess, Other]) after 5000 -> - io:format("Expected: ~p,~nGot: timeout~n", [Mess]), - ?t:fail() + ct:fail("Expected: ~p,~nGot: timeout~n", [Mess]) end. receive_nothing() -> @@ -235,44 +233,35 @@ receive_nothing() -> receive_trace_msg_ts({trace_ts, Pid, call, {M,F,A}}) -> receive - {trace_ts, Pid, call, {M, F, A}, _Ts} -> - ok; - Other -> - io:format("Expected: {trace, ~p, call, {~p, ~p, ~p}, TimeStamp}},~n" - "Got: ~p~n", - [Pid, M, F, A, Other]), - ?t:fail() + {trace_ts, Pid, call, {M, F, A}, _Ts} -> + ok; + Other -> + ct:fail("Expected: {trace, ~p, call, {~p, ~p, ~p}, TimeStamp}},~n" + "Got: ~p~n", [Pid, M, F, A, Other]) after 5000 -> - io:format("Got timeout~n", []), - ?t:fail() + ct:fail("Got timeout~n", []) end. receive_trace_msg_ts_return_from({trace_ts, Pid, return_from, {M,F,A}}) -> receive - {trace_ts, Pid, return_from, {M, F, A}, _Value, _Ts} -> - ok; - Other -> - io:format("Expected: {trace_ts, ~p, return_from, {~p, ~p, ~p}, Value, TimeStamp}},~n" - "Got: ~p~n", - [Pid, M, F, A, Other]), - ?t:fail() + {trace_ts, Pid, return_from, {M, F, A}, _Value, _Ts} -> + ok; + Other -> + ct:fail("Expected: {trace_ts, ~p, return_from, {~p, ~p, ~p}, Value, TimeStamp}},~n" + "Got: ~p~n", [Pid, M, F, A, Other]) after 5000 -> - io:format("Got timeout~n", []), - ?t:fail() + ct:fail("Got timeout~n", []) end. receive_trace_msg_ts_return_to({trace_ts, Pid, return_to, {M,F,A}}) -> receive - {trace_ts, Pid, return_to, {M, F, A}, _Ts} -> - ok; - Other -> - io:format("Expected: {trace_ts, ~p, return_to, {~p, ~p, ~p}, TimeStamp}},~n" - "Got: ~p~n", - [Pid, M, F, A, Other]), - ?t:fail() + {trace_ts, Pid, return_to, {M, F, A}, _Ts} -> + ok; + Other -> + ct:fail("Expected: {trace_ts, ~p, return_to, {~p, ~p, ~p}, TimeStamp}},~n" + "Got: ~p~n", [Pid, M, F, A, Other]) after 5000 -> - io:format("Got timeout~n", []), - ?t:fail() + ct:fail("Got timeout~n", []) end. nif_process() -> diff --git a/erts/emulator/test/trace_port_SUITE.erl b/erts/emulator/test/trace_port_SUITE.erl index e4c58860ad..18a475f04b 100644 --- a/erts/emulator/test/trace_port_SUITE.erl +++ b/erts/emulator/test/trace_port_SUITE.erl @@ -477,7 +477,7 @@ tracer_port_crash(Config) when is_list(Config) -> Id -> % erts_debug:set_internal_state(available_internal_state, true), % erts_debug:set_internal_state(abort, {trace_port_linker, Id}) - ?t:fail({trace_port_linker, Id}) + ct:fail({trace_port_linker, Id}) end, undefined = process_info(Tracee), ok @@ -498,7 +498,7 @@ expect() -> receive Other -> ok = io:format("Unexpected; got ~p", [Other]), - test_server:fail({unexpected, Other}) + ct:fail({unexpected, Other}) after 200 -> ok end. @@ -510,10 +510,10 @@ expect({trace_ts,E1,E2,info,ts}=Message) -> MessageTs; Other -> io:format("Expected ~p; got ~p", [Message,Other]), - test_server:fail({unexpected,Other}) + ct:fail({unexpected,Other}) after 5000 -> io:format("Expected ~p; got nothing", [Message]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect({trace,E1,E2,info}=Message) -> receive @@ -522,10 +522,10 @@ expect({trace,E1,E2,info}=Message) -> MessageTs; Other -> io:format("Expected ~p; got ~p", [Message,Other]), - test_server:fail({unexpected,Other}) + ct:fail({unexpected,Other}) after 5000 -> io:format("Expected ~p; got nothing", [Message]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect({trace_ts,E1,E2,E3,ts}=Message) -> receive @@ -534,10 +534,10 @@ expect({trace_ts,E1,E2,E3,ts}=Message) -> MessageTs; Other -> io:format("Expected ~p; got ~p", [Message,Other]), - test_server:fail({unexpected,Other}) + ct:fail({unexpected,Other}) after 5000 -> io:format("Expected ~p; got nothing", [Message]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect({trace_ts,E1,E2,E3,E4,ts}=Message) -> receive @@ -546,10 +546,10 @@ expect({trace_ts,E1,E2,E3,E4,ts}=Message) -> MessageTs; Other -> io:format("Expected ~p; got ~p", [Message,Other]), - test_server:fail({unexpected,Other}) + ct:fail({unexpected,Other}) after 5000 -> io:format("Expected ~p; got nothing", [Message]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end; expect(Message) -> receive @@ -558,10 +558,10 @@ expect(Message) -> Message; Other -> io:format("Expected ~p; got ~p", [Message,Other]), - test_server:fail({unexpected,Other}) + ct:fail({unexpected,Other}) after 5000 -> io:format("Expected ~p; got nothing", [Message]), - test_server:fail(no_trace_message) + ct:fail(no_trace_message) end. trac(What, On, Flags0) -> diff --git a/erts/emulator/test/tuple_SUITE.erl b/erts/emulator/test/tuple_SUITE.erl index 2c2f93e7ee..fb44be3145 100644 --- a/erts/emulator/test/tuple_SUITE.erl +++ b/erts/emulator/test/tuple_SUITE.erl @@ -259,7 +259,7 @@ t_make_tuple(Size, Element) -> lists:foreach(fun(El) when El =:= Element -> ok; (Other) -> - test_server:fail({got, Other, expected, Element}) + ct:fail({got, Other, expected, Element}) end, tuple_to_list(Tuple)). %% Tests the erlang:make_tuple/3 BIF. @@ -385,14 +385,14 @@ tuple_in_guard(Config) when is_list(Config) -> Tuple1 == {element(1, Tuple2),element(2, Tuple2)} -> ok; true -> - test_server:fail() + ct:fail("failed") end, if Tuple2 == {element(1, Tuple2),element(2, Tuple2), element(3, Tuple2)} -> ok; true -> - test_server:fail() + ct:fail("failed") end, ok. diff --git a/erts/emulator/test/unique_SUITE.erl b/erts/emulator/test/unique_SUITE.erl index ac69e283ae..96c327c6ce 100644 --- a/erts/emulator/test/unique_SUITE.erl +++ b/erts/emulator/test/unique_SUITE.erl @@ -67,7 +67,7 @@ unique_monotonic_integer_white_box(Config) when is_list(Config) -> Mon = erlang:monitor(process, Test), receive {'DOWN', Mon, process, Test, Error} -> - ?t:fail(Error); + ct:fail(Error); Success -> ok end, diff --git a/erts/emulator/test/z_SUITE.erl b/erts/emulator/test/z_SUITE.erl index 3e32f56aeb..8b38334149 100644 --- a/erts/emulator/test/z_SUITE.erl +++ b/erts/emulator/test/z_SUITE.erl @@ -63,7 +63,7 @@ schedulers_alive(Config) when is_list(Config) -> ?line ?t:format("Number of schedulers configured: ~p~n", [NoSchedulers]), ?line case erlang:system_info(multi_scheduling) of blocked -> - ?line ?t:fail(multi_scheduling_blocked); + ?line ct:fail(multi_scheduling_blocked); disabled -> ?line ok; enabled -> @@ -90,7 +90,7 @@ schedulers_alive(Config) when is_list(Config) -> ?line erlang:system_flag(multi_scheduling, block), ?line case erlang:system_info(multi_scheduling) of enabled -> - ?line ?t:fail(multi_scheduling_enabled); + ?line ct:fail(multi_scheduling_enabled); blocked -> ?line [Master] = erlang:system_info(multi_scheduling_blockers); disabled -> ?line ok @@ -112,7 +112,7 @@ schedulers_alive(Config) when is_list(Config) -> end, Ps), ?line case erlang:system_flag(multi_scheduling, unblock) of - blocked -> ?line ?t:fail(multi_scheduling_blocked); + blocked -> ?line ct:fail(multi_scheduling_blocked); disabled -> ?line ok; enabled -> ?line ok end, @@ -180,7 +180,7 @@ verify_all_schedulers_used({UsedSIDs, UsedSIDsLen} = State, NoSchedulers) -> UsedSIDsLen -> ?line State; NoSchdlrs when NoSchdlrs < UsedSIDsLen -> - ?line ?t:fail({more_schedulers_used_than_exist, + ?line ct:fail({more_schedulers_used_than_exist, {existing_schedulers, NoSchdlrs}, {used_schedulers, UsedSIDsLen}, {used_scheduler_ids, UsedSIDs}}); @@ -215,7 +215,7 @@ pollset_size(Config) when is_list(Config) -> ?line erlang:demonitor(Mon, [flush]), ?line ICIO; {'DOWN', Mon, _, _, Reason} -> - ?line ?t:fail({non_existing, Name, Reason}) + ?line ct:fail({non_existing, Name, Reason}) end, ?line FinChkIo = get_check_io_info(), ?line io:format("Initial: ~p~nFinal: ~p~n", [InitChkIo, FinChkIo]), -- cgit v1.2.3