From 575c1d99d37e541d802c51a62326b6faa3cffbf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Mon, 18 Apr 2016 08:14:19 +0200 Subject: Eliminate use of test_server:fail/{0,1} --- lib/debugger/test/andor_SUITE.erl | 2 +- lib/debugger/test/bs_construct_SUITE.erl | 14 +++++++------- lib/debugger/test/bs_match_int_SUITE.erl | 2 +- lib/debugger/test/bs_match_misc_SUITE.erl | 6 +++--- lib/debugger/test/dbg_ui_SUITE.erl | 2 +- lib/debugger/test/erl_eval_SUITE.erl | 10 +++++----- lib/debugger/test/exception_SUITE.erl | 8 ++++---- lib/debugger/test/fun_SUITE.erl | 20 ++++++++++---------- lib/debugger/test/guard_SUITE.erl | 18 +++++++++--------- lib/debugger/test/int_eval_SUITE.erl | 12 ++++++------ lib/debugger/test/lc_SUITE.erl | 2 +- lib/debugger/test/map_SUITE.erl | 4 ++-- lib/debugger/test/record_SUITE.erl | 6 +++--- 13 files changed, 53 insertions(+), 53 deletions(-) diff --git a/lib/debugger/test/andor_SUITE.erl b/lib/debugger/test/andor_SUITE.erl index d8f452f698..3427869285 100644 --- a/lib/debugger/test/andor_SUITE.erl +++ b/lib/debugger/test/andor_SUITE.erl @@ -308,7 +308,7 @@ in_case_1_guard(LenUp, LenDw, LenN, Rotation, Count) -> check(V1, V0) -> if V1 /= V0 -> io:fwrite("error: ~w.\n", [V1]), - ?t:fail(); + ct:fail(failed); true -> io:fwrite("ok: ~w.\n", [V1]) end. diff --git a/lib/debugger/test/bs_construct_SUITE.erl b/lib/debugger/test/bs_construct_SUITE.erl index bd940e43e1..330afbe00a 100644 --- a/lib/debugger/test/bs_construct_SUITE.erl +++ b/lib/debugger/test/bs_construct_SUITE.erl @@ -204,7 +204,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 -> @@ -212,7 +212,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]), @@ -233,7 +233,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 @@ -268,14 +268,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) -> []; @@ -627,7 +627,7 @@ copy_writable_binary_1(_) -> {Pid,Bin0,Bin0} -> ok; Other -> io:format("Unexpected message: ~p", [Other]), - ?line ?t:fail() + ct:fail(failed) end, ok. @@ -655,7 +655,7 @@ dynamic(Config) when is_list(Config) -> {'DOWN',Ref,process,Pid,normal} -> ok; {'DOWN',Ref,process,Pid,Exit} -> - ?t:fail({Pid,Exit}) + ct:fail({Pid,Exit}) end || {Pid,Ref} <- Ps], ok. diff --git a/lib/debugger/test/bs_match_int_SUITE.erl b/lib/debugger/test/bs_match_int_SUITE.erl index c66b6c99cc..81460361b1 100644 --- a/lib/debugger/test/bs_match_int_SUITE.erl +++ b/lib/debugger/test/bs_match_int_SUITE.erl @@ -163,7 +163,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(failed) end end, ?line more_dynamic1(Signed, funny_binary(43)), diff --git a/lib/debugger/test/bs_match_misc_SUITE.erl b/lib/debugger/test/bs_match_misc_SUITE.erl index 67847ff260..c375d267e3 100644 --- a/lib/debugger/test/bs_match_misc_SUITE.erl +++ b/lib/debugger/test/bs_match_misc_SUITE.erl @@ -409,9 +409,9 @@ x0_2(_, Bin) -> x0_3(_, Bin) -> case Bin of <<_:72,7:8,_/binary>> -> - ?line ?t:fail(); + ct:fail(failed); <<_:64,0:16,_/binary>> -> - ?line ?t:fail(); + ct:fail(failed); <<_:64,42:16,123456:32,_/binary>> -> ok end. @@ -525,7 +525,7 @@ do_otp_7198(FillerSize) -> ok; {'DOWN',Ref,process,Pid,Reason} -> io:format("unexpected: ~p", [Reason]), - ?line ?t:fail() + ct:fail(failed) end. do_otp_7198_test(_) -> diff --git a/lib/debugger/test/dbg_ui_SUITE.erl b/lib/debugger/test/dbg_ui_SUITE.erl index e18c1ae8e2..58a784a642 100644 --- a/lib/debugger/test/dbg_ui_SUITE.erl +++ b/lib/debugger/test/dbg_ui_SUITE.erl @@ -144,7 +144,7 @@ check(Case, Config) -> pass -> ?line ok; fail -> - ?line test_server:fail("Manual test failed"); + ct:fail("Manual test failed"); unknown -> ?line {skipped, "Manual test result unknown"}; diff --git a/lib/debugger/test/erl_eval_SUITE.erl b/lib/debugger/test/erl_eval_SUITE.erl index e1f35cfa4e..0cc6a87972 100644 --- a/lib/debugger/test/erl_eval_SUITE.erl +++ b/lib/debugger/test/erl_eval_SUITE.erl @@ -1348,7 +1348,7 @@ check1(F, String, Result) -> {value, Result, _} -> ok; Other -> - test_server:fail({eval, Other, Result}) + ct:fail({eval, Other, Result}) end. check(F, String, Result, BoundVars, LFH, EFH) -> @@ -1361,11 +1361,11 @@ check(F, String, Result, BoundVars, LFH, EFH) -> true -> ok; false -> - test_server:fail({check, BoundVars, Keys}) + ct:fail({check, BoundVars, Keys}) end, ok; Other -> - test_server:fail({check, Other, Result}) + ct:fail({check, Other, Result}) end. error_check(String, Result) -> @@ -1373,7 +1373,7 @@ error_check(String, Result) -> {'EXIT', {Result,_}} -> ok; Other -> - test_server:fail({eval, Other, Result}) + ct:fail({eval, Other, Result}) end. error_check(String, Result, LFH, EFH) -> @@ -1381,7 +1381,7 @@ error_check(String, Result, LFH, EFH) -> {'EXIT', {Result,_}} -> ok; Other -> - test_server:fail({eval, Other, Result}) + ct:fail({eval, Other, Result}) end. eval_string(String) -> diff --git a/lib/debugger/test/exception_SUITE.erl b/lib/debugger/test/exception_SUITE.erl index 9ae2730a61..1a72b3c525 100644 --- a/lib/debugger/test/exception_SUITE.erl +++ b/lib/debugger/test/exception_SUITE.erl @@ -147,7 +147,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) -> @@ -159,9 +159,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). @@ -177,7 +177,7 @@ pending({Code,[{?MODULE,Func,Arity,_}|_]}, Func, Args, Code) when length(Args) == Arity -> 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/lib/debugger/test/fun_SUITE.erl b/lib/debugger/test/fun_SUITE.erl index 00a268e1ba..4beedc550c 100644 --- a/lib/debugger/test/fun_SUITE.erl +++ b/lib/debugger/test/fun_SUITE.erl @@ -100,7 +100,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) -> @@ -112,7 +112,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) -> @@ -139,7 +139,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 external funs with wrong number of arguments. @@ -159,7 +159,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}) + ct:fail({bad_result,Res}) end, %% Apply. @@ -172,7 +172,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}) + ct:fail({bad_result,Res2}) end, ok. @@ -193,7 +193,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}) + ct:fail({bad_result,Res}) end, %% Apply. @@ -206,7 +206,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}) + ct:fail({bad_result,Res2}) end, ok. @@ -228,12 +228,12 @@ otp_6061(Config) when is_list(Config) -> working -> ?line ok; not_working -> - ?line ?t:fail(not_working); + ct:fail(not_working); {'EXIT', Pid, Reason} -> - ?line ?t:fail({crash, Reason}) + ct:fail({crash, Reason}) after 5000 -> - ?line ?t:fail(timeout) + ct:fail(timeout) end, ?line process_flag(trap_exit, OrigFlag), diff --git a/lib/debugger/test/guard_SUITE.erl b/lib/debugger/test/guard_SUITE.erl index 85c0eb613b..81b72db9f5 100644 --- a/lib/debugger/test/guard_SUITE.erl +++ b/lib/debugger/test/guard_SUITE.erl @@ -187,9 +187,9 @@ try_fun(Iter, Fun, Args, Result, Filler) -> ?line try_fun(Iter-1, Fun, Args, Result, [0|Filler]); {'EXIT',Pid,{result,Other}} -> ?line io:format("Expected ~p; got ~p~n", [Result,Other]), - ?line test_server:fail(); + ct:fail(failed); Other -> - ?line test_server:fail({unexpected_message,Other}) + ct:fail({unexpected_message,Other}) end. init(_ReplyTo, Fun, Args, Filler) -> @@ -291,7 +291,7 @@ try_gbif(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(failed) end. try_fail_gbif(Id, X, Y) -> @@ -301,7 +301,7 @@ try_fail_gbif(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(failed) end. guard_bif('abs/1', X, Y) when abs(X) == Y -> @@ -345,7 +345,7 @@ type_tests(Config) when list(Config) -> {Errors, Violations} -> io:format("~p sub test(s) failed, ~p violation(s)", [Errors, Violations]), - ?line test_server:fail() + ct:fail(failed) end. type_tests([{Test, AllowedTypes}| T], AllTypes) -> @@ -371,7 +371,7 @@ type_tests(Test, [Type|T], Allowed) -> [{?MODULE,type_test,[Test,Value],_}|_]}} -> ok; {'EXIT',Other} -> - ?line test_server:fail({unexpected_error_reason,Other}); + ct:fail({unexpected_error_reason,Other}); tuple when function(Value) -> io:format("Standard violation: Test ~p(~p) should fail", [Test, Value]), @@ -1658,11 +1658,11 @@ bptest(_,_,_) -> -define(FAILING(C), if - C -> ?t:fail(should_fail); + C -> ct:fail(should_fail); true -> ok end, if - true, C -> ?t:fail(should_fail); + true, C -> ct:fail(should_fail); true -> ok end). @@ -1687,7 +1687,7 @@ check(F, Result) -> Other -> io:format("Expected: ~p\n", [Result]), io:format(" Got: ~p\n", [Other]), - test_server:fail() + ct:fail(failed) end. fc({'EXIT',{function_clause,_}}) -> ok. diff --git a/lib/debugger/test/int_eval_SUITE.erl b/lib/debugger/test/int_eval_SUITE.erl index 9639b67c6c..524c0c525a 100644 --- a/lib/debugger/test/int_eval_SUITE.erl +++ b/lib/debugger/test/int_eval_SUITE.erl @@ -119,9 +119,9 @@ catch_and_throw(Config) when is_list(Config) -> ?line Pid1 = spawn_link(fun() -> exit(?IM:catch_a_ball()) end), receive {'EXIT',Pid1,ok} -> ok; - {'EXIT',Pid1,Bad1} -> ?line ?t:fail({bad_message,Bad1}) + {'EXIT',Pid1,Bad1} -> ct:fail({bad_message,Bad1}) after 5000 -> - ?line ?t:fail(timeout) + ct:fail(timeout) end, @@ -130,9 +130,9 @@ catch_and_throw(Config) when is_list(Config) -> ?line Pid2 = spawn_link(fun() -> ?IM:throw_a_ball() end), receive {'EXIT',Pid2,{{nocatch,{a,ball}},[_|_]}} -> ok; - {'EXIT',Pid2,Bad2} -> ?line ?t:fail({bad_message,Bad2}) + {'EXIT',Pid2,Bad2} -> ct:fail({bad_message,Bad2}) after 5000 -> - ?line ?t:fail(timeout) + ct:fail(timeout) end, ?line ok = ?IM:more_catch(fun(_) -> ?IM:exit_me() end), @@ -261,9 +261,9 @@ interpreted_exit(Config) when is_list(Config) -> {'EXIT',Pid,Reason} -> ok; {'EXIT',Pid,BadReason} -> - ?line ?t:fail({bad_message,BadReason}) + ct:fail({bad_message,BadReason}) after 10000 -> - ?line ?t:fail(timeout) + ct:fail(timeout) end, ok. diff --git a/lib/debugger/test/lc_SUITE.erl b/lib/debugger/test/lc_SUITE.erl index 8f4fe4d234..664a79ae5e 100644 --- a/lib/debugger/test/lc_SUITE.erl +++ b/lib/debugger/test/lc_SUITE.erl @@ -167,7 +167,7 @@ no_gen_verify(Res, A, B) -> ShouldBe -> ok; _ -> io:format("A = ~p; B = ~p; Expected = ~p, actual = ~p", [A,B,ShouldBe,Res]), - ?t:fail() + ct:fail(failed) end. no_gen_eval(Fun, Res) -> diff --git a/lib/debugger/test/map_SUITE.erl b/lib/debugger/test/map_SUITE.erl index eabcdcbf42..6209071f1a 100644 --- a/lib/debugger/test/map_SUITE.erl +++ b/lib/debugger/test/map_SUITE.erl @@ -2335,7 +2335,7 @@ t_build_and_match_empty_val(Config) when is_list(Config) -> {'EXIT',{function_clause,_}} -> ok; {'EXIT', {{case_clause,_},_}} -> {comment,inlined}; Other -> - test_server:fail({no_match, Other}) + ct:fail({no_match, Other}) end. t_build_and_match_val(Config) when is_list(Config) -> @@ -2353,7 +2353,7 @@ t_build_and_match_val(Config) when is_list(Config) -> {'EXIT',{function_clause,_}} -> ok; {'EXIT', {{case_clause,_},_}} -> {comment,inlined}; Other -> - test_server:fail({no_match, Other}) + ct:fail({no_match, Other}) end. t_build_and_match_nil(Config) when is_list(Config) -> diff --git a/lib/debugger/test/record_SUITE.erl b/lib/debugger/test/record_SUITE.erl index 8e01630e10..a045f6d529 100644 --- a/lib/debugger/test/record_SUITE.erl +++ b/lib/debugger/test/record_SUITE.erl @@ -118,8 +118,8 @@ update_foo_barf(#foo{}=R, A, _B, C, D, E) -> R#barf{a=A,b=A,c=C,d=D,e=E}. --define(TrueGuard(Expr), if Expr -> ok; true -> ?t:fail() end). --define(FalseGuard(Expr), if Expr -> ?t:fail(); true -> ok end). +-define(TrueGuard(Expr), if Expr -> ok; true -> ct:fail(failed) end). +-define(FalseGuard(Expr), if Expr -> ct:fail(failed); true -> ok end). record_test(Config) when is_list(Config) -> ?line true = is_record(#foo{}, foo), @@ -259,7 +259,7 @@ once(Test, Record) -> 1 -> ok; N -> io:format("Evaluated ~w times\n", [N]), - ?t:fail() + ct:fail(failed) end, Result. -- cgit v1.2.3