From dc42c5d1587a33ae2cc772d51fb6d900a41ec153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Mon, 21 Mar 2016 19:26:50 +0100 Subject: Eliminate use of test_server:fail/0,1 --- lib/erl_interface/test/all_SUITE_data/ei_runner.c | 8 ++++---- lib/erl_interface/test/all_SUITE_data/runner.c | 8 ++++---- lib/erl_interface/test/ei_accept_SUITE.erl | 4 ++-- lib/erl_interface/test/ei_connect_SUITE.erl | 4 ++-- lib/erl_interface/test/erl_connect_SUITE.erl | 2 +- lib/erl_interface/test/erl_eterm_SUITE.erl | 21 +++++++++++---------- lib/erl_interface/test/erl_global_SUITE.erl | 2 +- lib/erl_interface/test/runner.erl | 16 ++++++++-------- 8 files changed, 33 insertions(+), 32 deletions(-) diff --git a/lib/erl_interface/test/all_SUITE_data/ei_runner.c b/lib/erl_interface/test/all_SUITE_data/ei_runner.c index 3a0de22df4..2b0d6c856a 100644 --- a/lib/erl_interface/test/all_SUITE_data/ei_runner.c +++ b/lib/erl_interface/test/all_SUITE_data/ei_runner.c @@ -198,8 +198,8 @@ void free_packet(char* packet) * ----- ---------------------------- * [$b|Bytes] {bytes, Bytes} * [$e] eot - * [$f] test_server:fail() - * [$f|Reason] test_server:fail(Reason) + * [$f] ct:fail() + * [$f|Reason] ct:fail(Reason) * [$t|EncodedTerm] {term, Term} * [$N] 'NULL' * [$m|Message] io:format("~s", [Message]) (otherwise ignored) @@ -211,7 +211,7 @@ void free_packet(char* packet) * you implement a test case entirely in C code. * * If the ok argument is zero, a [$f] reply will be sent to the - * Erlang side (causing test_server:fail() to be called); otherwise, + * Erlang side (causing ct:fail() to be called); otherwise, * the atom 'eot' will be sent to Erlang. * * If you need to provide more details on a failure, use the fail() function. @@ -251,7 +251,7 @@ do_report(file, line, ok) /* - * This function causes a call to test_server:fail(Reason) on the + * This function causes a call to ct:fail(Reason) on the * Erlang side. */ diff --git a/lib/erl_interface/test/all_SUITE_data/runner.c b/lib/erl_interface/test/all_SUITE_data/runner.c index 47d918308d..2332db2220 100644 --- a/lib/erl_interface/test/all_SUITE_data/runner.c +++ b/lib/erl_interface/test/all_SUITE_data/runner.c @@ -200,8 +200,8 @@ char *read_packet(int *len) * ----- ---------------------------- * [$b|Bytes] {bytes, Bytes} * [$e] eot - * [$f] test_server:fail() - * [$f|Reason] test_server:fail(Reason) + * [$f] ct:fail() + * [$f|Reason] ct:fail(Reason) * [$t|EncodedTerm] {term, Term} * [$N] 'NULL' * [$m|Message] io:format("~s", [Message]) (otherwise ignored) @@ -213,7 +213,7 @@ char *read_packet(int *len) * you implement a test case entirely in C code. * * If the ok argument is zero, a [$f] reply will be sent to the - * Erlang side (causing test_server:fail() to be called); otherwise, + * Erlang side (causing ct:fail() to be called); otherwise, * the atom 'eot' will be sent to Erlang. * * If you need to provide more details on a failure, use the fail() function. @@ -253,7 +253,7 @@ do_report(file, line, ok) /* - * This function causes a call to test_server:fail(Reason) on the + * This function causes a call to ct:fail(Reason) on the * Erlang side. */ diff --git a/lib/erl_interface/test/ei_accept_SUITE.erl b/lib/erl_interface/test/ei_accept_SUITE.erl index aca051be14..654f2a4235 100644 --- a/lib/erl_interface/test/ei_accept_SUITE.erl +++ b/lib/erl_interface/test/ei_accept_SUITE.erl @@ -108,7 +108,7 @@ send_rec_einode(N, TestServerPid) -> Self= self(), case waitfornode(FirstPart,20) of true -> ok; - false -> test_server:fail({never_published,EINode}) + false -> ct:fail({never_published,EINode}) end, {any, EINode} ! Self, receive @@ -117,7 +117,7 @@ send_rec_einode(N, TestServerPid) -> TestServerPid ! N, X after 10000 -> - test_server:fail(EINode) + ct:fail(EINode) end. start_einode(Einode, N, Host, Port) -> diff --git a/lib/erl_interface/test/ei_connect_SUITE.erl b/lib/erl_interface/test/ei_connect_SUITE.erl index 54065b7e6a..1ef2525251 100644 --- a/lib/erl_interface/test/ei_connect_SUITE.erl +++ b/lib/erl_interface/test/ei_connect_SUITE.erl @@ -126,7 +126,7 @@ rec_einode(N, TestServerPid) -> TestServerPid ! N, X after 10000 -> - test_server:fail(Regname) + ct:fail(Regname) end. start_einode(Einode, N, Host) -> @@ -215,7 +215,7 @@ get_send_result(P) -> {term,{-1,Errno}} -> {error,Errno}; {term,{Res,Errno}}-> io:format("Return value: ~p\nerl_errno: ~p", [Res,Errno]), - ?t:fail(bad_return_value) + ct:fail(bad_return_value) end. send_command(P, Name, Args) -> diff --git a/lib/erl_interface/test/erl_connect_SUITE.erl b/lib/erl_interface/test/erl_connect_SUITE.erl index 9ed9293501..f035f1af56 100644 --- a/lib/erl_interface/test/erl_connect_SUITE.erl +++ b/lib/erl_interface/test/erl_connect_SUITE.erl @@ -120,7 +120,7 @@ get_send_result(P) -> {term,{-1,Errno}} -> {error,Errno}; {term,{Res,Errno}}-> io:format("Return value: ~p\nerl_errno: ~p", [Res,Errno]), - ?t:fail(bad_return_value) + ct:fail(bad_return_value) end. send_command(P, Name, Args) -> diff --git a/lib/erl_interface/test/erl_eterm_SUITE.erl b/lib/erl_interface/test/erl_eterm_SUITE.erl index cfa041201c..b342a2f1ef 100644 --- a/lib/erl_interface/test/erl_eterm_SUITE.erl +++ b/lib/erl_interface/test/erl_eterm_SUITE.erl @@ -937,6 +937,7 @@ collect_line(Port, Result) -> end after 5000 -> test_server:fail("No response from C program") + ct:fail("No response from C program") end. collect_line1([$\r|Rest], Result) -> @@ -987,9 +988,9 @@ cnode_1(Config) when is_list(Config) -> io:format("Ref1 ~p~n", [Ref1]), check_ref(Ref1), Ref2 = make_ref(), - receive - Pid -> Pid - end, + Pid = receive + Msg -> Msg %% pid + end, Fun1 = fun(X) -> {Pid, X} end, % sneak in a fun test here %Fun1 = {wait_with_funs, new_dist_format}, Term = {Ref2, Fun1, {1,2,3,4,5,6,7,8,9,10}}, @@ -1003,18 +1004,18 @@ cnode_1(Config) when is_list(Config) -> {Ref22,_,_} = Term2, check_ref(Ref22); X -> - test_server:fail({receive1,X}) + ct:fail({receive1,X}) end after 5000 -> - test_server:fail(receive1) + ct:fail(receive1) end, receive Pid -> ok; Y -> - test_server:fail({receive1,Y}) + ct:fail({receive1,Y}) after 5000 -> - test_server:fail(receive2) + ct:fail(receive2) end, io:format("ref = ~p~n", [Ref1]), check_ref(Ref1), @@ -1023,11 +1024,11 @@ cnode_1(Config) when is_list(Config) -> check_ref(Ref) -> case bin_ext_type(Ref) of 101 -> - test_server:fail(oldref); + ct:fail(oldref); 114 -> ok; Type -> - test_server:fail({type, Type}) + ct:fail({type, Type}) end. bin_ext_type(T) -> @@ -1039,7 +1040,7 @@ get_ref() -> X when is_reference(X) -> X after 5000 -> - test_server:fail({cnode, timeout}) + ct:fail({cnode, timeout}) end. start_cnode(Cnode) -> diff --git a/lib/erl_interface/test/erl_global_SUITE.erl b/lib/erl_interface/test/erl_global_SUITE.erl index 955ffb6a9f..cf0ec80f66 100644 --- a/lib/erl_interface/test/erl_global_SUITE.erl +++ b/lib/erl_interface/test/erl_global_SUITE.erl @@ -124,7 +124,7 @@ get_send_result(P) -> {term,{0, 0}} -> ok; {term,{-1, Errno}} -> {error,Errno}; {term,{_,_}}-> - ?t:fail(bad_return_value) + ct:fail(bad_return_value) end. send_command(P, Name, Args) -> diff --git a/lib/erl_interface/test/runner.erl b/lib/erl_interface/test/runner.erl index 857923772a..3854981ad1 100644 --- a/lib/erl_interface/test/runner.erl +++ b/lib/erl_interface/test/runner.erl @@ -45,7 +45,7 @@ test(Tc, Timeout) -> io:format("In this test case, a success/failure result was"), io:format("expected from the C program.\n"), io:format("Received: ~p", [Other]), - test_server:fail() + ct:fail(badresult) end. %% Executes a test case in a C program. Returns the port. @@ -80,7 +80,7 @@ send_eot(Port) when is_port(Port) -> Port ! {self(), {command, [$e]}}. %% Waits for an 'eot' indication from the C program. -%% Either returns 'ok' or invokes test_server:fail(). +%% Either returns 'ok' or invokes ct:fail(badresult). recv_eot(Port) when is_port(Port) -> case get_term(Port) of @@ -90,12 +90,12 @@ recv_eot(Port) when is_port(Port) -> io:format("Error finishing test case. Expected eof from"), io:format("C program, but got:"), io:format("~p", [Other]), - test_server:fail() + ct:fail(badresult) end. %% Reads a term from the C program. %% -%% Returns: {term, Term}|eot|'NULL' or calls test_server:fail/1,2. +%% Returns: {term, Term}|eot|'NULL' or calls ct:fail/1,2. get_term(Port) -> get_term(Port, ?default_timeout). @@ -105,9 +105,9 @@ get_term(Port, Timeout) -> [$b|Bytes] -> {bytes, Bytes}; [$f] -> - test_server:fail(); + ct:fail(failure); [$f|Reason] -> - test_server:fail(Reason); + ct:fail(Reason); [$t|Term] -> {term, binary_to_term(list_to_binary(Term))}; [$N] -> @@ -119,7 +119,7 @@ get_term(Port, Timeout) -> get_term(Port, Timeout); Other -> io:format("Garbage received from C program: ~p", [Other]), - test_server:fail("Illegal response from C program") + ct:fail("Illegal response from C program") end. get_reply(Port, Timeout) when is_port(Port) -> @@ -127,5 +127,5 @@ get_reply(Port, Timeout) when is_port(Port) -> {Port, {data, Reply}} -> Reply after Timeout -> - test_server:fail("No response from C program") + ct:fail("No response from C program") end. -- cgit v1.2.3