aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-03-23 19:05:48 +0100
committerBjörn-Egil Dahlberg <[email protected]>2016-03-23 19:05:48 +0100
commit9615753e42d55b3bad042791a1b36b0ef7f0090a (patch)
tree1efc40b574871422445e644dc0e1bf9324c80961
parent8f5e589c7adab9450513852e8b71643d6c11e711 (diff)
parentdc42c5d1587a33ae2cc772d51fb6d900a41ec153 (diff)
downloadotp-9615753e42d55b3bad042791a1b36b0ef7f0090a.tar.gz
otp-9615753e42d55b3bad042791a1b36b0ef7f0090a.tar.bz2
otp-9615753e42d55b3bad042791a1b36b0ef7f0090a.zip
Merge branch 'egil/erl_interface/modernize-tests'
* egil/erl_interface/modernize-tests: Eliminate use of test_server:fail/0,1 Cleanup test code Remove unncecessary exports Eliminate suite and doc clauses Replace ?config() macro with proplists:get_value() Modernize timetraps Eliminate ?line macros
-rw-r--r--lib/erl_interface/test/all_SUITE_data/ei_runner.c8
-rw-r--r--lib/erl_interface/test/all_SUITE_data/runner.c8
-rw-r--r--lib/erl_interface/test/ei_accept_SUITE.erl192
-rw-r--r--lib/erl_interface/test/ei_connect_SUITE.erl230
-rw-r--r--lib/erl_interface/test/ei_decode_SUITE.erl364
-rw-r--r--lib/erl_interface/test/ei_decode_encode_SUITE.erl305
-rw-r--r--lib/erl_interface/test/ei_encode_SUITE.erl388
-rw-r--r--lib/erl_interface/test/ei_format_SUITE.erl190
-rw-r--r--lib/erl_interface/test/ei_print_SUITE.erl184
-rw-r--r--lib/erl_interface/test/ei_tmo_SUITE.erl779
-rw-r--r--lib/erl_interface/test/erl_connect_SUITE.erl120
-rw-r--r--lib/erl_interface/test/erl_eterm_SUITE.erl1140
-rw-r--r--lib/erl_interface/test/erl_ext_SUITE.erl66
-rw-r--r--lib/erl_interface/test/erl_format_SUITE.erl172
-rw-r--r--lib/erl_interface/test/erl_global_SUITE.erl108
-rw-r--r--lib/erl_interface/test/erl_match_SUITE.erl323
-rw-r--r--lib/erl_interface/test/port_call_SUITE.erl110
-rw-r--r--lib/erl_interface/test/runner.erl18
18 files changed, 2093 insertions, 2612 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 db3587339e..654f2a4235 100644
--- a/lib/erl_interface/test/ei_accept_SUITE.erl
+++ b/lib/erl_interface/test/ei_accept_SUITE.erl
@@ -24,94 +24,67 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_accept_SUITE_data/ei_accept_test_cases.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- init_per_testcase/2, end_per_testcase/2,
- ei_accept/1, ei_threaded_accept/1]).
+-export([all/0, suite/0,
+ ei_accept/1, ei_threaded_accept/1]).
-import(runner, [get_term/1,send_term/2]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {seconds, 30}}].
all() ->
[ei_accept, ei_threaded_accept].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?t:seconds(30)),
- [{watchdog, Dog}|Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- test_server:timetrap_cancel(Dog),
- ok.
-
ei_accept(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
-
- ?line Myname= hd(tl(string:tokens(atom_to_list(node()), "@"))),
- ?line io:format("Myname ~p ~n", [Myname]),
- ?line EINode= list_to_atom("c42@"++Myname),
- ?line io:format("EINode ~p ~n", [EINode]),
- ?line Self= self(),
- ?line TermToSend= {call, Self, "Test"},
- ?line F= fun() ->
- case waitfornode("c42",20) of
- true ->
- {any, EINode} ! TermToSend,
- Self ! sent_ok;
- false ->
- Self ! never_published
- end,
- ok
- end,
-
- ?line spawn(F),
- ?line Port = 6543,
- ?line {ok, Fd, _Node} = ei_accept(P, Port),
- ?line TermReceived= ei_receive(P, Fd),
- ?line io:format("Sent ~p received ~p ~n", [TermToSend, TermReceived]),
- ?line TermToSend= TermReceived,
- ?line receive
- sent_ok ->
- ok;
- Unknown ->
- io:format("~p ~n", [Unknown])
- after 1000 ->
- io:format("timeout ~n")
- end,
- ?line runner:finish(P),
+ P = runner:start(?interpret),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+
+ Myname = hd(tl(string:tokens(atom_to_list(node()), "@"))),
+ io:format("Myname ~p ~n", [Myname]),
+ EINode = list_to_atom("c42@"++Myname),
+ io:format("EINode ~p ~n", [EINode]),
+ Self = self(),
+ TermToSend= {call, Self, "Test"},
+ F= fun() ->
+ case waitfornode("c42",20) of
+ true ->
+ {any, EINode} ! TermToSend,
+ Self ! sent_ok;
+ false ->
+ Self ! never_published
+ end,
+ ok
+ end,
+
+ spawn(F),
+ Port = 6543,
+ {ok, Fd, _Node} = ei_accept(P, Port),
+ TermReceived= ei_receive(P, Fd),
+ io:format("Sent ~p received ~p ~n", [TermToSend, TermReceived]),
+ TermToSend= TermReceived,
+ receive
+ sent_ok ->
+ ok;
+ Unknown ->
+ io:format("~p ~n", [Unknown])
+ after 1000 ->
+ io:format("timeout ~n")
+ end,
+ runner:finish(P),
ok.
ei_threaded_accept(Config) when is_list(Config) ->
- ?line Einode = filename:join(?config(data_dir, Config), "eiaccnode"),
- ?line N = 1, % 3,
- ?line Host = atom_to_list(node()),
- ?line Port = 6767,
- ?line start_einode(Einode, N, Host, Port),
- ?line io:format("started eiaccnode"),
- %%?line spawn_link(fun() -> start_einode(Einode, N, Host, Port) end),
- ?line TestServerPid = self(),
- ?line [ spawn_link(fun() -> send_rec_einode(I, TestServerPid) end)
- || I <- lists:seq(0, N-1) ],
- ?line [ receive I -> ok end
- || I <- lists:seq(0, N-1) ],
+ Einode = filename:join(proplists:get_value(data_dir, Config), "eiaccnode"),
+ N = 1, % 3,
+ Host = atom_to_list(node()),
+ Port = 6767,
+ start_einode(Einode, N, Host, Port),
+ io:format("started eiaccnode"),
+ %%spawn_link(fun() -> start_einode(Einode, N, Host, Port) end),
+ TestServerPid = self(),
+ [spawn_link(fun() -> send_rec_einode(I, TestServerPid) end) || I <- lists:seq(0, N-1)],
+ [receive I -> ok end || I <- lists:seq(0, N-1) ],
ok.
waitfornode(String,0) ->
@@ -120,66 +93,61 @@ waitfornode(String,0) ->
waitfornode(String,N) ->
Registered = [X || {X,_} <- element(2,erl_epmd:names())],
case lists:member(String,Registered) of
- true ->
- true;
- false ->
- timer:sleep(1000),
- waitfornode(String,N-1)
+ true ->
+ true;
+ false ->
+ timer:sleep(1000),
+ waitfornode(String,N-1)
end.
send_rec_einode(N, TestServerPid) ->
- ?line Myname= hd(tl(string:tokens(atom_to_list(node()), "@"))),
- ?line FirstPart = "eiacc" ++ integer_to_list(N),
- ?line EINode= list_to_atom(FirstPart ++ "@" ++ Myname),
- ?line io:format("EINode ~p ~n", [EINode]),
- ?line Self= self(),
- ?line case waitfornode(FirstPart,20) of
- true -> ok;
- false -> test_server:fail({never_published,EINode})
- end,
- ?line {any, EINode} ! Self,
- ?line receive
- {N,_}=X ->
- ?line io:format("Received by ~s ~p~n", [EINode, X]),
- ?line TestServerPid ! N,
- ?line X
- after 10000 ->
- ?line test_server:fail(EINode)
- end.
+ Myname= hd(tl(string:tokens(atom_to_list(node()), "@"))),
+ FirstPart = "eiacc" ++ integer_to_list(N),
+ EINode= list_to_atom(FirstPart ++ "@" ++ Myname),
+ io:format("EINode ~p ~n", [EINode]),
+ Self= self(),
+ case waitfornode(FirstPart,20) of
+ true -> ok;
+ false -> ct:fail({never_published,EINode})
+ end,
+ {any, EINode} ! Self,
+ receive
+ {N,_}=X ->
+ io:format("Received by ~s ~p~n", [EINode, X]),
+ TestServerPid ! N,
+ X
+ after 10000 ->
+ ct:fail(EINode)
+ end.
start_einode(Einode, N, Host, Port) ->
Einodecmd = Einode ++ " " ++ atom_to_list(erlang:get_cookie())
- ++ " " ++ integer_to_list(N) ++ " " ++ Host ++ " "
- ++ integer_to_list(Port) ++ " nothreads",
+ ++ " " ++ integer_to_list(N) ++ " " ++ Host ++ " "
+ ++ integer_to_list(Port) ++ " nothreads",
io:format("Einodecmd ~p ~n", [Einodecmd]),
- ?line open_port({spawn, Einodecmd}, []),
+ open_port({spawn, Einodecmd}, []),
ok.
-
%%% Interface functions for ei (erl_interface) functions.
ei_connect_init(P, Num, Cookie, Creation) ->
send_command(P, ei_connect_init, [Num,Cookie,Creation]),
case get_term(P) of
- {term,Int} when is_integer(Int) -> Int
+ {term,Int} when is_integer(Int) -> Int
end.
ei_accept(P, PortNo) ->
send_command(P, ei_accept, [PortNo]),
case get_term(P) of
- {term,{Fd, _, Node}} when Fd >= 0 -> {ok, Fd, Node};
- {term,{_Fd, Errno, _Node}} -> {error,Errno}
+ {term,{Fd, _, Node}} when Fd >= 0 -> {ok, Fd, Node};
+ {term,{_Fd, Errno, _Node}} -> {error,Errno}
end.
ei_receive(P, Fd) ->
send_command(P, ei_receive, [Fd]),
- {term, T}= get_term(P),
+ {term, T} = get_term(P),
T.
send_command(P, Name, Args) ->
runner:send_term(P, {Name,list_to_tuple(Args)}).
-
-
-
-
diff --git a/lib/erl_interface/test/ei_connect_SUITE.erl b/lib/erl_interface/test/ei_connect_SUITE.erl
index c94ac37af4..1ef2525251 100644
--- a/lib/erl_interface/test/ei_connect_SUITE.erl
+++ b/lib/erl_interface/test/ei_connect_SUITE.erl
@@ -24,173 +24,145 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_connect_SUITE_data/ei_connect_test_cases.hrl").
--export([
- all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- init_per_testcase/2,
- end_per_testcase/2,
-
- ei_send/1,
- ei_reg_send/1,
- ei_format_pid/1,
- ei_rpc/1,
- rpc_test/1,
- ei_send_funs/1,
- ei_threaded_send/1,
- ei_set_get_tracelevel/1
- ]).
+-export([all/0, suite/0,
+ ei_send/1,
+ ei_reg_send/1,
+ ei_format_pid/1,
+ ei_rpc/1,
+ rpc_test/1,
+ ei_send_funs/1,
+ ei_threaded_send/1,
+ ei_set_get_tracelevel/1]).
-import(runner, [get_term/1,send_term/2]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {seconds, 30}}].
all() ->
[ei_send, ei_reg_send, ei_rpc, ei_format_pid, ei_send_funs,
ei_threaded_send, ei_set_get_tracelevel].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?t:minutes(0.25)),
- [{watchdog, Dog}|Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- test_server:timetrap_cancel(Dog),
- ok.
-
ei_send(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = ei_connect(P, node()),
+ P = runner:start(?interpret),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = ei_connect(P, node()),
- ?line ok = ei_send(P, Fd, self(), AMsg={a,message}),
- ?line receive AMsg -> ok end,
+ ok = ei_send(P, Fd, self(), AMsg={a,message}),
+ receive AMsg -> ok end,
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
ei_format_pid(Config) when is_list(Config) ->
- ?line S = self(),
- ?line P = runner:start(?interpret),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = ei_connect(P, node()),
+ S = self(),
+ P = runner:start(?interpret),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = ei_connect(P, node()),
- ?line ok = ei_format_pid(P, Fd, S),
- ?line receive S -> ok end,
+ ok = ei_format_pid(P, Fd, S),
+ receive S -> ok end,
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
ei_send_funs(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = ei_connect(P, node()),
-
- ?line Fun1 = fun ei_send/1,
- ?line Fun2 = fun(X) -> P, X, Fd, Fun1 end,
-
- ?line AMsg={Fun1,Fun2},
+ P = runner:start(?interpret),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = ei_connect(P, node()),
+
+ Fun1 = fun ei_send/1,
+ Fun2 = fun(X) -> P, X, Fd, Fun1 end,
+
+ AMsg={Fun1,Fun2},
%%AMsg={wait_with_funs, new_dist_format},
- ?line ok = ei_send_funs(P, Fd, self(), AMsg),
- ?line EIMsg = receive M -> M end,
- ?line EIMsg = AMsg,
+ ok = ei_send_funs(P, Fd, self(), AMsg),
+ EIMsg = receive M -> M end,
+ EIMsg = AMsg,
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
ei_reg_send(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = ei_connect(P, node()),
+ P = runner:start(?interpret),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = ei_connect(P, node()),
ARegName = a_strange_registred_name,
- ?line register(ARegName, self()),
- ?line ok = ei_reg_send(P, Fd, ARegName, AMsg={another,[strange],message}),
- ?line receive AMsg -> ok end,
+ register(ARegName, self()),
+ ok = ei_reg_send(P, Fd, ARegName, AMsg={another,[strange],message}),
+ receive AMsg -> ok end,
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
ei_threaded_send(Config) when is_list(Config) ->
- ?line Einode = filename:join(?config(data_dir, Config), "einode"),
- ?line N = 15,
- ?line Host = atom_to_list(node()),
- ?line TestServerPid = self(),
- ?line [ spawn_link(fun() -> rec_einode(I, TestServerPid) end)
- || I <- lists:seq(0, N-1) ],
- ?line [ receive {I,registered} -> ok end
- || I <- lists:seq(0, N-1) ],
- ?line spawn_link(fun() -> start_einode(Einode, N, Host) end),
- ?line [ receive I -> ok end
- || I <- lists:seq(0, N-1) ],
+ Einode = filename:join(proplists:get_value(data_dir, Config), "einode"),
+ N = 15,
+ Host = atom_to_list(node()),
+ TestServerPid = self(),
+ [ spawn_link(fun() -> rec_einode(I, TestServerPid) end)
+ || I <- lists:seq(0, N-1) ],
+ [ receive {I,registered} -> ok end
+ || I <- lists:seq(0, N-1) ],
+ spawn_link(fun() -> start_einode(Einode, N, Host) end),
+ [ receive I -> ok end
+ || I <- lists:seq(0, N-1) ],
ok.
rec_einode(N, TestServerPid) ->
- ?line Regname = list_to_atom("mth"++integer_to_list(N)),
- ?line register(Regname, self()),
- ?line TestServerPid ! {N, registered},
- ?line io:format("~p waiting~n", [Regname]),
- ?line receive
- X ->
- ?line io:format("Received by ~s ~p~n", [Regname, X]),
- ?line TestServerPid ! N,
- ?line X
- after 10000 ->
- ?line test_server:fail(Regname)
- end.
+ Regname = list_to_atom("mth"++integer_to_list(N)),
+ register(Regname, self()),
+ TestServerPid ! {N, registered},
+ io:format("~p waiting~n", [Regname]),
+ receive
+ X ->
+ io:format("Received by ~s ~p~n", [Regname, X]),
+ TestServerPid ! N,
+ X
+ after 10000 ->
+ ct:fail(Regname)
+ end.
start_einode(Einode, N, Host) ->
Einodecmd = Einode ++ " " ++ atom_to_list(erlang:get_cookie())
- ++ " " ++ integer_to_list(N) ++ " " ++ Host,
+ ++ " " ++ integer_to_list(N) ++ " " ++ Host,
io:format("Einodecmd ~p ~n", [Einodecmd]),
- ?line open_port({spawn, Einodecmd}, []),
+ open_port({spawn, Einodecmd}, []),
ok.
ei_rpc(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = ei_connect(P, node()),
+ P = runner:start(?interpret),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = ei_connect(P, node()),
- ?line S= "Hej du glade!", SRev = lists:reverse(S),
- ?line X = ei_rpc(P, Fd, self(), {?MODULE, rpc_test}, [SRev]),
- ?line {term, S}= X,
+ S= "Hej du glade!", SRev = lists:reverse(S),
+ X = ei_rpc(P, Fd, self(), {?MODULE, rpc_test}, [SRev]),
+ {term, S}= X,
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
ei_set_get_tracelevel(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 5 = ei_set_get_tracelevel(P, 5),
- ?line 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = ei_connect(P, node()),
+ P = runner:start(?interpret),
+ 5 = ei_set_get_tracelevel(P, 5),
+ 0 = ei_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = ei_connect(P, node()),
- ?line S= "Hej du glade!", SRev = lists:reverse(S),
- ?line X = ei_rpc(P, Fd, self(), {?MODULE, rpc_test}, [SRev]),
- ?line {term, S}= X,
+ S= "Hej du glade!", SRev = lists:reverse(S),
+ X = ei_rpc(P, Fd, self(), {?MODULE, rpc_test}, [SRev]),
+ {term, S}= X,
- ?line 0 = ei_set_get_tracelevel(P, 0),
+ 0 = ei_set_get_tracelevel(P, 0),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
@@ -199,20 +171,20 @@ ei_set_get_tracelevel(Config) when is_list(Config) ->
ei_connect_init(P, Num, Cookie, Creation) ->
send_command(P, ei_connect_init, [Num,Cookie,Creation]),
case get_term(P) of
- {term,Int} when is_integer(Int) -> Int
+ {term,Int} when is_integer(Int) -> Int
end.
ei_connect(P, Node) ->
send_command(P, ei_connect, [Node]),
case get_term(P) of
- {term,{Fd,_}} when Fd >= 0 -> {ok,Fd};
- {term,{-1,Errno}} -> {error,Errno}
+ {term,{Fd,_}} when Fd >= 0 -> {ok,Fd};
+ {term,{-1,Errno}} -> {error,Errno}
end.
ei_set_get_tracelevel(P, Tracelevel) ->
send_command(P, ei_set_get_tracelevel, [Tracelevel]),
case get_term(P) of
- {term,{tracelevel, Level}} when is_integer(Level) -> Level
+ {term,{tracelevel, Level}} when is_integer(Level) -> Level
end.
ei_send(P, Fd, To, Msg) ->
@@ -238,12 +210,12 @@ ei_rpc(P, Fd, To, Func, Msg) ->
get_send_result(P) ->
case get_term(P) of
- {term,{0,_}} -> ok;
- {term,{1,_}} -> ok;
- {term,{-1,Errno}} -> {error,Errno};
- {term,{Res,Errno}}->
- io:format("Return value: ~p\nerl_errno: ~p", [Res,Errno]),
- ?t:fail(bad_return_value)
+ {term,{0,_}} -> ok;
+ {term,{1,_}} -> ok;
+ {term,{-1,Errno}} -> {error,Errno};
+ {term,{Res,Errno}}->
+ io:format("Return value: ~p\nerl_errno: ~p", [Res,Errno]),
+ ct:fail(bad_return_value)
end.
send_command(P, Name, Args) ->
diff --git a/lib/erl_interface/test/ei_decode_SUITE.erl b/lib/erl_interface/test/ei_decode_SUITE.erl
index 91357c99f2..b6cbda0817 100644
--- a/lib/erl_interface/test/ei_decode_SUITE.erl
+++ b/lib/erl_interface/test/ei_decode_SUITE.erl
@@ -24,20 +24,15 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_decode_SUITE_data/ei_decode_test_cases.hrl").
--export(
- [
- all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2, init_per_testcase/2,
- end_per_testcase/2,
- test_ei_decode_long/1,
- test_ei_decode_ulong/1,
- test_ei_decode_longlong/1,
- test_ei_decode_ulonglong/1,
- test_ei_decode_char/1,
- test_ei_decode_nonoptimal/1,
- test_ei_decode_misc/1,
- test_ei_decode_utf8_atom/1
- ]).
+-export([all/0, suite/0,
+ test_ei_decode_long/1,
+ test_ei_decode_ulong/1,
+ test_ei_decode_longlong/1,
+ test_ei_decode_ulonglong/1,
+ test_ei_decode_char/1,
+ test_ei_decode_nonoptimal/1,
+ test_ei_decode_misc/1,
+ test_ei_decode_utf8_atom/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -47,27 +42,6 @@ all() ->
test_ei_decode_char, test_ei_decode_nonoptimal,
test_ei_decode_misc, test_ei_decode_utf8_atom].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-init_per_testcase(_TC, Config) ->
- Config.
-
-end_per_testcase(_RC, Config) ->
- Config.
-
%% ---------------------------------------------------------------------------
% NOTE: for historical reasons we don't pach as tight as we can,
@@ -76,55 +50,51 @@ end_per_testcase(_RC, Config) ->
%% ######################################################################## %%
-test_ei_decode_long(suite) -> [];
test_ei_decode_long(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_decode_long),
+ P = runner:start(?test_ei_decode_long),
send_integers(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
-test_ei_decode_ulong(suite) -> [];
test_ei_decode_ulong(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_decode_ulong),
+ P = runner:start(?test_ei_decode_ulong),
send_integers(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
% (*) In practical terms, other values may fit into the ext format
% i32 is signed 32 bit on C side
% u32 is unsigned 32 bit on C side
-
+
%% ######################################################################## %%
-test_ei_decode_longlong(suite) -> [];
test_ei_decode_longlong(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skip,"Skipped on VxWorks"};
- _ ->
- ?line P = runner:start(?test_ei_decode_longlong),
- send_integers2(P),
- ?line runner:recv_eot(P),
- ok
+ vxworks ->
+ {skip,"Skipped on VxWorks"};
+ _ ->
+ P = runner:start(?test_ei_decode_longlong),
+ send_integers2(P),
+ runner:recv_eot(P),
+ ok
end.
%% ######################################################################## %%
-test_ei_decode_ulonglong(suite) -> [];
test_ei_decode_ulonglong(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skip,"Skipped on VxWorks"};
- _ ->
- ?line P = runner:start(?test_ei_decode_ulonglong),
- send_integers2(P),
- ?line runner:recv_eot(P),
- ok
+ vxworks ->
+ {skip,"Skipped on VxWorks"};
+ _ ->
+ P = runner:start(?test_ei_decode_ulonglong),
+ send_integers2(P),
+ runner:recv_eot(P),
+ ok
end.
@@ -133,38 +103,36 @@ test_ei_decode_ulonglong(Config) when is_list(Config) ->
%% it is unsigned.
%% FIXME maybe the API should change to use "unsigned char" to be clear?!
-test_ei_decode_char(suite) -> [];
test_ei_decode_char(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_decode_char),
+ P = runner:start(?test_ei_decode_char),
- ?line send_term_as_binary(P,0),
- ?line send_term_as_binary(P,16#7f),
- ?line send_term_as_binary(P,16#ff),
+ send_term_as_binary(P,0),
+ send_term_as_binary(P,16#7f),
+ send_term_as_binary(P,16#ff),
- ?line send_term_as_binary(P, []), % illegal type
+ send_term_as_binary(P, []), % illegal type
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
-test_ei_decode_nonoptimal(suite) -> [];
test_ei_decode_nonoptimal(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_decode_nonoptimal),
+ P = runner:start(?test_ei_decode_nonoptimal),
send_non_optimal_pos(P), % decode_char
send_non_optimal(P), % decode_long
send_non_optimal_pos(P), % decode_ulong
case os:type() of
- vxworks ->
- ok;
- _ ->
- send_non_optimal(P), % decode_longlong
- send_non_optimal_pos(P) % decode_ulonglong
+ vxworks ->
+ ok;
+ _ ->
+ send_non_optimal(P), % decode_longlong
+ send_non_optimal_pos(P) % decode_ulonglong
end,
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
@@ -173,82 +141,81 @@ send_non_optimal(P) ->
send_non_optimal_neg(P).
send_non_optimal_pos(P) ->
- ?line send_raw(P, <<131,97,42>>),
- ?line send_raw(P, <<131,98,42:32>>),
- ?line send_raw(P, <<131,110,1,0,42>>),
- ?line send_raw(P, <<131,110,2,0,42,0>>),
- ?line send_raw(P, <<131,110,4,0,42,0,0,0>>),
- ?line send_raw(P, <<131,111,0,0,0,1,0,42>>),
- ?line send_raw(P, <<131,111,0,0,0,2,0,42,0>>),
- ?line send_raw(P, <<131,111,0,0,0,3,0,42,0,0>>),
- ?line send_raw(P, <<131,111,0,0,0,6,0,42,0,0,0,0,0>>),
+ send_raw(P, <<131,97,42>>),
+ send_raw(P, <<131,98,42:32>>),
+ send_raw(P, <<131,110,1,0,42>>),
+ send_raw(P, <<131,110,2,0,42,0>>),
+ send_raw(P, <<131,110,4,0,42,0,0,0>>),
+ send_raw(P, <<131,111,0,0,0,1,0,42>>),
+ send_raw(P, <<131,111,0,0,0,2,0,42,0>>),
+ send_raw(P, <<131,111,0,0,0,3,0,42,0,0>>),
+ send_raw(P, <<131,111,0,0,0,6,0,42,0,0,0,0,0>>),
ok.
send_non_optimal_neg(P) ->
-% ?line send_raw(P, <<131,97,-42>>),
- ?line send_raw(P, <<131,98,-42:32>>),
- ?line send_raw(P, <<131,110,1,1,42>>),
- ?line send_raw(P, <<131,110,2,1,42,0>>),
- ?line send_raw(P, <<131,110,4,1,42,0,0,0>>),
- ?line send_raw(P, <<131,111,0,0,0,1,1,42>>),
- ?line send_raw(P, <<131,111,0,0,0,2,1,42,0>>),
- ?line send_raw(P, <<131,111,0,0,0,3,1,42,0,0>>),
- ?line send_raw(P, <<131,111,0,0,0,6,1,42,0,0,0,0,0>>),
+ % send_raw(P, <<131,97,-42>>),
+ send_raw(P, <<131,98,-42:32>>),
+ send_raw(P, <<131,110,1,1,42>>),
+ send_raw(P, <<131,110,2,1,42,0>>),
+ send_raw(P, <<131,110,4,1,42,0,0,0>>),
+ send_raw(P, <<131,111,0,0,0,1,1,42>>),
+ send_raw(P, <<131,111,0,0,0,2,1,42,0>>),
+ send_raw(P, <<131,111,0,0,0,3,1,42,0,0>>),
+ send_raw(P, <<131,111,0,0,0,6,1,42,0,0,0,0,0>>),
ok.
%% ######################################################################## %%
-test_ei_decode_misc(suite) -> [];
test_ei_decode_misc(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_decode_misc),
+ P = runner:start(?test_ei_decode_misc),
- ?line send_term_as_binary(P,0.0),
- ?line send_term_as_binary(P,-1.0),
- ?line send_term_as_binary(P,1.0),
+ send_term_as_binary(P,0.0),
+ send_term_as_binary(P,-1.0),
+ send_term_as_binary(P,1.0),
- ?line send_term_as_binary(P,false),
- ?line send_term_as_binary(P,true),
+ send_term_as_binary(P,false),
+ send_term_as_binary(P,true),
- ?line send_term_as_binary(P,foo),
- ?line send_term_as_binary(P,''),
- ?line send_term_as_binary(P,'ÅÄÖåäö'),
+ send_term_as_binary(P,foo),
+ send_term_as_binary(P,''),
+ send_term_as_binary(P,'ÅÄÖåäö'),
- ?line send_term_as_binary(P,"foo"),
- ?line send_term_as_binary(P,""),
- ?line send_term_as_binary(P,"ÅÄÖåäö"),
+ send_term_as_binary(P,"foo"),
+ send_term_as_binary(P,""),
+ send_term_as_binary(P,"ÅÄÖåäö"),
- ?line send_term_as_binary(P,<<"foo">>),
- ?line send_term_as_binary(P,<<>>),
- ?line send_term_as_binary(P,<<"ÅÄÖåäö">>),
+ send_term_as_binary(P,<<"foo">>),
+ send_term_as_binary(P,<<>>),
+ send_term_as_binary(P,<<"ÅÄÖåäö">>),
-% ?line send_term_as_binary(P,{}),
-% ?line send_term_as_binary(P,[]),
+ % send_term_as_binary(P,{}),
+ % send_term_as_binary(P,[]),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
test_ei_decode_utf8_atom(Config) ->
- ?line P = runner:start(?test_ei_decode_utf8_atom),
+ P = runner:start(?test_ei_decode_utf8_atom),
send_utf8_atom_as_binary(P,"å"),
send_utf8_atom_as_binary(P,"ä"),
send_term_as_binary(P,'ö'),
send_term_as_binary(P,'õ'),
-
- ?line send_utf8_atom_as_binary(P,[1758]),
- ?line send_utf8_atom_as_binary(P,[1758,1758]),
- ?line send_utf8_atom_as_binary(P,[1758,1758,1758]),
- ?line send_utf8_atom_as_binary(P,[1758,1758,1758,1758]),
+
+ send_utf8_atom_as_binary(P,[1758]),
+ send_utf8_atom_as_binary(P,[1758,1758]),
+ send_utf8_atom_as_binary(P,[1758,1758,1758]),
+ send_utf8_atom_as_binary(P,[1758,1758,1758,1758]),
send_utf8_atom_as_binary(P,"a"),
send_utf8_atom_as_binary(P,"b"),
send_term_as_binary(P,'c'),
send_term_as_binary(P,'d'),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
@@ -264,77 +231,77 @@ send_utf8_atom_as_binary(Port, String) ->
Port ! {self(), {command, term_to_binary(uc_atup(String))}}.
send_integers(P) ->
- ?line send_term_as_binary(P,0), % SMALL_INTEGER_EXT smallest
- ?line send_term_as_binary(P,255), % SMALL_INTEGER_EXT largest
- ?line send_term_as_binary(P,256), % INTEGER_EXT smallest pos (*)
- ?line send_term_as_binary(P,-1), % INTEGER_EXT largest neg
-
- ?line send_term_as_binary(P, 16#07ffffff), % INTEGER_EXT old largest (28 bits)
- ?line send_term_as_binary(P,-16#08000000), % INTEGER_EXT old smallest
- ?line send_term_as_binary(P, 16#08000000), % SMALL_BIG_EXT old smallest pos(*)
- ?line send_term_as_binary(P,-16#08000001), % SMALL_BIG_EXT old largest neg (*)
-
- ?line send_term_as_binary(P, 16#7fffffff), % INTEGER_EXT new largest (32 bits)
- ?line send_term_as_binary(P,-16#80000000), % INTEGER_EXT new smallest (32 bis)
- ?line send_term_as_binary(P, 16#80000000), % SMALL_BIG_EXT new smallest pos(*)
- ?line send_term_as_binary(P,-16#80000001), % SMALL_BIG_EXT new largest neg (*)
-
+ send_term_as_binary(P,0), % SMALL_INTEGER_EXT smallest
+ send_term_as_binary(P,255), % SMALL_INTEGER_EXT largest
+ send_term_as_binary(P,256), % INTEGER_EXT smallest pos (*)
+ send_term_as_binary(P,-1), % INTEGER_EXT largest neg
+
+ send_term_as_binary(P, 16#07ffffff), % INTEGER_EXT old largest (28 bits)
+ send_term_as_binary(P,-16#08000000), % INTEGER_EXT old smallest
+ send_term_as_binary(P, 16#08000000), % SMALL_BIG_EXT old smallest pos(*)
+ send_term_as_binary(P,-16#08000001), % SMALL_BIG_EXT old largest neg (*)
+
+ send_term_as_binary(P, 16#7fffffff), % INTEGER_EXT new largest (32 bits)
+ send_term_as_binary(P,-16#80000000), % INTEGER_EXT new smallest (32 bis)
+ send_term_as_binary(P, 16#80000000), % SMALL_BIG_EXT new smallest pos(*)
+ send_term_as_binary(P,-16#80000001), % SMALL_BIG_EXT new largest neg (*)
+
case erlang:system_info({wordsize,external}) of
- 4 ->
- ?line send_term_as_binary(P, 16#80000000),% SMALL_BIG_EXT u32
- ?line send_term_as_binary(P, 16#ffffffff),% SMALL_BIG_EXT largest u32
-
- ?line send_term_as_binary(P, 16#7fffffffffff), % largest i48
- ?line send_term_as_binary(P,-16#800000000000), % smallest i48
- ?line send_term_as_binary(P, 16#ffffffffffff), % largest u48
- ?line send_term_as_binary(P, 16#7fffffffffffffff), % largest i64
- ?line send_term_as_binary(P,-16#8000000000000000), % smallest i64
- ?line send_term_as_binary(P, 16#ffffffffffffffff); % largest u64
- 8 ->
- ?line send_term_as_binary(P, 16#8000000000000000),% SMALL_BIG_EXT u64
- % SMALL_BIG_EXT largest u64
- ?line send_term_as_binary(P, 16#ffffffffffffffff),
- % largest i96
- ?line send_term_as_binary(P, 16#7fffffffffffffffffffffff),
- % smallest i96
- ?line send_term_as_binary(P,-16#800000000000000000000000),
- % largest u96
- ?line send_term_as_binary(P, 16#ffffffffffffffffffffffff),
- % largest i128
- ?line send_term_as_binary(P, 16#7fffffffffffffffffffffffffffffff),
- % smallest i128
- ?line send_term_as_binary(P,-16#80000000000000000000000000000000),
- % largest u128
- ?line send_term_as_binary(P, 16#ffffffffffffffffffffffffffffffff)
+ 4 ->
+ send_term_as_binary(P, 16#80000000),% SMALL_BIG_EXT u32
+ send_term_as_binary(P, 16#ffffffff),% SMALL_BIG_EXT largest u32
+
+ send_term_as_binary(P, 16#7fffffffffff), % largest i48
+ send_term_as_binary(P,-16#800000000000), % smallest i48
+ send_term_as_binary(P, 16#ffffffffffff), % largest u48
+ send_term_as_binary(P, 16#7fffffffffffffff), % largest i64
+ send_term_as_binary(P,-16#8000000000000000), % smallest i64
+ send_term_as_binary(P, 16#ffffffffffffffff); % largest u64
+ 8 ->
+ send_term_as_binary(P, 16#8000000000000000),% SMALL_BIG_EXT u64
+ % SMALL_BIG_EXT largest u64
+ send_term_as_binary(P, 16#ffffffffffffffff),
+ % largest i96
+ send_term_as_binary(P, 16#7fffffffffffffffffffffff),
+ % smallest i96
+ send_term_as_binary(P,-16#800000000000000000000000),
+ % largest u96
+ send_term_as_binary(P, 16#ffffffffffffffffffffffff),
+ % largest i128
+ send_term_as_binary(P, 16#7fffffffffffffffffffffffffffffff),
+ % smallest i128
+ send_term_as_binary(P,-16#80000000000000000000000000000000),
+ % largest u128
+ send_term_as_binary(P, 16#ffffffffffffffffffffffffffffffff)
end,
- ?line send_term_as_binary(P, []), % illegal type
+ send_term_as_binary(P, []), % illegal type
ok.
send_integers2(P) ->
- ?line send_term_as_binary(P,0), % SMALL_INTEGER_EXT smallest
- ?line send_term_as_binary(P,255), % SMALL_INTEGER_EXT largest
- ?line send_term_as_binary(P,256), % INTEGER_EXT smallest pos (*)
- ?line send_term_as_binary(P,-1), % INTEGER_EXT largest neg
-
- ?line send_term_as_binary(P, 16#07ffffff), % INTEGER_EXT old largest (28 bits)
- ?line send_term_as_binary(P,-16#08000000), % INTEGER_EXT old smallest
- ?line send_term_as_binary(P, 16#08000000), % SMALL_BIG_EXT old smallest pos(*)
- ?line send_term_as_binary(P,-16#08000001), % SMALL_BIG_EXT old largest neg (*)
-
- ?line send_term_as_binary(P, 16#7fffffff), % INTEGER_EXT new largest (32 bits)
- ?line send_term_as_binary(P,-16#80000000), % INTEGER_EXT new smallest
- ?line send_term_as_binary(P, 16#80000000), % SMALL_BIG_EXT new smallest pos(*)
- ?line send_term_as_binary(P,-16#80000001), % SMALL_BIG_EXT new largest neg (*)
-
- ?line send_term_as_binary(P, 16#ffffffff),% SMALL_BIG_EXT largest u32
-
- ?line send_term_as_binary(P, 16#7fffffffffff), % largest i48
- ?line send_term_as_binary(P,-16#800000000000), % smallest i48
- ?line send_term_as_binary(P, 16#ffffffffffff), % largest u48
- ?line send_term_as_binary(P, 16#7fffffffffffffff), % largest i64
- ?line send_term_as_binary(P,-16#8000000000000000), % smallest i64
- ?line send_term_as_binary(P, 16#ffffffffffffffff), % largest u64
- ?line send_term_as_binary(P, []), % illegal type
+ send_term_as_binary(P,0), % SMALL_INTEGER_EXT smallest
+ send_term_as_binary(P,255), % SMALL_INTEGER_EXT largest
+ send_term_as_binary(P,256), % INTEGER_EXT smallest pos (*)
+ send_term_as_binary(P,-1), % INTEGER_EXT largest neg
+
+ send_term_as_binary(P, 16#07ffffff), % INTEGER_EXT old largest (28 bits)
+ send_term_as_binary(P,-16#08000000), % INTEGER_EXT old smallest
+ send_term_as_binary(P, 16#08000000), % SMALL_BIG_EXT old smallest pos(*)
+ send_term_as_binary(P,-16#08000001), % SMALL_BIG_EXT old largest neg (*)
+
+ send_term_as_binary(P, 16#7fffffff), % INTEGER_EXT new largest (32 bits)
+ send_term_as_binary(P,-16#80000000), % INTEGER_EXT new smallest
+ send_term_as_binary(P, 16#80000000), % SMALL_BIG_EXT new smallest pos(*)
+ send_term_as_binary(P,-16#80000001), % SMALL_BIG_EXT new largest neg (*)
+
+ send_term_as_binary(P, 16#ffffffff), % SMALL_BIG_EXT largest u32
+
+ send_term_as_binary(P, 16#7fffffffffff), % largest i48
+ send_term_as_binary(P,-16#800000000000), % smallest i48
+ send_term_as_binary(P, 16#ffffffffffff), % largest u48
+ send_term_as_binary(P, 16#7fffffffffffffff), % largest i64
+ send_term_as_binary(P,-16#8000000000000000), % smallest i64
+ send_term_as_binary(P, 16#ffffffffffffffff), % largest u64
+ send_term_as_binary(P, []), % illegal type
ok.
uc_atup(ATxt) ->
@@ -344,35 +311,32 @@ string_to_atom(String) ->
Utf8List = string_to_utf8_list(String),
Len = length(Utf8List),
TagLen = case Len < 256 of
- true -> [119, Len];
- false -> [118, Len bsr 8, Len band 16#ff]
- end,
+ true -> [119, Len];
+ false -> [118, Len bsr 8, Len band 16#ff]
+ end,
binary_to_term(list_to_binary([131, TagLen, Utf8List])).
string_to_utf8_list([]) ->
[];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 0 =< CP,
- CP =< 16#7F ->
+ 0 =< CP,
+ CP =< 16#7F ->
[CP | string_to_utf8_list(CPs)];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 16#80 =< CP,
- CP =< 16#7FF ->
+ 16#80 =< CP,
+ CP =< 16#7FF ->
[16#C0 bor (CP bsr 6),
- 16#80 bor (16#3F band CP)
- | string_to_utf8_list(CPs)];
+ 16#80 bor (16#3F band CP) | string_to_utf8_list(CPs)];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 16#800 =< CP,
- CP =< 16#FFFF ->
+ 16#800 =< CP,
+ CP =< 16#FFFF ->
[16#E0 bor (CP bsr 12),
16#80 bor (16#3F band (CP bsr 6)),
- 16#80 bor (16#3F band CP)
- | string_to_utf8_list(CPs)];
+ 16#80 bor (16#3F band CP) | string_to_utf8_list(CPs)];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 16#10000 =< CP,
- CP =< 16#10FFFF ->
+ 16#10000 =< CP,
+ CP =< 16#10FFFF ->
[16#F0 bor (CP bsr 18),
16#80 bor (16#3F band (CP bsr 12)),
16#80 bor (16#3F band (CP bsr 6)),
- 16#80 bor (16#3F band CP)
- | string_to_utf8_list(CPs)].
+ 16#80 bor (16#3F band CP) | string_to_utf8_list(CPs)].
diff --git a/lib/erl_interface/test/ei_decode_encode_SUITE.erl b/lib/erl_interface/test/ei_decode_encode_SUITE.erl
index 6a25b98209..a3d0ca0576 100644
--- a/lib/erl_interface/test/ei_decode_encode_SUITE.erl
+++ b/lib/erl_interface/test/ei_decode_encode_SUITE.erl
@@ -24,34 +24,15 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_decode_encode_SUITE_data/ei_decode_encode_test_cases.hrl").
--export(
- [
- all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- test_ei_decode_encode/1
- ]).
+-export([all/0, suite/0,
+ test_ei_decode_encode/1]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[test_ei_decode_encode].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
%% ---------------------------------------------------------------------------
% NOTE: these types have no meaning on the C side so we pass them
@@ -60,20 +41,19 @@ end_per_group(_GroupName, Config) ->
%% ######################################################################## %%
-test_ei_decode_encode(suite) -> [];
test_ei_decode_encode(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_decode_encode),
+ P = runner:start(?test_ei_decode_encode),
Fun = fun (X) -> {X,true} end,
Pid = self(),
Port = case os:type() of
- {win32,_} ->
- open_port({spawn,"sort"},[]);
- {unix, darwin} ->
- open_port({spawn,"/usr/bin/true"},[]);
- _ ->
- open_port({spawn,"/bin/true"},[])
- end,
+ {win32,_} ->
+ open_port({spawn,"sort"},[]);
+ {unix, darwin} ->
+ open_port({spawn,"/usr/bin/true"},[]);
+ _ ->
+ open_port({spawn,"/bin/true"},[])
+ end,
Ref = make_ref(),
Trace = {1,2,3,self(),4}, % FIXME how to construct?!
@@ -86,47 +66,47 @@ test_ei_decode_encode(Config) when is_list(Config) ->
BigLargeB = 1 bsl 11112 + BigSmallB,
BigLargeC = BigSmallA * BigSmallB * BigSmallC * BigSmallA,
- ?line send_rec(P, Fun),
- ?line send_rec(P, Pid),
- ?line send_rec(P, Port),
- ?line send_rec(P, Ref),
- ?line send_rec(P, Trace),
+ send_rec(P, Fun),
+ send_rec(P, Pid),
+ send_rec(P, Port),
+ send_rec(P, Ref),
+ send_rec(P, Trace),
% bigs
- ?line send_rec(P, BigSmallA),
- ?line send_rec(P, BigSmallB),
- ?line send_rec(P, BigSmallC),
-
- ?line send_rec(P, BigLargeA),
- ?line send_rec(P, BigLargeB),
- ?line send_rec(P, BigLargeC),
+ send_rec(P, BigSmallA),
+ send_rec(P, BigSmallB),
+ send_rec(P, BigSmallC),
+
+ send_rec(P, BigLargeA),
+ send_rec(P, BigLargeB),
+ send_rec(P, BigLargeC),
%% Test large node containers...
- ?line ThisNode = {node(), erlang:system_info(creation)},
- ?line TXPid = mk_pid(ThisNode, 32767, 8191),
- ?line TXPort = mk_port(ThisNode, 268435455),
- ?line TXRef = mk_ref(ThisNode, [262143, 4294967295, 4294967295]),
+ ThisNode = {node(), erlang:system_info(creation)},
+ TXPid = mk_pid(ThisNode, 32767, 8191),
+ TXPort = mk_port(ThisNode, 268435455),
+ TXRef = mk_ref(ThisNode, [262143, 4294967295, 4294967295]),
- ?line OtherNode = {gurka@sallad, 2},
- ?line OXPid = mk_pid(OtherNode, 32767, 8191),
- ?line OXPort = mk_port(OtherNode, 268435455),
- ?line OXRef = mk_ref(OtherNode, [262143, 4294967295, 4294967295]),
+ OtherNode = {gurka@sallad, 2},
+ OXPid = mk_pid(OtherNode, 32767, 8191),
+ OXPort = mk_port(OtherNode, 268435455),
+ OXRef = mk_ref(OtherNode, [262143, 4294967295, 4294967295]),
- ?line send_rec(P, TXPid),
- ?line send_rec(P, TXPort),
- ?line send_rec(P, TXRef),
- ?line send_rec(P, OXPid),
- ?line send_rec(P, OXPort),
- ?line send_rec(P, OXRef),
+ send_rec(P, TXPid),
+ send_rec(P, TXPort),
+ send_rec(P, TXRef),
+ send_rec(P, OXPid),
+ send_rec(P, OXPort),
+ send_rec(P, OXRef),
%% Unicode atoms
[begin send_rec(P, Atom),
- send_rec(P, mk_pid({Atom,1}, 23434, 3434)),
- send_rec(P, mk_port({Atom,1}, 2343434)),
- send_rec(P, mk_ref({Atom,1}, [262143, 8723648, 24097245])),
- void
+ send_rec(P, mk_pid({Atom,1}, 23434, 3434)),
+ send_rec(P, mk_port({Atom,1}, 2343434)),
+ send_rec(P, mk_ref({Atom,1}, [262143, 8723648, 24097245])),
+ void
end || Atom <- unicode_atom_data()],
send_rec(P, {}),
@@ -137,7 +117,7 @@ test_ei_decode_encode(Config) when is_list(Config) ->
send_rec(P, #{key => value}),
send_rec(P, maps:put(Port, Ref, #{key => value, key2 => Pid})),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
@@ -146,29 +126,27 @@ test_ei_decode_encode(Config) when is_list(Config) ->
% We read two packets for each test, the ei_decode_encode and ei_x_decode_encode version....
send_rec(P, Term) when is_port(P) ->
- %%?t:format("Testing: ~p~n", [Term]),
P ! {self(), {command, term_to_binary(Term)}},
{_B,Term} = get_buf_and_term(P).
-
get_buf_and_term(P) ->
B = get_binaries(P),
case B of
- <<131>> ->
- io:format("(got single magic, no content)\n",[]),
- {B,'$$magic$$'};
- <<131,_>> ->
- T = binary_to_term(B),
- io:format("~w\n~w\n(got magic)\n",[B,T]),
- {B,T};
- _ ->
- B1 = list_to_binary([131,B]), % No magic, add
- T = binary_to_term(B1),
- %io:format("~w\n~w\n(got no magic)\n",[B,T]),
- {B,T}
+ <<131>> ->
+ io:format("(got single magic, no content)\n",[]),
+ {B,'$$magic$$'};
+ <<131,_>> ->
+ T = binary_to_term(B),
+ io:format("~w\n~w\n(got magic)\n",[B,T]),
+ {B,T};
+ _ ->
+ B1 = list_to_binary([131,B]), % No magic, add
+ T = binary_to_term(B1),
+ %io:format("~w\n~w\n(got no magic)\n",[B,T]),
+ {B,T}
end.
-
+
get_binaries(P) ->
B1 = get_binary(P),
@@ -177,40 +155,17 @@ get_binaries(P) ->
get_binary(P) ->
case runner:get_term(P) of
- {bytes,L} ->
- B = list_to_binary(L),
- %%io:format("~w\n",[L]),
-% For strange reasons <<131>> show up as <>....
-% io:format("~w\n",[B]),
- B;
- Other ->
- Other
+ {bytes,L} ->
+ B = list_to_binary(L),
+ %%io:format("~w\n",[L]),
+ % For strange reasons <<131>> show up as <>....
+ % io:format("~w\n",[B]),
+ B;
+ Other ->
+ Other
end.
%%
-
-% We use our own get_term()
-
-get_term(P) ->
- case runner:get_term(P) of
- {bytes,[131]} ->
- io:format("(got single magic, no content)\n",[]),
- '$$magic$$';
- {bytes,[131,L]} ->
- B = list_to_binary(L),
- T = binary_to_term(B),
- io:format("~w\n~w\n(got magic)\n",[L,T]),
- T;
- {bytes,L} ->
- B = list_to_binary([131,L]),
- T = binary_to_term(B),
- io:format("~w\n~w\n(got no magic)\n",[L,T]),
- T;
- Other ->
- Other
- end.
-
-%%
%% Node container constructor functions
%%
@@ -249,17 +204,17 @@ mk_pid({NodeName, Creation}, Number, Serial) when is_atom(NodeName) ->
mk_pid({NodeNameExt, Creation}, Number, Serial);
mk_pid({NodeNameExt, Creation}, Number, Serial) ->
case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
- ?PID_EXT,
- NodeNameExt,
- uint32_be(Number),
- uint32_be(Serial),
- uint8(Creation)])) of
- Pid when is_pid(Pid) ->
- Pid;
- {'EXIT', {badarg, _}} ->
- exit({badarg, mk_pid, [{NodeNameExt, Creation}, Number, Serial]});
- Other ->
- exit({unexpected_binary_to_term_result, Other})
+ ?PID_EXT,
+ NodeNameExt,
+ uint32_be(Number),
+ uint32_be(Serial),
+ uint8(Creation)])) of
+ Pid when is_pid(Pid) ->
+ Pid;
+ {'EXIT', {badarg, _}} ->
+ exit({badarg, mk_pid, [{NodeNameExt, Creation}, Number, Serial]});
+ Other ->
+ exit({unexpected_binary_to_term_result, Other})
end.
mk_port({NodeName, Creation}, Number) when is_atom(NodeName) ->
@@ -267,56 +222,56 @@ mk_port({NodeName, Creation}, Number) when is_atom(NodeName) ->
mk_port({NodeNameExt, Creation}, Number);
mk_port({NodeNameExt, Creation}, Number) ->
case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
- ?PORT_EXT,
- NodeNameExt,
- uint32_be(Number),
- uint8(Creation)])) of
- Port when is_port(Port) ->
- Port;
- {'EXIT', {badarg, _}} ->
- exit({badarg, mk_port, [{NodeNameExt, Creation}, Number]});
- Other ->
- exit({unexpected_binary_to_term_result, Other})
+ ?PORT_EXT,
+ NodeNameExt,
+ uint32_be(Number),
+ uint8(Creation)])) of
+ Port when is_port(Port) ->
+ Port;
+ {'EXIT', {badarg, _}} ->
+ exit({badarg, mk_port, [{NodeNameExt, Creation}, Number]});
+ Other ->
+ exit({unexpected_binary_to_term_result, Other})
end.
mk_ref({NodeName, Creation}, Numbers) when is_atom(NodeName),
- is_integer(Creation),
- is_list(Numbers) ->
+ is_integer(Creation),
+ is_list(Numbers) ->
<<?VERSION_MAGIC, NodeNameExt/binary>> = term_to_binary(NodeName),
mk_ref({NodeNameExt, Creation}, Numbers);
mk_ref({NodeNameExt, Creation}, [Number]) when is_binary(NodeNameExt),
- is_integer(Creation),
- is_integer(Number) ->
+ is_integer(Creation),
+ is_integer(Number) ->
case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
- ?REFERENCE_EXT,
- NodeNameExt,
- uint32_be(Number),
- uint8(Creation)])) of
- Ref when is_reference(Ref) ->
- Ref;
- {'EXIT', {badarg, _}} ->
- exit({badarg, mk_ref, [{NodeNameExt, Creation}, [Number]]});
- Other ->
- exit({unexpected_binary_to_term_result, Other})
+ ?REFERENCE_EXT,
+ NodeNameExt,
+ uint32_be(Number),
+ uint8(Creation)])) of
+ Ref when is_reference(Ref) ->
+ Ref;
+ {'EXIT', {badarg, _}} ->
+ exit({badarg, mk_ref, [{NodeNameExt, Creation}, [Number]]});
+ Other ->
+ exit({unexpected_binary_to_term_result, Other})
end;
mk_ref({NodeNameExt, Creation}, Numbers) when is_binary(NodeNameExt),
- is_integer(Creation),
- is_list(Numbers) ->
+ is_integer(Creation),
+ is_list(Numbers) ->
case catch binary_to_term(list_to_binary([?VERSION_MAGIC,
- ?NEW_REFERENCE_EXT,
- uint16_be(length(Numbers)),
- NodeNameExt,
- uint8(Creation),
- lists:map(fun (N) ->
- uint32_be(N)
- end,
- Numbers)])) of
- Ref when is_reference(Ref) ->
- Ref;
- {'EXIT', {badarg, _}} ->
- exit({badarg, mk_ref, [{NodeNameExt, Creation}, Numbers]});
- Other ->
- exit({unexpected_binary_to_term_result, Other})
+ ?NEW_REFERENCE_EXT,
+ uint16_be(length(Numbers)),
+ NodeNameExt,
+ uint8(Creation),
+ lists:map(fun (N) ->
+ uint32_be(N)
+ end,
+ Numbers)])) of
+ Ref when is_reference(Ref) ->
+ Ref;
+ {'EXIT', {badarg, _}} ->
+ exit({badarg, mk_ref, [{NodeNameExt, Creation}, Numbers]});
+ Other ->
+ exit({unexpected_binary_to_term_result, Other})
end.
@@ -333,10 +288,10 @@ unicode_atom_data() ->
uc_atup(lists:seq(65500, 65754)),
uc_atup(lists:seq(65500, 65563))
| lists:map(fun (N) ->
- Pow2 = (1 bsl N),
- uc_atup(lists:seq(Pow2 - 127, Pow2 + 127))
- end,
- lists:seq(7, 20))
+ Pow2 = (1 bsl N),
+ uc_atup(lists:seq(Pow2 - 127, Pow2 + 127))
+ end,
+ lists:seq(7, 20))
].
uc_atup(ATxt) ->
@@ -346,33 +301,33 @@ string_to_atom(String) ->
Utf8List = string_to_utf8_list(String),
Len = length(Utf8List),
TagLen = case Len < 256 of
- true -> [119, Len];
- false -> [118, Len bsr 8, Len band 16#ff]
- end,
+ true -> [119, Len];
+ false -> [118, Len bsr 8, Len band 16#ff]
+ end,
binary_to_term(list_to_binary([131, TagLen, Utf8List])).
string_to_utf8_list([]) ->
[];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 0 =< CP,
- CP =< 16#7F ->
+ 0 =< CP,
+ CP =< 16#7F ->
[CP | string_to_utf8_list(CPs)];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 16#80 =< CP,
- CP =< 16#7FF ->
+ 16#80 =< CP,
+ CP =< 16#7FF ->
[16#C0 bor (CP bsr 6),
16#80 bor (16#3F band CP)
| string_to_utf8_list(CPs)];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 16#800 =< CP,
- CP =< 16#FFFF ->
+ 16#800 =< CP,
+ CP =< 16#FFFF ->
[16#E0 bor (CP bsr 12),
16#80 bor (16#3F band (CP bsr 6)),
16#80 bor (16#3F band CP)
| string_to_utf8_list(CPs)];
string_to_utf8_list([CP|CPs]) when is_integer(CP),
- 16#10000 =< CP,
- CP =< 16#10FFFF ->
+ 16#10000 =< CP,
+ CP =< 16#10FFFF ->
[16#F0 bor (CP bsr 18),
16#80 bor (16#3F band (CP bsr 12)),
16#80 bor (16#3F band (CP bsr 6)),
diff --git a/lib/erl_interface/test/ei_encode_SUITE.erl b/lib/erl_interface/test/ei_encode_SUITE.erl
index d94f3adf42..fab8367eed 100644
--- a/lib/erl_interface/test/ei_encode_SUITE.erl
+++ b/lib/erl_interface/test/ei_encode_SUITE.erl
@@ -24,22 +24,19 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_encode_SUITE_data/ei_encode_test_cases.hrl").
--export(
- [
- all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- test_ei_encode_long/1,
- test_ei_encode_ulong/1,
- test_ei_encode_longlong/1,
- test_ei_encode_ulonglong/1,
- test_ei_encode_char/1,
- test_ei_encode_misc/1,
- test_ei_encode_fails/1,
- test_ei_encode_utf8_atom/1,
- test_ei_encode_utf8_atom_len/1
- ]).
-
-suite() -> [{ct_hooks,[ts_install_cth]}].
+-export([all/0, suite/0,
+ test_ei_encode_long/1,
+ test_ei_encode_ulong/1,
+ test_ei_encode_longlong/1,
+ test_ei_encode_ulonglong/1,
+ test_ei_encode_char/1,
+ test_ei_encode_misc/1,
+ test_ei_encode_fails/1,
+ test_ei_encode_utf8_atom/1,
+ test_ei_encode_utf8_atom_len/1]).
+
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[test_ei_encode_long, test_ei_encode_ulong,
@@ -48,21 +45,6 @@ all() ->
test_ei_encode_fails, test_ei_encode_utf8_atom,
test_ei_encode_utf8_atom_len].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
%% ---------------------------------------------------------------------------
@@ -72,105 +54,101 @@ end_per_group(_GroupName, Config) ->
%% ######################################################################## %%
-test_ei_encode_long(suite) -> [];
test_ei_encode_long(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_encode_long),
+ P = runner:start(?test_ei_encode_long),
- ?line {<<97,0>> ,0} = get_buf_and_term(P),
- ?line {<<97,255>> ,255} = get_buf_and_term(P),
- ?line {<<98,256:32/big-signed-integer>>,256} = get_buf_and_term(P),
- ?line {<<98,-1:32/big-signed-integer>> ,-1} = get_buf_and_term(P),
+ {<<97,0>> ,0} = get_buf_and_term(P),
+ {<<97,255>> ,255} = get_buf_and_term(P),
+ {<<98,256:32/big-signed-integer>>,256} = get_buf_and_term(P),
+ {<<98,-1:32/big-signed-integer>> ,-1} = get_buf_and_term(P),
- ?line {<<98, 16#07ffffff:32/big-signed-integer>>, 16#07ffffff} = get_buf_and_term(P),
- ?line {<<98,-16#08000000:32/big-signed-integer>>,-16#08000000} = get_buf_and_term(P),
- ?line {<<110,4,0, 0,0,0,8>> , 16#08000000} = get_buf_and_term(P),
- ?line {<<110,4,1, 1,0,0,8>> ,-16#08000001} = get_buf_and_term(P),
+ {<<98, 16#07ffffff:32/big-signed-integer>>, 16#07ffffff} = get_buf_and_term(P),
+ {<<98,-16#08000000:32/big-signed-integer>>,-16#08000000} = get_buf_and_term(P),
+ {<<110,4,0, 0,0,0,8>> , 16#08000000} = get_buf_and_term(P),
+ {<<110,4,1, 1,0,0,8>> ,-16#08000001} = get_buf_and_term(P),
- ?line {<<110,4,0, 255,255,255,127>> , 16#7fffffff} = get_buf_and_term(P),
- ?line {<<110,4,1, 0,0,0,128>> ,-16#80000000} = get_buf_and_term(P),
+ {<<110,4,0, 255,255,255,127>> , 16#7fffffff} = get_buf_and_term(P),
+ {<<110,4,1, 0,0,0,128>> ,-16#80000000} = get_buf_and_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
-test_ei_encode_ulong(suite) -> [];
test_ei_encode_ulong(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_encode_ulong),
+ P = runner:start(?test_ei_encode_ulong),
- ?line {<<97,0>> ,0} = get_buf_and_term(P),
- ?line {<<97,255>> ,255} = get_buf_and_term(P),
- ?line {<<98,256:32/big-unsigned-integer>>,256} = get_buf_and_term(P),
+ {<<97,0>> ,0} = get_buf_and_term(P),
+ {<<97,255>> ,255} = get_buf_and_term(P),
+ {<<98,256:32/big-unsigned-integer>>,256} = get_buf_and_term(P),
- ?line {<<98, 16#07ffffff:32/big-signed-integer>>,16#07ffffff} = get_buf_and_term(P),
- ?line {<<110,4,0, 0,0,0,8>> ,16#08000000} = get_buf_and_term(P),
+ {<<98, 16#07ffffff:32/big-signed-integer>>,16#07ffffff} = get_buf_and_term(P),
+ {<<110,4,0, 0,0,0,8>> ,16#08000000} = get_buf_and_term(P),
- ?line {<<110,4,0, 255,255,255,127>> ,16#7fffffff} = get_buf_and_term(P),
- ?line {<<110,4,0, 0,0,0,128>> ,16#80000000} = get_buf_and_term(P),
- ?line {<<110,4,0, 255,255,255,255>> ,16#ffffffff} = get_buf_and_term(P),
+ {<<110,4,0, 255,255,255,127>> ,16#7fffffff} = get_buf_and_term(P),
+ {<<110,4,0, 0,0,0,128>> ,16#80000000} = get_buf_and_term(P),
+ {<<110,4,0, 255,255,255,255>> ,16#ffffffff} = get_buf_and_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
-test_ei_encode_longlong(suite) -> [];
test_ei_encode_longlong(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skip,"Skipped on VxWorks"};
- _ ->
- ?line P = runner:start(?test_ei_encode_longlong),
-
- ?line {<<97,0>> ,0} = get_buf_and_term(P),
- ?line {<<97,255>> ,255} = get_buf_and_term(P),
- ?line {<<98,256:32/big-signed-integer>>,256} = get_buf_and_term(P),
- ?line {<<98,-1:32/big-signed-integer>> ,-1} = get_buf_and_term(P),
-
- ?line {<<98, 16#07ffffff:32/big-signed-integer>>, 16#07ffffff} = get_buf_and_term(P),
- ?line {<<98,-16#08000000:32/big-signed-integer>>,-16#08000000} = get_buf_and_term(P),
- ?line {<<110,4,0, 0,0,0,8>> , 16#08000000} = get_buf_and_term(P),
- ?line {<<110,4,1, 1,0,0,8>> ,-16#08000001} = get_buf_and_term(P),
-
- ?line {<<110,4,0, 255,255,255,127>> , 16#7fffffff} = get_buf_and_term(P),
- ?line {<<110,4,1, 0,0,0,128>> ,-16#80000000} = get_buf_and_term(P),
- ?line {<<110,6,0, 255,255,255,255,255,127>> , 16#7fffffffffff} = get_buf_and_term(P),
- ?line {<<110,6,1, 0,0,0,0,0,128>> ,-16#800000000000} = get_buf_and_term(P),
- ?line {<<110,8,0, 255,255,255,255,255,255,255,127>>,16#7fffffffffffffff} = get_buf_and_term(P),
- ?line {<<110,8,1, 0,0,0,0,0,0,0,128>> ,-16#8000000000000000} = get_buf_and_term(P),
-
- ?line runner:recv_eot(P),
- ok
+ vxworks ->
+ {skip,"Skipped on VxWorks"};
+ _ ->
+ P = runner:start(?test_ei_encode_longlong),
+
+ {<<97,0>> ,0} = get_buf_and_term(P),
+ {<<97,255>> ,255} = get_buf_and_term(P),
+ {<<98,256:32/big-signed-integer>>,256} = get_buf_and_term(P),
+ {<<98,-1:32/big-signed-integer>> ,-1} = get_buf_and_term(P),
+
+ {<<98, 16#07ffffff:32/big-signed-integer>>, 16#07ffffff} = get_buf_and_term(P),
+ {<<98,-16#08000000:32/big-signed-integer>>,-16#08000000} = get_buf_and_term(P),
+ {<<110,4,0, 0,0,0,8>> , 16#08000000} = get_buf_and_term(P),
+ {<<110,4,1, 1,0,0,8>> ,-16#08000001} = get_buf_and_term(P),
+
+ {<<110,4,0, 255,255,255,127>> , 16#7fffffff} = get_buf_and_term(P),
+ {<<110,4,1, 0,0,0,128>> ,-16#80000000} = get_buf_and_term(P),
+ {<<110,6,0, 255,255,255,255,255,127>> , 16#7fffffffffff} = get_buf_and_term(P),
+ {<<110,6,1, 0,0,0,0,0,128>> ,-16#800000000000} = get_buf_and_term(P),
+ {<<110,8,0, 255,255,255,255,255,255,255,127>>,16#7fffffffffffffff} = get_buf_and_term(P),
+ {<<110,8,1, 0,0,0,0,0,0,0,128>> ,-16#8000000000000000} = get_buf_and_term(P),
+
+ runner:recv_eot(P),
+ ok
end.
%% ######################################################################## %%
-test_ei_encode_ulonglong(suite) -> [];
test_ei_encode_ulonglong(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skip,"Skipped on VxWorks"};
- _ ->
- ?line P = runner:start(?test_ei_encode_ulonglong),
-
- ?line {<<97,0>> ,0} = get_buf_and_term(P),
- ?line {<<97,255>> ,255} = get_buf_and_term(P),
- ?line {<<98,256:32/big-unsigned-integer>>,256} = get_buf_and_term(P),
-
- ?line {<<98, 16#07ffffff:32/big-signed-integer>>,16#07ffffff} = get_buf_and_term(P),
- ?line {<<110,4,0, 0,0,0,8>> ,16#08000000} = get_buf_and_term(P),
-
- ?line {<<110,4,0, 255,255,255,127>> ,16#7fffffff} = get_buf_and_term(P),
- ?line {<<110,4,0, 0,0,0,128>> ,16#80000000} = get_buf_and_term(P),
- ?line {<<110,4,0, 255,255,255,255>> ,16#ffffffff} = get_buf_and_term(P),
- ?line {<<110,6,0, 255,255,255,255,255,255>>,16#ffffffffffff} = get_buf_and_term(P),
- ?line {<<110,8,0, 255,255,255,255,255,255,255,255>>,16#ffffffffffffffff} = get_buf_and_term(P),
-
- ?line runner:recv_eot(P),
- ok
+ vxworks ->
+ {skip,"Skipped on VxWorks"};
+ _ ->
+ P = runner:start(?test_ei_encode_ulonglong),
+
+ {<<97,0>> ,0} = get_buf_and_term(P),
+ {<<97,255>> ,255} = get_buf_and_term(P),
+ {<<98,256:32/big-unsigned-integer>>,256} = get_buf_and_term(P),
+
+ {<<98, 16#07ffffff:32/big-signed-integer>>,16#07ffffff} = get_buf_and_term(P),
+ {<<110,4,0, 0,0,0,8>> ,16#08000000} = get_buf_and_term(P),
+
+ {<<110,4,0, 255,255,255,127>> ,16#7fffffff} = get_buf_and_term(P),
+ {<<110,4,0, 0,0,0,128>> ,16#80000000} = get_buf_and_term(P),
+ {<<110,4,0, 255,255,255,255>> ,16#ffffffff} = get_buf_and_term(P),
+ {<<110,6,0, 255,255,255,255,255,255>>,16#ffffffffffff} = get_buf_and_term(P),
+ {<<110,8,0, 255,255,255,255,255,255,255,255>>,16#ffffffffffffffff} = get_buf_and_term(P),
+
+ runner:recv_eot(P),
+ ok
end.
@@ -179,115 +157,112 @@ test_ei_encode_ulonglong(Config) when is_list(Config) ->
%% it is unsigned.
%% FIXME maybe the API should change to use "unsigned char" to be clear?!
-test_ei_encode_char(suite) -> [];
test_ei_encode_char(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_encode_char),
+ P = runner:start(?test_ei_encode_char),
- ?line {<<97, 0>>,0} = get_buf_and_term(P),
- ?line {<<97,127>>,16#7f} = get_buf_and_term(P),
- ?line {<<97,255>>,16#ff} = get_buf_and_term(P),
+ {<<97, 0>>,0} = get_buf_and_term(P),
+ {<<97,127>>,16#7f} = get_buf_and_term(P),
+ {<<97,255>>,16#ff} = get_buf_and_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
-test_ei_encode_misc(suite) -> [];
test_ei_encode_misc(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_encode_misc),
+ P = runner:start(?test_ei_encode_misc),
- ?line <<131>> = get_binaries(P),
+ <<131>> = get_binaries(P),
- ?line {<<70,_:8/binary>>,F0} = get_buf_and_term(P),
- ?line true = match_float(F0, 0.0),
+ {<<70,_:8/binary>>,F0} = get_buf_and_term(P),
+ true = match_float(F0, 0.0),
- ?line {<<70,_:8/binary>>,Fn1} = get_buf_and_term(P),
- ?line true = match_float(Fn1, -1.0),
+ {<<70,_:8/binary>>,Fn1} = get_buf_and_term(P),
+ true = match_float(Fn1, -1.0),
- ?line {<<70,_:8/binary>>,Fp1} = get_buf_and_term(P),
- ?line true = match_float(Fp1, 1.0),
+ {<<70,_:8/binary>>,Fp1} = get_buf_and_term(P),
+ true = match_float(Fp1, 1.0),
- ?line {<<100,0,5,"false">>,false} = get_buf_and_term(P),
- ?line {<<100,0,4,"true">> ,true} = get_buf_and_term(P),
- ?line {<<100,0,4,"true">> ,true} = get_buf_and_term(P),
- ?line {<<100,0,4,"true">> ,true} = get_buf_and_term(P),
+ {<<100,0,5,"false">>,false} = get_buf_and_term(P),
+ {<<100,0,4,"true">> ,true} = get_buf_and_term(P),
+ {<<100,0,4,"true">> ,true} = get_buf_and_term(P),
+ {<<100,0,4,"true">> ,true} = get_buf_and_term(P),
- ?line {<<100,0,3,"foo">>,foo} = get_buf_and_term(P),
- ?line {<<100,0,3,"foo">>,foo} = get_buf_and_term(P),
- ?line {<<100,0,0,"">>,''} = get_buf_and_term(P),
- ?line {<<100,0,0,"">>,''} = get_buf_and_term(P),
- ?line {<<100,0,6,"ÅÄÖåäö">>,'ÅÄÖåäö'} = get_buf_and_term(P),
- ?line {<<100,0,6,"ÅÄÖåäö">>,'ÅÄÖåäö'} = get_buf_and_term(P),
+ {<<100,0,3,"foo">>,foo} = get_buf_and_term(P),
+ {<<100,0,3,"foo">>,foo} = get_buf_and_term(P),
+ {<<100,0,0,"">>,''} = get_buf_and_term(P),
+ {<<100,0,0,"">>,''} = get_buf_and_term(P),
+ {<<100,0,6,"ÅÄÖåäö">>,'ÅÄÖåäö'} = get_buf_and_term(P),
+ {<<100,0,6,"ÅÄÖåäö">>,'ÅÄÖåäö'} = get_buf_and_term(P),
- ?line {<<107,0,3,"foo">>,"foo"} = get_buf_and_term(P),
- ?line {<<107,0,3,"foo">>,"foo"} = get_buf_and_term(P),
- ?line {<<106>>,""} = get_buf_and_term(P),
- ?line {<<106>>,""} = get_buf_and_term(P),
- ?line {<<107,0,6,"ÅÄÖåäö">>,"ÅÄÖåäö"} = get_buf_and_term(P),
- ?line {<<107,0,6,"ÅÄÖåäö">>,"ÅÄÖåäö"} = get_buf_and_term(P),
+ {<<107,0,3,"foo">>,"foo"} = get_buf_and_term(P),
+ {<<107,0,3,"foo">>,"foo"} = get_buf_and_term(P),
+ {<<106>>,""} = get_buf_and_term(P),
+ {<<106>>,""} = get_buf_and_term(P),
+ {<<107,0,6,"ÅÄÖåäö">>,"ÅÄÖåäö"} = get_buf_and_term(P),
+ {<<107,0,6,"ÅÄÖåäö">>,"ÅÄÖåäö"} = get_buf_and_term(P),
- ?line {<<109,0,0,0,3,"foo">>,<<"foo">>} = get_buf_and_term(P),
- ?line {<<109,0,0,0,0,"">>,<<>>} = get_buf_and_term(P),
- ?line {<<109,0,0,0,6,"ÅÄÖåäö">>,<<"ÅÄÖåäö">>} = get_buf_and_term(P),
+ {<<109,0,0,0,3,"foo">>,<<"foo">>} = get_buf_and_term(P),
+ {<<109,0,0,0,0,"">>,<<>>} = get_buf_and_term(P),
+ {<<109,0,0,0,6,"ÅÄÖåäö">>,<<"ÅÄÖåäö">>} = get_buf_and_term(P),
- ?line {<<104,0>>,{}} = get_buf_and_term(P), % Tuple header for {}
- ?line {<<106>>,[]} = get_buf_and_term(P), % Empty list []
+ {<<104,0>>,{}} = get_buf_and_term(P), % Tuple header for {}
+ {<<106>>,[]} = get_buf_and_term(P), % Empty list []
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
-test_ei_encode_fails(suite) -> [];
test_ei_encode_fails(Config) when is_list(Config) ->
- ?line P = runner:start(?test_ei_encode_fails),
+ P = runner:start(?test_ei_encode_fails),
- ?line XAtom = list_to_atom(lists:duplicate(255, $x)),
- ?line YAtom = list_to_atom(lists:duplicate(255, $y)),
+ XAtom = list_to_atom(lists:duplicate(255, $x)),
+ YAtom = list_to_atom(lists:duplicate(255, $y)),
- ?line XAtom = get_term(P),
- ?line XAtom = get_term(P),
- ?line YAtom = get_term(P),
- ?line YAtom = get_term(P),
+ XAtom = get_term(P),
+ XAtom = get_term(P),
+ YAtom = get_term(P),
+ YAtom = get_term(P),
- ?line {{{{}}}} = get_term(P),
+ {{{{}}}} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
test_ei_encode_utf8_atom(Config) ->
- ?line P = runner:start(?test_ei_encode_utf8_atom),
-
- ?line {<<119,2,195,133>>,'Å'} = get_buf_and_term(P),
- ?line {<<100,0,1,197>>,'Å'} = get_buf_and_term(P),
- ?line {<<100,0,1,197>>,'Å'} = get_buf_and_term(P),
- ?line {<<119,2,195,133>>,'Å'} = get_buf_and_term(P),
+ P = runner:start(?test_ei_encode_utf8_atom),
- ?line {<<119,1,$A>>,'A'} = get_buf_and_term(P),
- ?line {<<100,0,1,$A>>,'A'} = get_buf_and_term(P),
+ {<<119,2,195,133>>,'Å'} = get_buf_and_term(P),
+ {<<100,0,1,197>>,'Å'} = get_buf_and_term(P),
+ {<<100,0,1,197>>,'Å'} = get_buf_and_term(P),
+ {<<119,2,195,133>>,'Å'} = get_buf_and_term(P),
- ?line runner:recv_eot(P),
+ {<<119,1,$A>>,'A'} = get_buf_and_term(P),
+ {<<100,0,1,$A>>,'A'} = get_buf_and_term(P),
+
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
test_ei_encode_utf8_atom_len(Config) ->
- ?line P = runner:start(?test_ei_encode_utf8_atom_len),
-
- ?line {<<119,2,195,133>>,'Å'} = get_buf_and_term(P),
- ?line {<<100,0,2,197,196>>,'ÅÄ'} = get_buf_and_term(P),
- ?line {<<100,0,1,197>>,'Å'} = get_buf_and_term(P),
- ?line {<<119,4,195,133,195,132>>,'ÅÄ'} = get_buf_and_term(P),
-
- ?line {<<119,1,$A>>,'A'} = get_buf_and_term(P),
- ?line {<<100,0,2,$A,$B>>,'AB'} = get_buf_and_term(P),
- ?line {<<100,0,255,_:(255*8)>>,_} = get_buf_and_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?test_ei_encode_utf8_atom_len),
+
+ {<<119,2,195,133>>,'Å'} = get_buf_and_term(P),
+ {<<100,0,2,197,196>>,'ÅÄ'} = get_buf_and_term(P),
+ {<<100,0,1,197>>,'Å'} = get_buf_and_term(P),
+ {<<119,4,195,133,195,132>>,'ÅÄ'} = get_buf_and_term(P),
+
+ {<<119,1,$A>>,'A'} = get_buf_and_term(P),
+ {<<100,0,2,$A,$B>>,'AB'} = get_buf_and_term(P),
+ {<<100,0,255,_:(255*8)>>,_} = get_buf_and_term(P),
+
+ runner:recv_eot(P),
ok.
%% ######################################################################## %%
@@ -297,20 +272,20 @@ test_ei_encode_utf8_atom_len(Config) ->
get_buf_and_term(P) ->
B = get_binaries(P),
case B of
- <<131>> ->
- io:format("(got single magic, no content)\n",[]),
- {B,'$$magic$$'};
- <<131,_>> ->
- T = binary_to_term(B),
- io:format("~w\n~w\n(got magic)\n",[B,T]),
- {B,T};
- _ ->
- B1 = list_to_binary([131,B]), % No magic, add
- T = binary_to_term(B1),
- io:format("~w\n~w\n(got no magic)\n",[B,T]),
- {B,T}
+ <<131>> ->
+ io:format("(got single magic, no content)\n",[]),
+ {B,'$$magic$$'};
+ <<131,_>> ->
+ T = binary_to_term(B),
+ io:format("~w\n~w\n(got magic)\n",[B,T]),
+ {B,T};
+ _ ->
+ B1 = list_to_binary([131,B]), % No magic, add
+ T = binary_to_term(B1),
+ io:format("~w\n~w\n(got no magic)\n",[B,T]),
+ {B,T}
end.
-
+
get_binaries(P) ->
B1 = get_binary(P),
@@ -319,14 +294,14 @@ get_binaries(P) ->
get_binary(P) ->
case runner:get_term(P) of
- {bytes,L} ->
- B = list_to_binary(L),
- io:format("~w\n",[L]),
-% For strange reasons <<131>> show up as <>....
-% io:format("~w\n",[B]),
- B;
- Other ->
- Other
+ {bytes,L} ->
+ B = list_to_binary(L),
+ io:format("~w\n",[L]),
+ % For strange reasons <<131>> show up as <>....
+ % io:format("~w\n",[B]),
+ B;
+ Other ->
+ Other
end.
%%
@@ -335,27 +310,26 @@ get_binary(P) ->
get_term(P) ->
case runner:get_term(P) of
- {bytes,[131]} ->
- io:format("(got single magic, no content)\n",[]),
- '$$magic$$';
- {bytes,[131,L]} ->
- B = list_to_binary(L),
- T = binary_to_term(B),
- io:format("~w\n~w\n(got magic)\n",[L,T]),
- T;
- {bytes,L} ->
- B = list_to_binary([131,L]),
- T = binary_to_term(B),
- io:format("~w\n~w\n(got no magic)\n",[L,T]),
- T;
- Other ->
- Other
+ {bytes,[131]} ->
+ io:format("(got single magic, no content)\n",[]),
+ '$$magic$$';
+ {bytes,[131,L]} ->
+ B = list_to_binary(L),
+ T = binary_to_term(B),
+ io:format("~w\n~w\n(got magic)\n",[L,T]),
+ T;
+ {bytes,L} ->
+ B = list_to_binary([131,L]),
+ T = binary_to_term(B),
+ io:format("~w\n~w\n(got no magic)\n",[L,T]),
+ T;
+ Other ->
+ Other
end.
-
+
%%
match_float(F, Match) when is_float(F), is_float(Match), F == Match ->
true;
match_float(F, Match) when is_float(F), F > Match*0.99, F < Match*1.01 ->
true.
-
diff --git a/lib/erl_interface/test/ei_format_SUITE.erl b/lib/erl_interface/test/ei_format_SUITE.erl
index ed6a755f9b..0054e5a14b 100644
--- a/lib/erl_interface/test/ei_format_SUITE.erl
+++ b/lib/erl_interface/test/ei_format_SUITE.erl
@@ -24,155 +24,131 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_format_SUITE_data/ei_format_test_cases.hrl").
--export([
- format_wo_ver/1,
- all/0, suite/0,groups/0,
- init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- atoms/1,
- tuples/1,
- lists/1
- ]).
+-export([format_wo_ver/1,
+ all/0, suite/0,
+ atoms/1,
+ tuples/1,
+ lists/1]).
-import(runner, [get_term/1]).
%% This test suite test the erl_format() function.
%% It uses the port program "ei_format_test".
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[format_wo_ver, atoms, tuples, lists].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
%% Tests formatting various atoms.
-atoms(suite) -> [];
atoms(Config) when is_list(Config) ->
- ?line P = runner:start(?atoms),
-
- ?line {term, ''} = get_term(P),
- ?line {term, 'a'} = get_term(P),
- ?line {term, 'A'} = get_term(P),
- ?line {term, 'abc'} = get_term(P),
- ?line {term, 'Abc'} = get_term(P),
- ?line {term, 'ab@c'} = get_term(P),
- ?line {term, 'The rain in Spain stays mainly in the plains'} =
- get_term(P),
-
- ?line {term, a} = get_term(P),
- ?line {term, ab} = get_term(P),
- ?line {term, abc} = get_term(P),
- ?line {term, ab@c} = get_term(P),
- ?line {term, abcdefghijklmnopq} = get_term(P),
-
- ?line {term, ''} = get_term(P),
- ?line {term, 'a'} = get_term(P),
- ?line {term, 'A'} = get_term(P),
- ?line {term, 'abc'} = get_term(P),
- ?line {term, 'Abc'} = get_term(P),
- ?line {term, 'ab@c'} = get_term(P),
- ?line {term, 'The rain in Spain stays mainly in the plains'} =
- get_term(P),
-
- ?line {term, a} = get_term(P),
- ?line {term, ab} = get_term(P),
- ?line {term, abc} = get_term(P),
- ?line {term, ab@c} = get_term(P),
- ?line {term, ' abcdefghijklmnopq '} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?atoms),
+
+ {term, ''} = get_term(P),
+ {term, 'a'} = get_term(P),
+ {term, 'A'} = get_term(P),
+ {term, 'abc'} = get_term(P),
+ {term, 'Abc'} = get_term(P),
+ {term, 'ab@c'} = get_term(P),
+ {term, 'The rain in Spain stays mainly in the plains'} =
+ get_term(P),
+
+ {term, a} = get_term(P),
+ {term, ab} = get_term(P),
+ {term, abc} = get_term(P),
+ {term, ab@c} = get_term(P),
+ {term, abcdefghijklmnopq} = get_term(P),
+
+ {term, ''} = get_term(P),
+ {term, 'a'} = get_term(P),
+ {term, 'A'} = get_term(P),
+ {term, 'abc'} = get_term(P),
+ {term, 'Abc'} = get_term(P),
+ {term, 'ab@c'} = get_term(P),
+ {term, 'The rain in Spain stays mainly in the plains'} =
+ get_term(P),
+
+ {term, a} = get_term(P),
+ {term, ab} = get_term(P),
+ {term, abc} = get_term(P),
+ {term, ab@c} = get_term(P),
+ {term, ' abcdefghijklmnopq '} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Tests formatting various tuples
-tuples(suite) -> [];
tuples(Config) when is_list(Config) ->
- ?line P = runner:start(?tuples),
-
- ?line {term, {}} = get_term(P),
- ?line {term, {a}} = get_term(P),
- ?line {term, {a, b}} = get_term(P),
- ?line {term, {a, b, c}} = get_term(P),
- ?line {term, {1}} = get_term(P),
- ?line {term, {[]}} = get_term(P),
- ?line {term, {[], []}} = get_term(P),
- ?line {term, {[], a, b, c}} = get_term(P),
- ?line {term, {[], a, [], b, c}} = get_term(P),
- ?line {term, {[], a, '', b, c}} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?tuples),
+
+ {term, {}} = get_term(P),
+ {term, {a}} = get_term(P),
+ {term, {a, b}} = get_term(P),
+ {term, {a, b, c}} = get_term(P),
+ {term, {1}} = get_term(P),
+ {term, {[]}} = get_term(P),
+ {term, {[], []}} = get_term(P),
+ {term, {[], a, b, c}} = get_term(P),
+ {term, {[], a, [], b, c}} = get_term(P),
+ {term, {[], a, '', b, c}} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Tests formatting various lists
-lists(suite) -> [];
lists(Config) when is_list(Config) ->
- ?line P = runner:start(?lists),
-
- ?line {term, []} = get_term(P),
- ?line {term, [a]} = get_term(P),
- ?line {term, [a, b]} = get_term(P),
- ?line {term, [a, b, c]} = get_term(P),
- ?line {term, [1]} = get_term(P),
- ?line {term, [[]]} = get_term(P),
- ?line {term, [[], []]} = get_term(P),
- ?line {term, [[], a, b, c]} = get_term(P),
- ?line {term, [[], a, [], b, c]} = get_term(P),
- ?line {term, [[], a, '', b, c]} = get_term(P),
- ?line {term, [[x, 2], [y, 3], [z, 4]]}= get_term(P),
- ?line {term, [{a,b},{c,d}]}= get_term(P),
-%% ?line {term, [{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]} =
-%% get_term(P),
-
- ?line {term, [{pi, F1}, {'cos(70)', F2}]} = get_term(P),
+ P = runner:start(?lists),
+
+ {term, []} = get_term(P),
+ {term, [a]} = get_term(P),
+ {term, [a, b]} = get_term(P),
+ {term, [a, b, c]} = get_term(P),
+ {term, [1]} = get_term(P),
+ {term, [[]]} = get_term(P),
+ {term, [[], []]} = get_term(P),
+ {term, [[], a, b, c]} = get_term(P),
+ {term, [[], a, [], b, c]} = get_term(P),
+ {term, [[], a, '', b, c]} = get_term(P),
+ {term, [[x, 2], [y, 3], [z, 4]]}= get_term(P),
+ {term, [{a,b},{c,d}]} = get_term(P),
+ %% {term, [{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]} = get_term(P),
+
+ {term, [{pi, F1}, {'cos(70)', F2}]} = get_term(P),
%% don't match floats directly
true= abs(3.1415-F1) < 0.01,
true= abs(0.34202-F2) < 0.01,
- ?line {term, [[pi, F3], ['cos(70)', F4]]} = get_term(P),
+ {term, [[pi, F3], ['cos(70)', F4]]} = get_term(P),
true= abs(3.1415-F3) < 0.01,
true= abs(0.34202-F4) < 0.01,
-%% ?line {term, [[pi, 3.1415], [], ["cos(70)", 0.34202]]} = get_term(P),
- ?line {term, [-1]} = get_term(P),
- ?line {term, "hejsan"} = get_term(P),
+ %% {term, [[pi, 3.1415], [], ["cos(70)", 0.34202]]} = get_term(P),
+ {term, [-1]} = get_term(P),
+ {term, "hejsan"} = get_term(P),
- ?line Str1 = lists:duplicate(65535,$A),
- ?line Str2 = lists:duplicate(65536,$A),
- ?line {term,Str1} = get_term(P),
- ?line {term,Str2} = get_term(P),
+ Str1 = lists:duplicate(65535,$A),
+ Str2 = lists:duplicate(65536,$A),
+ {term,Str1} = get_term(P),
+ {term,Str2} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
-format_wo_ver(suite) -> [];
format_wo_ver(Config) when is_list(Config) ->
- ?line P = runner:start(?format_wo_ver),
+ P = runner:start(?format_wo_ver),
- ?line {term, [-1, 2, $c, {a, "b"}, {c, 10}]} = get_term(P),
+ {term, [-1, 2, $c, {a, "b"}, {c, 10}]} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
diff --git a/lib/erl_interface/test/ei_print_SUITE.erl b/lib/erl_interface/test/ei_print_SUITE.erl
index 36ee90c7ee..5b5589713e 100644
--- a/lib/erl_interface/test/ei_print_SUITE.erl
+++ b/lib/erl_interface/test/ei_print_SUITE.erl
@@ -24,141 +24,117 @@
-include_lib("common_test/include/ct.hrl").
-include("ei_print_SUITE_data/ei_print_test_cases.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- atoms/1, tuples/1, lists/1, strings/1]).
+-export([all/0, suite/0,
+ atoms/1, tuples/1, lists/1, strings/1]).
-import(runner, [get_term/1]).
%% This test suite test the ei_print() function.
%% It uses the port program "ei_format_test".
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[atoms, tuples, lists, strings].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
%% Tests formatting various atoms.
-atoms(suite) -> [];
atoms(Config) when is_list(Config) ->
- ?line P = runner:start(?atoms),
-
- ?line {term, "''"} = get_term(P),
- ?line {term, "a"} = get_term(P),
- ?line {term, "'A'"} = get_term(P),
- ?line {term, "abc"} = get_term(P),
- ?line {term, "'Abc'"} = get_term(P),
- ?line {term, "ab@c"} = get_term(P),
- ?line {term, "'The rain in Spain stays mainly in the plains'"} =
- get_term(P),
-
- ?line {term, "a"} = get_term(P),
- ?line {term, "ab"} = get_term(P),
- ?line {term, "abc"} = get_term(P),
- ?line {term, "ab@c"} = get_term(P),
- ?line {term, "abcdefghijklmnopq"} = get_term(P),
-
- ?line {term, "''"} = get_term(P),
- ?line {term, "a"} = get_term(P),
- ?line {term, "'A'"} = get_term(P),
- ?line {term, "abc"} = get_term(P),
- ?line {term, "'Abc'"} = get_term(P),
- ?line {term, "ab@c"} = get_term(P),
- ?line {term, "'The rain in Spain stays mainly in the plains'"} =
- get_term(P),
-
- ?line {term, "a"} = get_term(P),
- ?line {term, "ab"} = get_term(P),
- ?line {term, "abc"} = get_term(P),
- ?line {term, "ab@c"} = get_term(P),
- ?line {term, "' abcdefghijklmnopq '"} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?atoms),
+
+ {term, "''"} = get_term(P),
+ {term, "a"} = get_term(P),
+ {term, "'A'"} = get_term(P),
+ {term, "abc"} = get_term(P),
+ {term, "'Abc'"} = get_term(P),
+ {term, "ab@c"} = get_term(P),
+ {term, "'The rain in Spain stays mainly in the plains'"} = get_term(P),
+
+ {term, "a"} = get_term(P),
+ {term, "ab"} = get_term(P),
+ {term, "abc"} = get_term(P),
+ {term, "ab@c"} = get_term(P),
+ {term, "abcdefghijklmnopq"} = get_term(P),
+
+ {term, "''"} = get_term(P),
+ {term, "a"} = get_term(P),
+ {term, "'A'"} = get_term(P),
+ {term, "abc"} = get_term(P),
+ {term, "'Abc'"} = get_term(P),
+ {term, "ab@c"} = get_term(P),
+ {term, "'The rain in Spain stays mainly in the plains'"} = get_term(P),
+
+ {term, "a"} = get_term(P),
+ {term, "ab"} = get_term(P),
+ {term, "abc"} = get_term(P),
+ {term, "ab@c"} = get_term(P),
+ {term, "' abcdefghijklmnopq '"} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Tests formatting various tuples
-tuples(suite) -> [];
tuples(Config) when is_list(Config) ->
- ?line P = runner:start(?tuples),
-
- ?line {term, "{}"} = get_term(P),
- ?line {term, "{a}"} = get_term(P),
- ?line {term, "{a, b}"} = get_term(P),
- ?line {term, "{a, b, c}"} = get_term(P),
- ?line {term, "{1}"} = get_term(P),
- ?line {term, "{[]}"} = get_term(P),
- ?line {term, "{[], []}"} = get_term(P),
- ?line {term, "{[], a, b, c}"} = get_term(P),
- ?line {term, "{[], a, [], b, c}"} = get_term(P),
- ?line {term, "{[], a, '', b, c}"} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?tuples),
+
+ {term, "{}"} = get_term(P),
+ {term, "{a}"} = get_term(P),
+ {term, "{a, b}"} = get_term(P),
+ {term, "{a, b, c}"} = get_term(P),
+ {term, "{1}"} = get_term(P),
+ {term, "{[]}"} = get_term(P),
+ {term, "{[], []}"} = get_term(P),
+ {term, "{[], a, b, c}"} = get_term(P),
+ {term, "{[], a, [], b, c}"} = get_term(P),
+ {term, "{[], a, '', b, c}"} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Tests formatting various lists
-lists(suite) -> [];
lists(Config) when is_list(Config) ->
- ?line P = runner:start(?lists),
-
- ?line {term, "[]"} = get_term(P),
- ?line {term, "[a]"} = get_term(P),
- ?line {term, "[a, b]"} = get_term(P),
- ?line {term, "[a, b, c]"} = get_term(P),
- ?line {term, "[1]"} = get_term(P),
- ?line {term, "[[]]"} = get_term(P),
- ?line {term, "[[], []]"} = get_term(P),
- ?line {term, "[[], a, b, c]"} = get_term(P),
- ?line {term, "[[], a, [], b, c]"} = get_term(P),
- ?line {term, "[[], a, '', b, c]"} = get_term(P),
- ?line {term, "[[x, 2], [y, 3], [z, 4]]"}= get_term(P),
-
-%% ?line {term, "[{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]"} =
-%% get_term(P),
+ P = runner:start(?lists),
+
+ {term, "[]"} = get_term(P),
+ {term, "[a]"} = get_term(P),
+ {term, "[a, b]"} = get_term(P),
+ {term, "[a, b, c]"} = get_term(P),
+ {term, "[1]"} = get_term(P),
+ {term, "[[]]"} = get_term(P),
+ {term, "[[], []]"} = get_term(P),
+ {term, "[[], a, b, c]"} = get_term(P),
+ {term, "[[], a, [], b, c]"} = get_term(P),
+ {term, "[[], a, '', b, c]"} = get_term(P),
+ {term, "[[x, 2], [y, 3], [z, 4]]"}= get_term(P),
+
+ %% {term, "[{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]"} = get_term(P),
%% maybe regexp instead?
- ?line {term, "[{pi, 3.141500}, {'cos(70)', 0.342020}]"} = get_term(P),
- ?line {term, "[[pi, 3.141500], ['cos(70)', 0.342020]]"} = get_term(P),
+ {term, "[{pi, 3.141500}, {'cos(70)', 0.342020}]"} = get_term(P),
+ {term, "[[pi, 3.141500], ['cos(70)', 0.342020]]"} = get_term(P),
- ?line {term, "[-1]"} = get_term(P),
+ {term, "[-1]"} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
-strings(suite) -> [];
strings(Config) when is_list(Config) ->
- ?line P = runner:start(?strings),
-
- ?line {term, "\"\\n\""} = get_term(P),
- ?line {term, "\"\\r\\n\""} = get_term(P),
- ?line {term, "\"a\""} = get_term(P),
- ?line {term, "\"A\""} = get_term(P),
- ?line {term, "\"0\""} = get_term(P),
- ?line {term, "\"9\""} = get_term(P),
- ?line {term, "\"The rain in Spain stays mainly in the plains\""} = get_term(P),
- ?line {term, "\" abcdefghijklmnopq \""} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?strings),
+
+ {term, "\"\\n\""} = get_term(P),
+ {term, "\"\\r\\n\""} = get_term(P),
+ {term, "\"a\""} = get_term(P),
+ {term, "\"A\""} = get_term(P),
+ {term, "\"0\""} = get_term(P),
+ {term, "\"9\""} = get_term(P),
+ {term, "\"The rain in Spain stays mainly in the plains\""} = get_term(P),
+ {term, "\" abcdefghijklmnopq \""} = get_term(P),
+
+ runner:recv_eot(P),
ok.
-
diff --git a/lib/erl_interface/test/ei_tmo_SUITE.erl b/lib/erl_interface/test/ei_tmo_SUITE.erl
index f506b3dbb0..4cd4202116 100644
--- a/lib/erl_interface/test/ei_tmo_SUITE.erl
+++ b/lib/erl_interface/test/ei_tmo_SUITE.erl
@@ -27,176 +27,148 @@
-define(dummy_host,test01).
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- init_per_testcase/2, end_per_testcase/2,
- framework_check/1, ei_accept_tmo/1, ei_connect_tmo/1, ei_send_tmo/1,
- ei_recv_tmo/1]).
+-export([all/0, suite/0,
+ init_per_testcase/2, end_per_testcase/2,
+ framework_check/1, ei_accept_tmo/1, ei_connect_tmo/1, ei_send_tmo/1,
+ ei_recv_tmo/1]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {minutes, 1}}].
all() ->
[framework_check, ei_accept_tmo, ei_connect_tmo,
ei_send_tmo, ei_recv_tmo].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?t:minutes(1)),
% test if platform is vxworks_simso
- ?line {_,Host} = split(node()),
+ {_,Host} = split(node()),
Bool = case atom_to_list(Host) of
- [$v,$x,$s,$i,$m | _] -> true;
- _ -> false
- end,
- [{vxsim,Bool},{watchdog, Dog}|Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- test_server:timetrap_cancel(Dog),
+ [$v,$x,$s,$i,$m | _] -> true;
+ _ -> false
+ end,
+ [{vxsim,Bool}|Config].
+
+end_per_testcase(_Case, _Config) ->
ok.
-framework_check(doc) ->
- ["Check the framework."];
-framework_check(suite) ->
- [];
+%% Check the framework.
framework_check(Config) when is_list(Config) ->
%%dbg:tracer(),
%%dbg:p(self()),
- ?line P = runner:start(?framework_check),
- ?line runner:send_term(P,{hello,world}),
- ?line {term, {hello,world}} = runner:get_term(P),
- ?line runner:recv_eot(P),
+ P = runner:start(?framework_check),
+ runner:send_term(P,{hello,world}),
+ {term, {hello,world}} = runner:get_term(P),
+ runner:recv_eot(P),
ok.
-ei_recv_tmo(doc) ->
- ["Check recv with timeouts."];
-ei_recv_tmo(suite) ->
- [];
+%% Check recv with timeouts.
ei_recv_tmo(Config) when is_list(Config) ->
- ?line do_one_recv(Config,c_node_recv_tmo_1),
- ?line do_one_recv_failure(Config,c_node_recv_tmo_2),
+ do_one_recv(Config,c_node_recv_tmo_1),
+ do_one_recv_failure(Config,c_node_recv_tmo_2),
ok.
do_one_recv(Config,CNode) ->
- ?line {_,Host} = split(node()),
- ?line P1 = runner:start(?recv_tmo),
- ?line runner:send_term(P1,{CNode,
- erlang:get_cookie(),
- node()}),
- ?line {term, X} = runner:get_term(P1, 10000),
- ?line true = is_integer(X),
- ?line CNode1 = join(CNode,Host),
- ?line Term1 = {hej,[hopp,{i,[lingon,"skogen"]}]},
- ?line {test,CNode1} ! Term1,
- ?line {term, Term1} = runner:get_term(P1, 10000),
- ?line runner:recv_eot(P1).
-
+ {_,Host} = split(node()),
+ P1 = runner:start(?recv_tmo),
+ runner:send_term(P1,{CNode,
+ erlang:get_cookie(),
+ node()}),
+ {term, X} = runner:get_term(P1, 10000),
+ true = is_integer(X),
+ CNode1 = join(CNode,Host),
+ Term1 = {hej,[hopp,{i,[lingon,"skogen"]}]},
+ {test,CNode1} ! Term1,
+ {term, Term1} = runner:get_term(P1, 10000),
+ runner:recv_eot(P1).
+
do_one_recv_failure(Config,CNode) ->
- ?line P1 = runner:start(?recv_tmo),
- ?line runner:send_term(P1,{CNode,
- erlang:get_cookie(),
- node()}),
- ?line {term, X} = runner:get_term(P1, 10000),
- ?line true = is_integer(X),
- ?line {term, {Ret,ETimedout,ETimedout}} = runner:get_term(P1, 10000),
- ?line true = (Ret < 0),
- ?line runner:recv_eot(P1).
-
-
-ei_send_tmo(doc) ->
- ["Check send with timeouts."];
-ei_send_tmo(suite) ->
- [];
+ P1 = runner:start(?recv_tmo),
+ runner:send_term(P1,{CNode,
+ erlang:get_cookie(),
+ node()}),
+ {term, X} = runner:get_term(P1, 10000),
+ true = is_integer(X),
+ {term, {Ret,ETimedout,ETimedout}} = runner:get_term(P1, 10000),
+ true = (Ret < 0),
+ runner:recv_eot(P1).
+
+
+%% Check send with timeouts.
ei_send_tmo(Config) when is_list(Config) ->
%dbg:tracer(),
%dbg:p(self()),
- VxSim = ?config(vxsim, Config),
- ?line register(ei_send_tmo_1,self()),
- ?line do_one_send(Config,self(),c_node_send_tmo_1),
- ?line do_one_send(Config,ei_send_tmo_1,c_node_send_tmo_2),
- ?line do_one_send_failure(Config,self(),cccc1,c_nod_send_tmo_3,VxSim),
- ?line do_one_send_failure(Config,ei_send_tmo_1,cccc2,c_nod_send_tmo_4,VxSim),
+ VxSim = proplists:get_value(vxsim, Config),
+ register(ei_send_tmo_1,self()),
+ do_one_send(Config,self(),c_node_send_tmo_1),
+ do_one_send(Config,ei_send_tmo_1,c_node_send_tmo_2),
+ do_one_send_failure(Config,self(),cccc1,c_nod_send_tmo_3,VxSim),
+ do_one_send_failure(Config,ei_send_tmo_1,cccc2,c_nod_send_tmo_4,VxSim),
ok.
-
+
do_one_send(Config,From,CNode) ->
- ?line {_,Host} = split(node()),
- ?line P1 = runner:start(?send_tmo),
- ?line runner:send_term(P1,{CNode,
- erlang:get_cookie(),
- node()}),
- ?line {term, X} = runner:get_term(P1, 10000),
- ?line true = is_integer(X),
- ?line CNode1 = join(CNode,Host),
- ?line Term1 = {hej,[hopp,{i,[lingon,"skogen"]}]},
- ?line {test,CNode1} ! {From,1,Term1},
- ?line ok = receive
- Term1 ->
- ok
- after 2000 ->
- error
- end,
- ?line {term, 0} = runner:get_term(P1, 10000),
- ?line runner:recv_eot(P1).
+ {_,Host} = split(node()),
+ P1 = runner:start(?send_tmo),
+ runner:send_term(P1,{CNode,
+ erlang:get_cookie(),
+ node()}),
+ {term, X} = runner:get_term(P1, 10000),
+ true = is_integer(X),
+ CNode1 = join(CNode,Host),
+ Term1 = {hej,[hopp,{i,[lingon,"skogen"]}]},
+ {test,CNode1} ! {From,1,Term1},
+ ok = receive
+ Term1 ->
+ ok
+ after 2000 ->
+ error
+ end,
+ {term, 0} = runner:get_term(P1, 10000),
+ runner:recv_eot(P1).
do_one_send_failure(Config,From,FakeName,CName,VxSim) ->
- ?line {_,Host} = split(node()),
- ?line OurName = join(FakeName,Host),
- ?line Node = join(CName,Host),
- ?line LSocket = case gen_tcp:listen(0, [{active, false}, {packet,2}]) of
- {ok, Socket} ->
- ?line Socket;
- Else ->
- ?line exit(Else)
- end,
- ?line EpmdSocket = register(OurName, LSocket, 1, 5),
- ?line P3 = runner:start(?send_tmo),
- ?line Cookie = kaksmula_som_ingen_bryr_sig_om,
- ?line runner:send_term(P3,{CName,
- Cookie,
- OurName}),
- ?line SocketB = case gen_tcp:accept(LSocket) of
- {ok, Socket1} ->
- ?line Socket1;
- Else2 ->
- ?line exit(Else2)
- end,
- ?line {hidden,Node,5} = recv_name(SocketB), % See 1)
- ?line send_status(SocketB, ok),
- ?line MyChallengeB = gen_challenge(),
- ?line send_challenge(SocketB, OurName, MyChallengeB, 5),
- ?line HisChallengeB = recv_challenge_reply(
- SocketB,
- MyChallengeB,
- Cookie),
- ?line DigestB = gen_digest(HisChallengeB,Cookie),
- ?line send_challenge_ack(SocketB, DigestB),
- ?line inet:setopts(SocketB, [{active, false},
- {packet, 4}]),
- ?line {term, X} = runner:get_term(P3, 10000),
- ?line true = is_integer(X),
- ?line Message = [112,term_to_binary({6,self(),'',test}),
- term_to_binary({From,10000,
- {app,["lapp",{sa,["att",du,{slapp,
- sitta}]}]}})],
- ?line gen_tcp:send(SocketB,Message),
+ {_,Host} = split(node()),
+ OurName = join(FakeName,Host),
+ Node = join(CName,Host),
+ LSocket = case gen_tcp:listen(0, [{active, false}, {packet,2}]) of
+ {ok, Socket} ->
+ Socket;
+ Else ->
+ exit(Else)
+ end,
+ EpmdSocket = register(OurName, LSocket, 1, 5),
+ P3 = runner:start(?send_tmo),
+ Cookie = kaksmula_som_ingen_bryr_sig_om,
+ runner:send_term(P3,{CName,
+ Cookie,
+ OurName}),
+ SocketB = case gen_tcp:accept(LSocket) of
+ {ok, Socket1} ->
+ Socket1;
+ Else2 ->
+ exit(Else2)
+ end,
+ {hidden,Node,5} = recv_name(SocketB), % See 1)
+ send_status(SocketB, ok),
+ MyChallengeB = gen_challenge(),
+ send_challenge(SocketB, OurName, MyChallengeB, 5),
+ HisChallengeB = recv_challenge_reply(SocketB,
+ MyChallengeB,
+ Cookie),
+ DigestB = gen_digest(HisChallengeB,Cookie),
+ send_challenge_ack(SocketB, DigestB),
+ inet:setopts(SocketB, [{active, false},
+ {packet, 4}]),
+ {term, X} = runner:get_term(P3, 10000),
+ true = is_integer(X),
+ Message = [112,term_to_binary({6,self(),'',test}),
+ term_to_binary({From,10000,
+ {app,["lapp",{sa,["att",du,{slapp,
+ sitta}]}]}})],
+ gen_tcp:send(SocketB,Message),
%% At this point the test program starts sending messages (max 10000). Since
%% we're not receiving, eventually the send buffer fills up. Then no more
@@ -204,152 +176,145 @@ do_one_send_failure(Config,From,FakeName,CName,VxSim) ->
%% before this happens is returned in Iters. The timeout value for get_term/2
%% must be large enough so there's time for the select() to time out and
%% the test program to return the error tuple (below).
- Res0 =
- if VxSim == false ->
- ?line {term,{Res,ETO,Iters,ETO}} = runner:get_term(P3, 20000),
- Res;
- true -> % relax the test for vxsim
- ?line case runner:get_term(P3, 20000) of
- {term,{Res,ETO,Iters,ETO}} ->
- Res;
- {term,{Res,_,Iters,ETO}} -> % EIO?
- Res
- end
- end,
- ?line runner:recv_eot(P3),
- ?line true = ((Res0 < 0) and (Iters > 0)),
- ?line gen_tcp:close(SocketB),
- ?line gen_tcp:close(EpmdSocket),
+
+ Res0 = if VxSim == false ->
+ {term,{Res,ETO,Iters,ETO}} = runner:get_term(P3, 20000),
+ Res;
+ true -> % relax the test for vxsim
+ case runner:get_term(P3, 20000) of
+ {term,{Res,ETO,Iters,ETO}} ->
+ Res;
+ {term,{Res,_,Iters,_ETO}} -> % EIO?
+ Res
+ end
+ end,
+ runner:recv_eot(P3),
+ true = ((Res0 < 0) and (Iters > 0)),
+ gen_tcp:close(SocketB),
+ gen_tcp:close(EpmdSocket),
ok.
-
-ei_connect_tmo(doc) ->
- ["Check accept with timeouts."];
-ei_connect_tmo(suite) ->
- [];
+
+%% Check accept with timeouts.
ei_connect_tmo(Config) when is_list(Config) ->
%dbg:tracer(),
%dbg:p(self()),
- VxSim = ?config(vxsim, Config),
+ VxSim = proplists:get_value(vxsim, Config),
DummyNode = make_and_check_dummy(),
- ?line P = runner:start(?connect_tmo),
- ?line runner:send_term(P,{c_nod_connect_tmo_1,
- kaksmula_som_ingen_bryr_sig_om,
- DummyNode}),
+ P = runner:start(?connect_tmo),
+ runner:send_term(P,{c_nod_connect_tmo_1,
+ kaksmula_som_ingen_bryr_sig_om,
+ DummyNode}),
ETimedout =
- if VxSim == false ->
- ?line {term,{-3,ETO,ETO}} = runner:get_term(P, 10000),
- ?line ETO;
- true -> % relax the test for vxsim
- ?line case runner:get_term(P, 10000) of
- {term,{-3,ETO,ETO}} ->
- ?line ETO;
- {term,{-1,_,ETO}} -> % EHOSTUNREACH = ok
- ?line ETO
- end
- end,
- ?line runner:recv_eot(P),
- ?line P2 = runner:start(?connect_tmo),
- ?line runner:send_term(P2,{c_nod_connect_tmo_2,
- erlang:get_cookie(),
- node()}),
- ?line {term, X} = runner:get_term(P2, 10000),
- ?line runner:recv_eot(P2),
- ?line true = is_integer(X),
+ if VxSim == false ->
+ {term,{-3,ETO,ETO}} = runner:get_term(P, 10000),
+ ETO;
+ true -> % relax the test for vxsim
+ case runner:get_term(P, 10000) of
+ {term,{-3,ETO,ETO}} ->
+ ETO;
+ {term,{-1,_,ETO}} -> % EHOSTUNREACH = ok
+ ETO
+ end
+ end,
+ runner:recv_eot(P),
+ P2 = runner:start(?connect_tmo),
+ runner:send_term(P2,{c_nod_connect_tmo_2,
+ erlang:get_cookie(),
+ node()}),
+ {term, X} = runner:get_term(P2, 10000),
+ runner:recv_eot(P2),
+ true = is_integer(X),
%% Aborted handshake test...
- ?line {_,Host} = split(node()),
- ?line OurName = join(cccc,Host),
- ?line Node = join(c_nod_connect_tmo_3,Host),
- ?line LSocket = case gen_tcp:listen(0, [{active, false}, {packet,2}]) of
- {ok, Socket} ->
- ?line Socket;
- Else ->
- ?line exit(Else)
- end,
- ?line EpmdSocket = register(OurName, LSocket, 1, 5),
- ?line P3 = runner:start(?connect_tmo),
- ?line Cookie = kaksmula_som_ingen_bryr_sig_om,
- ?line runner:send_term(P3,{c_nod_connect_tmo_3,
- Cookie,
- OurName}),
- ?line SocketB = case gen_tcp:accept(LSocket) of
- {ok, Socket1} ->
- ?line Socket1;
- Else2 ->
- ?line exit(Else2)
- end,
- ?line {hidden,Node,5} = recv_name(SocketB), % See 1)
- ?line send_status(SocketB, ok),
- ?line MyChallengeB = gen_challenge(),
- ?line send_challenge(SocketB, OurName, MyChallengeB, 5),
- ?line HisChallengeB = recv_challenge_reply(
- SocketB,
- MyChallengeB,
- Cookie),
- ?line {term,{-1,ETimedout,ETimedout}} = runner:get_term(P3, 10000),
- ?line runner:recv_eot(P3),
- ?line gen_tcp:close(SocketB),
- ?line gen_tcp:close(EpmdSocket),
+ {_,Host} = split(node()),
+ OurName = join(cccc,Host),
+ Node = join(c_nod_connect_tmo_3,Host),
+ LSocket = case gen_tcp:listen(0, [{active, false}, {packet,2}]) of
+ {ok, Socket} ->
+ Socket;
+ Else ->
+ exit(Else)
+ end,
+ EpmdSocket = register(OurName, LSocket, 1, 5),
+ P3 = runner:start(?connect_tmo),
+ Cookie = kaksmula_som_ingen_bryr_sig_om,
+ runner:send_term(P3,{c_nod_connect_tmo_3,
+ Cookie,
+ OurName}),
+ SocketB = case gen_tcp:accept(LSocket) of
+ {ok, Socket1} ->
+ Socket1;
+ Else2 ->
+ exit(Else2)
+ end,
+ {hidden,Node,5} = recv_name(SocketB), % See 1)
+ send_status(SocketB, ok),
+ MyChallengeB = gen_challenge(),
+ send_challenge(SocketB, OurName, MyChallengeB, 5),
+ _HisChallengeB = recv_challenge_reply(SocketB,
+ MyChallengeB,
+ Cookie),
+ {term,{-1,ETimedout,ETimedout}} = runner:get_term(P3, 10000),
+ runner:recv_eot(P3),
+ gen_tcp:close(SocketB),
+ gen_tcp:close(EpmdSocket),
ok.
-
-ei_accept_tmo(doc) ->
- ["Check accept with timeouts."];
-ei_accept_tmo(suite) ->
- [];
+
+%% Check accept with timeouts.
ei_accept_tmo(Config) when is_list(Config) ->
%%dbg:tracer(),
%%dbg:p(self()),
- ?line P = runner:start(?accept_tmo),
- ?line runner:send_term(P,{c_nod_som_ingen_kontaktar_1,
- kaksmula_som_ingen_bryr_sig_om}),
- ?line {term,{-1,ETimedout,ETimedout}} = runner:get_term(P, 10000),
- ?line runner:recv_eot(P),
- ?line P2 = runner:start(?accept_tmo),
- ?line runner:send_term(P2,{c_nod_som_vi_kontaktar_1,
- erlang:get_cookie()}),
- ?line receive after 1000 -> ok end,
- ?line CNode1 = make_node(c_nod_som_vi_kontaktar_1),
- ?line {ignored,CNode1} ! tjenare,
- ?line {term, X} = runner:get_term(P2, 10000),
- ?line runner:recv_eot(P2),
- ?line true = is_integer(X),
- ?line P3 = runner:start(?accept_tmo),
- ?line runner:send_term(P3,{c_nod_som_vi_kontaktar_2,
- erlang:get_cookie()}),
- ?line receive after 1000 -> ok end,
- ?line CNode2 = make_node(c_nod_som_vi_kontaktar_2),
- ?line {NA,NB} = split(CNode2),
- ?line {_,Host} = split(node()),
- ?line OurName = join(ccc,Host),
- ?line {port,PortNo,_} = erl_epmd:port_please(NA,NB),
- ?line {ok, SocketA} = gen_tcp:connect(atom_to_list(NB),PortNo,
- [{active,false},
- {packet,2}]),
- ?line send_name(SocketA,OurName,5),
- ?line ok = recv_status(SocketA),
- ?line {hidden,Node,5,HisChallengeA} = recv_challenge(SocketA), % See 1)
- ?line OurChallengeA = gen_challenge(),
- ?line OurDigestA = gen_digest(HisChallengeA, erlang:get_cookie()),
+ P = runner:start(?accept_tmo),
+ runner:send_term(P,{c_nod_som_ingen_kontaktar_1,
+ kaksmula_som_ingen_bryr_sig_om}),
+ {term,{-1,ETimedout,ETimedout}} = runner:get_term(P, 10000),
+ runner:recv_eot(P),
+ P2 = runner:start(?accept_tmo),
+ runner:send_term(P2,{c_nod_som_vi_kontaktar_1,
+ erlang:get_cookie()}),
+ receive after 1000 -> ok end,
+ CNode1 = make_node(c_nod_som_vi_kontaktar_1),
+ {ignored,CNode1} ! tjenare,
+ {term, X} = runner:get_term(P2, 10000),
+ runner:recv_eot(P2),
+ true = is_integer(X),
+ P3 = runner:start(?accept_tmo),
+ runner:send_term(P3,{c_nod_som_vi_kontaktar_2,
+ erlang:get_cookie()}),
+ receive after 1000 -> ok end,
+ CNode2 = make_node(c_nod_som_vi_kontaktar_2),
+ {NA,NB} = split(CNode2),
+ {_,Host} = split(node()),
+ OurName = join(ccc,Host),
+ {port,PortNo,_} = erl_epmd:port_please(NA,NB),
+ {ok, SocketA} = gen_tcp:connect(atom_to_list(NB),PortNo,
+ [{active,false},
+ {packet,2}]),
+ send_name(SocketA,OurName,5),
+ ok = recv_status(SocketA),
+ {hidden,_Node,5,HisChallengeA} = recv_challenge(SocketA), % See 1)
+ _OurChallengeA = gen_challenge(),
+ _OurDigestA = gen_digest(HisChallengeA, erlang:get_cookie()),
%% Dont do the last two steps of the connection setup...
%% send_challenge_reply(SocketA, OurChallengeA, OurDigestA),
%% ok = recv_challenge_ack(SocketA, OurChallengeA, erlang:get_cookie()),
- ?line {term, {-1,ETimedout,ETimedout}} = runner:get_term(P3, 10000),
- ?line runner:recv_eot(P3),
- ?line gen_tcp:close(SocketA),
+ {term, {-1,ETimedout,ETimedout}} = runner:get_term(P3, 10000),
+ runner:recv_eot(P3),
+ gen_tcp:close(SocketA),
ok.
make_node(X) ->
list_to_atom(atom_to_list(X) ++ "@" ++
- hd(tl(string:tokens(atom_to_list(node()),"@")))).
+ hd(tl(string:tokens(atom_to_list(node()),"@")))).
make_and_check_dummy() ->
% First check that the host has an ip and is *not* reachable
- ?line case gen_tcp:connect(?dummy_host,23,[{active,false}],5000) of
- {error,timeout} -> ok;
- {error,ehostunreach} -> ok
- end,
+ case gen_tcp:connect(?dummy_host,23,[{active,false}],5000) of
+ {error,timeout} -> ok;
+ {error,ehostunreach} -> ok
+ end,
list_to_atom("dummy@"++atom_to_list(?dummy_host)).
@@ -359,12 +324,12 @@ make_and_check_dummy() ->
%%
-define(to_port(Socket, Data),
- case inet_tcp:send(Socket, Data) of
- {error, closed} ->
- self() ! {tcp_closed, Socket},
- {error, closed};
- R ->
- R
+ case inet_tcp:send(Socket, Data) of
+ {error, closed} ->
+ self() ! {tcp_closed, Socket},
+ {error, closed};
+ R ->
+ R
end).
-define(DFLAG_PUBLISHED,1).
@@ -382,8 +347,8 @@ make_and_check_dummy() ->
-define(int16(X), [((X) bsr 8) band 16#ff, (X) band 16#ff]).
-define(int32(X),
- [((X) bsr 24) band 16#ff, ((X) bsr 16) band 16#ff,
- ((X) bsr 8) band 16#ff, (X) band 16#ff]).
+ [((X) bsr 24) band 16#ff, ((X) bsr 16) band 16#ff,
+ ((X) bsr 8) band 16#ff, (X) band 16#ff]).
-define(i16(X1,X0),
(?u16(X1,X0) -
@@ -406,9 +371,9 @@ make_and_check_dummy() ->
%% This is no proper random number, but that is not really important in
%% this test
gen_challenge() ->
- {_,_,N} = erlang:now(),
+ {_,_,N} = os:timestamp(),
N.
-
+
%% Generate a message digest from Challenge number and Cookie
gen_digest(Challenge, Cookie) when is_integer(Challenge), is_atom(Cookie) ->
C0 = erlang:md5_init(),
@@ -423,95 +388,93 @@ gen_digest(Challenge, Cookie) when is_integer(Challenge), is_atom(Cookie) ->
send_status(Socket, Stat) ->
case gen_tcp:send(Socket, [$s | atom_to_list(Stat)]) of
- {error, _} ->
- ?shutdown(could_not_send_status);
- _ ->
- true
+ {error, _} -> ?shutdown(could_not_send_status);
+ _ -> true
end.
recv_status(Socket) ->
case gen_tcp:recv(Socket, 0) of
- {ok, [$s|StrStat]} ->
- list_to_atom(StrStat);
- Bad ->
- exit(Bad)
+ {ok, [$s|StrStat]} ->
+ list_to_atom(StrStat);
+ Bad ->
+ exit(Bad)
end.
send_challenge(Socket, Node, Challenge, Version) ->
send_challenge(Socket, Node, Challenge, Version, ?COMPULSORY_DFLAGS).
send_challenge(Socket, Node, Challenge, Version, Flags) ->
- {ok, {{Ip1,Ip2,Ip3,Ip4}, _}} = inet:sockname(Socket),
+ {ok, {{_Ip1,_Ip2,_Ip3,_Ip4}, _}} = inet:sockname(Socket),
?to_port(Socket, [$n,?int16(Version),?int32(Flags),
- ?int32(Challenge), atom_to_list(Node)]).
+ ?int32(Challenge), atom_to_list(Node)]).
recv_challenge(Socket) ->
case gen_tcp:recv(Socket, 0) of
- {ok,[$n,V1,V0,Fl1,Fl2,Fl3,Fl4,CA3,CA2,CA1,CA0 | Ns]} ->
- Flags = ?u32(Fl1,Fl2,Fl3,Fl4),
- Type = case Flags band ?DFLAG_PUBLISHED of
- 0 ->
- hidden;
- _ ->
- normal
- end,
- Node =list_to_atom(Ns),
- Version = ?u16(V1,V0),
- Challenge = ?u32(CA3,CA2,CA1,CA0),
- {Type,Node,Version,Challenge};
- _ ->
- ?shutdown(no_node)
+ {ok,[$n,V1,V0,Fl1,Fl2,Fl3,Fl4,CA3,CA2,CA1,CA0 | Ns]} ->
+ Flags = ?u32(Fl1,Fl2,Fl3,Fl4),
+ Type = case Flags band ?DFLAG_PUBLISHED of
+ 0 ->
+ hidden;
+ _ ->
+ normal
+ end,
+ Node =list_to_atom(Ns),
+ Version = ?u16(V1,V0),
+ Challenge = ?u32(CA3,CA2,CA1,CA0),
+ {Type,Node,Version,Challenge};
+ _ ->
+ ?shutdown(no_node)
end.
-send_challenge_reply(Socket, Challenge, Digest) ->
- ?to_port(Socket, [$r,?int32(Challenge),Digest]).
+%send_challenge_reply(Socket, Challenge, Digest) ->
+% ?to_port(Socket, [$r,?int32(Challenge),Digest]).
recv_challenge_reply(Socket, ChallengeA, Cookie) ->
case gen_tcp:recv(Socket, 0) of
- {ok,[$r,CB3,CB2,CB1,CB0 | SumB]} when length(SumB) == 16 ->
- SumA = gen_digest(ChallengeA, Cookie),
- ChallengeB = ?u32(CB3,CB2,CB1,CB0),
- if SumB == SumA ->
- ChallengeB;
- true ->
- ?shutdown(bad_challenge_reply)
- end;
- _ ->
- ?shutdown(no_node)
+ {ok,[$r,CB3,CB2,CB1,CB0 | SumB]} when length(SumB) == 16 ->
+ SumA = gen_digest(ChallengeA, Cookie),
+ ChallengeB = ?u32(CB3,CB2,CB1,CB0),
+ if SumB == SumA ->
+ ChallengeB;
+ true ->
+ ?shutdown(bad_challenge_reply)
+ end;
+ _ ->
+ ?shutdown(no_node)
end.
send_challenge_ack(Socket, Digest) ->
?to_port(Socket, [$a,Digest]).
-recv_challenge_ack(Socket, ChallengeB, CookieA) ->
- case gen_tcp:recv(Socket, 0) of
- {ok,[$a | SumB]} when length(SumB) == 16 ->
- SumA = gen_digest(ChallengeB, CookieA),
- if SumB == SumA ->
- ok;
- true ->
- ?shutdown(bad_challenge_ack)
- end;
- _ ->
- ?shutdown(bad_challenge_ack)
- end.
+%recv_challenge_ack(Socket, ChallengeB, CookieA) ->
+% case gen_tcp:recv(Socket, 0) of
+% {ok,[$a | SumB]} when length(SumB) == 16 ->
+% SumA = gen_digest(ChallengeB, CookieA),
+% if SumB == SumA ->
+% ok;
+% true ->
+% ?shutdown(bad_challenge_ack)
+% end;
+% _ ->
+% ?shutdown(bad_challenge_ack)
+% end.
send_name(Socket, MyNode0, Version) ->
send_name(Socket, MyNode0, Version, ?COMPULSORY_DFLAGS).
send_name(Socket, MyNode0, Version, Flags) ->
MyNode = atom_to_list(MyNode0),
?to_port(Socket, [$n,?int16(Version),?int32(Flags)] ++
- MyNode).
+ MyNode).
%%
%% recv_name is common for both old and new handshake.
%%
recv_name(Socket) ->
case gen_tcp:recv(Socket, 0) of
- {ok,Data} ->
- get_name(Data);
- Res ->
- ?shutdown({no_node,Res})
+ {ok,Data} ->
+ get_name(Data);
+ Res ->
+ ?shutdown({no_node,Res})
end.
get_name([$m,VersionA,VersionB,_Ip1,_Ip2,_Ip3,_Ip4|OtherNode]) ->
@@ -520,11 +483,9 @@ get_name([$h,VersionA,VersionB,_Ip1,_Ip2,_Ip3,_Ip4|OtherNode]) ->
{hidden, list_to_atom(OtherNode), ?u16(VersionA,VersionB)};
get_name([$n,VersionA, VersionB, Flag1, Flag2, Flag3, Flag4 | OtherNode]) ->
Type = case ?u32(Flag1, Flag2, Flag3, Flag4) band ?DFLAG_PUBLISHED of
- 0 ->
- hidden;
- _ ->
- normal
- end,
+ 0 -> hidden;
+ _ -> normal
+ end,
{Type, list_to_atom(OtherNode),
?u16(VersionA,VersionB)};
get_name(Data) ->
@@ -533,74 +494,73 @@ get_name(Data) ->
%%
%% tell_name is for old handshake
%%
-tell_name(Socket, MyNode0, Version) ->
- MyNode = atom_to_list(MyNode0),
- {ok, {{Ip1,Ip2,Ip3,Ip4}, _}} = inet:sockname(Socket),
- ?to_port(Socket, [$h,?int16(Version),Ip1,Ip2,Ip3,Ip4] ++
- MyNode).
+%tell_name(Socket, MyNode0, Version) ->
+% MyNode = atom_to_list(MyNode0),
+% {ok, {{Ip1,Ip2,Ip3,Ip4}, _}} = inet:sockname(Socket),
+% ?to_port(Socket, [$h,?int16(Version),Ip1,Ip2,Ip3,Ip4] ++ MyNode).
%%
%% The communication with EPMD follows
%%
do_register_node(NodeName, TcpPort, VLow, VHigh) ->
case gen_tcp:connect({127,0,0,1}, get_epmd_port(), []) of
- {ok, Socket} ->
- {N0,_} = split(NodeName),
- Name = atom_to_list(N0),
- Extra = "",
- Elen = length(Extra),
- Len = 1+2+1+1+2+2+2+length(Name)+2+Elen,
- gen_tcp:send(Socket, [?int16(Len), $x,
- ?int16(TcpPort),
- $M,
- 0,
- ?int16(VHigh),
- ?int16(VLow),
- ?int16(length(Name)),
- Name,
- ?int16(Elen),
- Extra]),
- case wait_for_reg_reply(Socket, []) of
- {error, epmd_close} ->
- exit(epmd_broken);
- Other ->
- Other
- end;
- Error ->
- Error
+ {ok, Socket} ->
+ {N0,_} = split(NodeName),
+ Name = atom_to_list(N0),
+ Extra = "",
+ Elen = length(Extra),
+ Len = 1+2+1+1+2+2+2+length(Name)+2+Elen,
+ gen_tcp:send(Socket, [?int16(Len), $x,
+ ?int16(TcpPort),
+ $M,
+ 0,
+ ?int16(VHigh),
+ ?int16(VLow),
+ ?int16(length(Name)),
+ Name,
+ ?int16(Elen),
+ Extra]),
+ case wait_for_reg_reply(Socket, []) of
+ {error, epmd_close} ->
+ exit(epmd_broken);
+ Other ->
+ Other
+ end;
+ Error ->
+ Error
end.
wait_for_reg_reply(Socket, SoFar) ->
receive
- {tcp, Socket, Data0} ->
- case SoFar ++ Data0 of
- [$y, Result, A, B] ->
- case Result of
- 0 ->
- {alive, Socket, ?u16(A, B)};
- _ ->
- {error, duplicate_name}
- end;
- Data when length(Data) < 4 ->
- wait_for_reg_reply(Socket, Data);
- Garbage ->
- {error, {garbage_from_epmd, Garbage}}
- end;
- {tcp_closed, Socket} ->
- {error, epmd_close}
+ {tcp, Socket, Data0} ->
+ case SoFar ++ Data0 of
+ [$y, Result, A, B] ->
+ case Result of
+ 0 ->
+ {alive, Socket, ?u16(A, B)};
+ _ ->
+ {error, duplicate_name}
+ end;
+ Data when length(Data) < 4 ->
+ wait_for_reg_reply(Socket, Data);
+ Garbage ->
+ {error, {garbage_from_epmd, Garbage}}
+ end;
+ {tcp_closed, Socket} ->
+ {error, epmd_close}
after 10000 ->
- gen_tcp:close(Socket),
- {error, no_reg_reply_from_epmd}
+ gen_tcp:close(Socket),
+ {error, no_reg_reply_from_epmd}
end.
register(NodeName, ListenSocket, VLow, VHigh) ->
{ok,{_,TcpPort}} = inet:sockname(ListenSocket),
case do_register_node(NodeName, TcpPort, VLow, VHigh) of
- {alive, Socket, Creation} ->
- Socket;
- Other ->
- exit(Other)
+ {alive, Socket, _Creation} ->
+ Socket;
+ Other ->
+ exit(Other)
end.
@@ -618,69 +578,10 @@ split(Atom) ->
{A,B} = split(atom_to_list(Atom),[]),
{list_to_atom(A),list_to_atom(B)}.
-%% Build a simple distribution message
-build_message(Cookie) ->
- [$?,term_to_binary({6,self(),Cookie,rex}),term_to_binary(plupp)].
-
-%% Build a distribution message that will make rex answer
-build_rex_message(Cookie,OurName) ->
- [$?,term_to_binary({6,self(),Cookie,rex}),
- term_to_binary({'$gen_cast',
- {cast,
- rpc,
- cast,
- [OurName, hello, world, []],
- self()} })].
-
-%% Receive a distribution message
-recv_message(Socket) ->
- case gen_tcp:recv(Socket, 0) of
- {ok,Data} ->
- B0 = list_to_binary(Data),
- {_,B1} = erlang:split_binary(B0,1),
- Header = erlang:binary_to_term(B1),
- Siz = size(term_to_binary(Header)),
- {_,B2} = erlang:split_binary(B1,Siz),
- Message = case (catch erlang:binary_to_term(B2)) of
- {'EXIT', _} ->
- could_not_digest_message;
- Other ->
- Other
- end,
- {Header, Message};
- Res ->
- exit({no_message,Res})
- end.
-
%% Build a nodename
join(Name,Host) ->
list_to_atom(atom_to_list(Name) ++ "@" ++ atom_to_list(Host)).
-%% start/stop slave.
-start_node(Name, Param) ->
- ?t:start_node(Name, slave, [{args, Param}]).
-
-stop_node(Node) ->
- ?t:stop_node(Node).
-
-
-get_nodenames(N, T) ->
- get_nodenames(N, T, []).
-
-get_nodenames(0, _, Acc) ->
- Acc;
-get_nodenames(N, T, Acc) ->
- {A, B, C} = now(),
- get_nodenames(N-1, T, [list_to_atom(atom_to_list(?MODULE)
- ++ "-"
- ++ atom_to_list(T)
- ++ "-"
- ++ integer_to_list(A)
- ++ "-"
- ++ integer_to_list(B)
- ++ "-"
- ++ integer_to_list(C)) | Acc]).
-
get_epmd_port() ->
case init:get_argument(epmd_port) of
{ok, [[PortStr|_]|_]} when is_list(PortStr) ->
diff --git a/lib/erl_interface/test/erl_connect_SUITE.erl b/lib/erl_interface/test/erl_connect_SUITE.erl
index d3fe020bce..f035f1af56 100644
--- a/lib/erl_interface/test/erl_connect_SUITE.erl
+++ b/lib/erl_interface/test/erl_connect_SUITE.erl
@@ -24,87 +24,64 @@
-include_lib("common_test/include/ct.hrl").
-include("erl_connect_SUITE_data/erl_connect_test_cases.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- init_per_testcase/2,end_per_testcase/2,
- erl_send/1,erl_reg_send/1, erl_send_cookie_file/1]).
+-export([all/0, suite/0,
+ erl_send/1, erl_reg_send/1,
+ erl_send_cookie_file/1]).
-import(runner, [get_term/1,send_term/2]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {seconds, 30}}].
all() ->
[erl_send, erl_reg_send, erl_send_cookie_file].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?t:minutes(0.25)),
- [{watchdog, Dog}|Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- test_server:timetrap_cancel(Dog),
- ok.
erl_send(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 1 = erl_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = erl_connect(P, node()),
+ P = runner:start(?interpret),
+ 1 = erl_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = erl_connect(P, node()),
- ?line ok = erl_send(P, Fd, self(), AMsg={a,message}),
- ?line receive AMsg -> ok end,
+ ok = erl_send(P, Fd, self(), AMsg={a,message}),
+ receive AMsg -> ok end,
- ?line 0 = erl_close_connection(P,Fd),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ 0 = erl_close_connection(P,Fd),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
erl_send_cookie_file(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skip,"Skipped on VxWorks"};
- _ ->
- ?line P = runner:start(?interpret),
- ?line 1 = erl_connect_init(P, 42, '', 0),
- ?line {ok,Fd} = erl_connect(P, node()),
-
- ?line ok = erl_send(P, Fd, self(), AMsg={a,message}),
- ?line receive AMsg -> ok end,
-
- ?line 0 = erl_close_connection(P,Fd),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
- ok
+ vxworks ->
+ {skip,"Skipped on VxWorks"};
+ _ ->
+ P = runner:start(?interpret),
+ 1 = erl_connect_init(P, 42, '', 0),
+ {ok,Fd} = erl_connect(P, node()),
+
+ ok = erl_send(P, Fd, self(), AMsg={a,message}),
+ receive AMsg -> ok end,
+
+ 0 = erl_close_connection(P,Fd),
+ runner:send_eot(P),
+ runner:recv_eot(P),
+ ok
end.
erl_reg_send(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line 1 = erl_connect_init(P, 42, erlang:get_cookie(), 0),
- ?line {ok,Fd} = erl_connect(P, node()),
+ P = runner:start(?interpret),
+ 1 = erl_connect_init(P, 42, erlang:get_cookie(), 0),
+ {ok,Fd} = erl_connect(P, node()),
ARegName = a_strange_registred_name,
- ?line register(ARegName, self()),
- ?line ok = erl_reg_send(P, Fd, ARegName, AMsg={another,[strange],message}),
- ?line receive AMsg -> ok end,
+ register(ARegName, self()),
+ ok = erl_reg_send(P, Fd, ARegName, AMsg={another,[strange],message}),
+ receive AMsg -> ok end,
- ?line 0 = erl_close_connection(P,Fd),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ 0 = erl_close_connection(P,Fd),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
@@ -113,20 +90,20 @@ erl_reg_send(Config) when is_list(Config) ->
erl_connect_init(P, Num, Cookie, Creation) ->
send_command(P, erl_connect_init, [Num,Cookie,Creation]),
case get_term(P) of
- {term,Int} when is_integer(Int) -> Int
+ {term,Int} when is_integer(Int) -> Int
end.
erl_connect(P, Node) ->
send_command(P, erl_connect, [Node]),
case get_term(P) of
- {term,{Fd,_}} when Fd >= 0 -> {ok,Fd};
- {term,{-1,Errno}} -> {error,Errno}
+ {term,{Fd,_}} when Fd >= 0 -> {ok,Fd};
+ {term,{-1,Errno}} -> {error,Errno}
end.
erl_close_connection(P, FD) ->
send_command(P, erl_close_connection, [FD]),
case get_term(P) of
- {term,Int} when is_integer(Int) -> Int
+ {term,Int} when is_integer(Int) -> Int
end.
erl_send(P, Fd, To, Msg) ->
@@ -139,17 +116,12 @@ erl_reg_send(P, Fd, To, Msg) ->
get_send_result(P) ->
case get_term(P) of
- {term,{1,_}} -> ok;
- {term,{-1,Errno}} -> {error,Errno};
- {term,{Res,Errno}}->
- io:format("Return value: ~p\nerl_errno: ~p", [Res,Errno]),
- ?t:fail(bad_return_value)
+ {term,{1,_}} -> ok;
+ {term,{-1,Errno}} -> {error,Errno};
+ {term,{Res,Errno}}->
+ io:format("Return value: ~p\nerl_errno: ~p", [Res,Errno]),
+ ct:fail(bad_return_value)
end.
send_command(P, Name, Args) ->
runner:send_term(P, {Name,list_to_tuple(Args)}).
-
-
-
-
-
diff --git a/lib/erl_interface/test/erl_eterm_SUITE.erl b/lib/erl_interface/test/erl_eterm_SUITE.erl
index 230310f63b..b342a2f1ef 100644
--- a/lib/erl_interface/test/erl_eterm_SUITE.erl
+++ b/lib/erl_interface/test/erl_eterm_SUITE.erl
@@ -34,40 +34,39 @@
%%% 5. Miscellanous functions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- build_terms/1, round_trip_conversion/1,
- decode_terms/1, decode_float/1,
- t_erl_mk_int/1, t_erl_mk_list/1,
- basic_copy/1,
- t_erl_cons/1,
- t_erl_mk_atom/1,
- t_erl_mk_binary/1,
- t_erl_mk_empty_list/1,
- t_erl_mk_float/1,
- t_erl_mk_pid/1,
- t_erl_mk_xpid/1,
- t_erl_mk_port/1,
- t_erl_mk_xport/1,
- t_erl_mk_ref/1,
- t_erl_mk_long_ref/1,
- t_erl_mk_string/1,
- t_erl_mk_estring/1,
- t_erl_mk_tuple/1,
- t_erl_mk_uint/1,
- t_erl_mk_var/1,
- t_erl_size/1,
- t_erl_var_content/1,
- t_erl_element/1,
- t_erl_length/1, t_erl_hd/1, t_erl_tl/1,
- type_checks/1, extractor_macros/1,
- t_erl_iolist_length/1, t_erl_iolist_to_binary/1,
- t_erl_iolist_to_string/1,
- erl_print_term/1, print_string/1,
- t_erl_free_compound/1,
- high_chaparal/1,
- broken_data/1,
- cnode_1/1]).
+-export([all/0, suite/0,
+ build_terms/1, round_trip_conversion/1,
+ decode_terms/1, decode_float/1,
+ t_erl_mk_int/1, t_erl_mk_list/1,
+ basic_copy/1,
+ t_erl_cons/1,
+ t_erl_mk_atom/1,
+ t_erl_mk_binary/1,
+ t_erl_mk_empty_list/1,
+ t_erl_mk_float/1,
+ t_erl_mk_pid/1,
+ t_erl_mk_xpid/1,
+ t_erl_mk_port/1,
+ t_erl_mk_xport/1,
+ t_erl_mk_ref/1,
+ t_erl_mk_long_ref/1,
+ t_erl_mk_string/1,
+ t_erl_mk_estring/1,
+ t_erl_mk_tuple/1,
+ t_erl_mk_uint/1,
+ t_erl_mk_var/1,
+ t_erl_size/1,
+ t_erl_var_content/1,
+ t_erl_element/1,
+ t_erl_length/1, t_erl_hd/1, t_erl_tl/1,
+ type_checks/1, extractor_macros/1,
+ t_erl_iolist_length/1, t_erl_iolist_to_binary/1,
+ t_erl_iolist_to_string/1,
+ erl_print_term/1, print_string/1,
+ t_erl_free_compound/1,
+ high_chaparal/1,
+ broken_data/1,
+ cnode_1/1]).
-export([start_cnode/1]).
@@ -76,7 +75,8 @@
%% This test suite controls the running of the C language functions
%% in eterm_test.c and print_term.c.
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[build_terms, round_trip_conversion, decode_terms,
@@ -93,22 +93,6 @@ all() ->
erl_print_term, print_string, t_erl_free_compound,
high_chaparal, broken_data, cnode_1].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
@@ -119,82 +103,77 @@ end_per_group(_GroupName, Config) ->
%% This test asks the C function to construct all data types in
%% a list and verifies that the result is as expected.
-build_terms(suite) -> [];
build_terms(Config) when is_list(Config) ->
- ?line P = runner:start(?build_terms),
- ?line {term, Term} = get_term(P),
- ?line io:format("Received: ~p", [Term]),
- ?line [ARefLN, ARef, APortLN, APort, APidLN, APid,
- {element1, 42, 767}, "A string",
- 1, -1, 0, 3.0, ABin, 'I am an atom'] = Term,
- ?line "A binary" = binary_to_list(ABin),
- ?line case ARef of
- R when is_reference(R), node(R) == kalle@localhost -> ok
- end,
- ?line case ARefLN of
- R1 when is_reference(R1), node(R1) == abcdefghijabcdefghij@localhost -> ok
- end,
- ?line case APort of
- Port when is_port(Port), node(Port) == kalle@localhost -> ok
- end,
- ?line case APortLN of
- Port1 when is_port(Port1), node(Port1) == abcdefghijabcdefghij@localhost -> ok
- end,
- ?line case APid of
- Pid when is_pid(Pid), node(Pid) == kalle@localhost -> ok
- end,
- ?line case APidLN of
- Pid1 when is_pid(Pid1), node(Pid1) == abcdefghijabcdefghij@localhost -> ok
- end,
-
- ?line runner:recv_eot(P),
+ P = runner:start(?build_terms),
+ {term, Term} = get_term(P),
+ io:format("Received: ~p", [Term]),
+ [ARefLN, ARef, APortLN, APort, APidLN, APid,
+ {element1, 42, 767}, "A string",
+ 1, -1, 0, 3.0, ABin, 'I am an atom'] = Term,
+ "A binary" = binary_to_list(ABin),
+ case ARef of
+ R when is_reference(R), node(R) == kalle@localhost -> ok
+ end,
+ case ARefLN of
+ R1 when is_reference(R1), node(R1) == abcdefghijabcdefghij@localhost -> ok
+ end,
+ case APort of
+ Port when is_port(Port), node(Port) == kalle@localhost -> ok
+ end,
+ case APortLN of
+ Port1 when is_port(Port1), node(Port1) == abcdefghijabcdefghij@localhost -> ok
+ end,
+ case APid of
+ Pid when is_pid(Pid), node(Pid) == kalle@localhost -> ok
+ end,
+ case APidLN of
+ Pid1 when is_pid(Pid1), node(Pid1) == abcdefghijabcdefghij@localhost -> ok
+ end,
+
+ runner:recv_eot(P),
ok.
%% This test is run entirely in C code.
-round_trip_conversion(suite) -> [];
round_trip_conversion(Config) when is_list(Config) ->
- ?line runner:test(?round_trip_conversion),
+ runner:test(?round_trip_conversion),
ok.
%% This test sends a list of all data types to the C code function,
%% which decodes it and verifies it.
-decode_terms(suite) -> [];
decode_terms(Config) when is_list(Config) ->
- ?line Dummy1 = list_to_atom(filename:join(?config(priv_dir, Config),
- dummy_file1)),
- ?line Dummy2 = list_to_atom(filename:join(?config(priv_dir, Config),
- dummy_file2)),
- ?line Port1 = open_port(Dummy1, [out]),
- ?line Port2 = open_port(Dummy2, [out]),
- ?line ABinary = list_to_binary("A binary"),
- ?line Terms = [make_ref(), make_ref(),
- Port1, Port2,
- self(), self(),
- {element1, 42, 767}, "A string",
- 1, -1, 0, 3.0, ABinary, 'I am an atom'],
-
- ?line P = runner:start(?decode_terms),
- ?line runner:send_term(P, Terms),
- ?line runner:recv_eot(P),
+ Dummy1 = list_to_atom(filename:join(proplists:get_value(priv_dir, Config),
+ dummy_file1)),
+ Dummy2 = list_to_atom(filename:join(proplists:get_value(priv_dir, Config),
+ dummy_file2)),
+ Port1 = open_port(Dummy1, [out]),
+ Port2 = open_port(Dummy2, [out]),
+ ABinary = list_to_binary("A binary"),
+ Terms = [make_ref(), make_ref(),
+ Port1, Port2,
+ self(), self(),
+ {element1, 42, 767}, "A string",
+ 1, -1, 0, 3.0, ABinary, 'I am an atom'],
+
+ P = runner:start(?decode_terms),
+ runner:send_term(P, Terms),
+ runner:recv_eot(P),
ok.
%% Decodes the floating point number 3.1415.
-decode_float(suite) -> [];
decode_float(Config) when is_list(Config) ->
- ?line P = runner:start(?decode_float),
- ?line runner:send_term(P, 3.1415),
- ?line runner:recv_eot(P),
+ P = runner:start(?decode_float),
+ runner:send_term(P, 3.1415),
+ runner:recv_eot(P),
ok.
%% Tests the erl_free_compound() function.
-t_erl_free_compound(suite) -> [];
t_erl_free_compound(Config) when is_list(Config) ->
- ?line runner:test(?t_erl_free_compound),
+ runner:test(?t_erl_free_compound),
ok.
@@ -206,317 +185,296 @@ t_erl_free_compound(Config) when is_list(Config) ->
%% This tests the erl_mk_list() function.
-t_erl_mk_list(suite) -> [];
t_erl_mk_list(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_list),
+ P = runner:start(?t_erl_mk_list),
- ?line {term, []} = get_term(P),
- ?line {term, [abc]} = get_term(P),
- ?line {term, [abcdef, 42]} = get_term(P),
- ?line {term, [0.0, 23, [], 3.1415]} = get_term(P),
+ {term, []} = get_term(P),
+ {term, [abc]} = get_term(P),
+ {term, [abcdef, 42]} = get_term(P),
+ {term, [0.0, 23, [], 3.1415]} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_int() function.
-t_erl_mk_int(suite) -> [];
t_erl_mk_int(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_int),
-
- ?line {term, 0} = get_term(P),
- ?line {term, 127} = get_term(P),
- ?line {term, 128} = get_term(P),
- ?line {term, 255} = get_term(P),
- ?line {term, 256} = get_term(P),
-
- ?line {term, 16#FFFF} = get_term(P),
- ?line {term, 16#10000} = get_term(P),
-
- ?line {term, 16#07FFFFFF} = get_term(P),
- ?line {term, 16#0FFFFFFF} = get_term(P),
- ?line {term, 16#1FFFFFFF} = get_term(P),
- ?line {term, 16#3FFFFFFF} = get_term(P),
- ?line {term, 16#7FFFFFFF} = get_term(P),
-
- ?line {term, 16#08000000} = get_term(P),
- ?line {term, 16#10000000} = get_term(P),
- ?line {term, 16#20000000} = get_term(P),
- ?line {term, 16#40000000} = get_term(P),
-
-
- ?line {term, -16#07FFFFFF} = get_term(P),
- ?line {term, -16#0FFFFFFF} = get_term(P),
- ?line {term, -16#1FFFFFFF} = get_term(P),
- ?line {term, -16#3FFFFFFF} = get_term(P),
- ?line {term, -16#7FFFFFFF} = get_term(P),
-
- ?line {term, -16#08000000} = get_term(P),
- ?line {term, -16#10000000} = get_term(P),
- ?line {term, -16#20000000} = get_term(P),
- ?line {term, -16#40000000} = get_term(P),
-
- ?line {term, -16#08000001} = get_term(P),
- ?line {term, -16#10000001} = get_term(P),
- ?line {term, -16#20000001} = get_term(P),
- ?line {term, -16#40000001} = get_term(P),
-
- ?line {term, -16#08000002} = get_term(P),
- ?line {term, -16#10000002} = get_term(P),
- ?line {term, -16#20000002} = get_term(P),
- ?line {term, -16#40000002} = get_term(P),
-
- ?line {term, -1999999999} = get_term(P),
- ?line {term, -2000000000} = get_term(P),
- ?line {term, -2000000001} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?t_erl_mk_int),
+
+ {term, 0} = get_term(P),
+ {term, 127} = get_term(P),
+ {term, 128} = get_term(P),
+ {term, 255} = get_term(P),
+ {term, 256} = get_term(P),
+
+ {term, 16#FFFF} = get_term(P),
+ {term, 16#10000} = get_term(P),
+
+ {term, 16#07FFFFFF} = get_term(P),
+ {term, 16#0FFFFFFF} = get_term(P),
+ {term, 16#1FFFFFFF} = get_term(P),
+ {term, 16#3FFFFFFF} = get_term(P),
+ {term, 16#7FFFFFFF} = get_term(P),
+
+ {term, 16#08000000} = get_term(P),
+ {term, 16#10000000} = get_term(P),
+ {term, 16#20000000} = get_term(P),
+ {term, 16#40000000} = get_term(P),
+
+
+ {term, -16#07FFFFFF} = get_term(P),
+ {term, -16#0FFFFFFF} = get_term(P),
+ {term, -16#1FFFFFFF} = get_term(P),
+ {term, -16#3FFFFFFF} = get_term(P),
+ {term, -16#7FFFFFFF} = get_term(P),
+
+ {term, -16#08000000} = get_term(P),
+ {term, -16#10000000} = get_term(P),
+ {term, -16#20000000} = get_term(P),
+ {term, -16#40000000} = get_term(P),
+
+ {term, -16#08000001} = get_term(P),
+ {term, -16#10000001} = get_term(P),
+ {term, -16#20000001} = get_term(P),
+ {term, -16#40000001} = get_term(P),
+
+ {term, -16#08000002} = get_term(P),
+ {term, -16#10000002} = get_term(P),
+ {term, -16#20000002} = get_term(P),
+ {term, -16#40000002} = get_term(P),
+
+ {term, -1999999999} = get_term(P),
+ {term, -2000000000} = get_term(P),
+ {term, -2000000001} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Basic test of erl_copy_term().
-basic_copy(suite) -> [];
basic_copy(Config) when is_list(Config) ->
- ?line runner:test(?basic_copy),
+ runner:test(?basic_copy),
ok.
%% This tests the erl_mk_tuple() function.
-t_erl_mk_tuple(suite) -> [];
t_erl_mk_tuple(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_tuple),
+ P = runner:start(?t_erl_mk_tuple),
- ?line {term, {madonna, 21, 'mad donna', 12}} = get_term(P),
- ?line {term, {'Madonna',21,{children,{"Isabella",2}},
- {'home page',"http://www.madonna.com/"}}} = get_term(P),
+ {term, {madonna, 21, 'mad donna', 12}} = get_term(P),
+ {term, {'Madonna',21,{children,{"Isabella",2}},
+ {'home page',"http://www.madonna.com/"}}} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_atom() function.
-t_erl_mk_atom(suite) -> [];
t_erl_mk_atom(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_atom),
-
- ?line {term, madonna} = (get_term(P)),
- ?line {term, 'Madonna'} = (get_term(P)),
- ?line {term, 'mad donna'} = (get_term(P)),
- ?line {term, '_madonna_'} = (get_term(P)),
- ?line {term, '/home/madonna/tour_plan'} = (get_term(P)),
- ?line {term, 'http://www.madonna.com/tour_plan'} = (get_term(P)),
- ?line {term, '\'madonna\''} = (get_term(P)),
- ?line {term, '\"madonna\"'} = (get_term(P)),
- ?line {term, '\\madonna\\'} = (get_term(P)),
- ?line {term, '{madonna,21,\'mad donna\',12}'} = (get_term(P)),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?t_erl_mk_atom),
+
+ {term, madonna} = (get_term(P)),
+ {term, 'Madonna'} = (get_term(P)),
+ {term, 'mad donna'} = (get_term(P)),
+ {term, '_madonna_'} = (get_term(P)),
+ {term, '/home/madonna/tour_plan'} = (get_term(P)),
+ {term, 'http://www.madonna.com/tour_plan'} = (get_term(P)),
+ {term, '\'madonna\''} = (get_term(P)),
+ {term, '\"madonna\"'} = (get_term(P)),
+ {term, '\\madonna\\'} = (get_term(P)),
+ {term, '{madonna,21,\'mad donna\',12}'} = (get_term(P)),
+
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_binary() function.
-t_erl_mk_binary(suite) -> [];
t_erl_mk_binary(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_binary),
+ P = runner:start(?t_erl_mk_binary),
- ?line {term, Bin} = (get_term(P)),
- ?line "{madonna,21,'mad donna',1234.567.890, !#$%&/()=?+-@, \" \\}" =
- binary_to_list(Bin),
+ {term, Bin} = (get_term(P)),
+ "{madonna,21,'mad donna',1234.567.890, !#$%&/()=?+-@, \" \\}" = binary_to_list(Bin),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_empty_list() function.
-t_erl_mk_empty_list(suite) -> [];
t_erl_mk_empty_list(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_empty_list),
+ P = runner:start(?t_erl_mk_empty_list),
- ?line {term, []} = get_term(P),
+ {term, []} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_float() function.
-t_erl_mk_float(suite) -> [];
t_erl_mk_float(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skipped, "Floating point numbers never compare equal on PPC"};
- _ ->
- ?line P = runner:start(?t_erl_mk_float),
- ?line {term, {3.1415, 1.999999, 2.000000, 2.000001,
- 2.000002, 12345.67890}} =
- get_term(P),
- ?line runner:recv_eot(P),
- ok
+ vxworks ->
+ {skipped, "Floating point numbers never compare equal on PPC"};
+ _ ->
+ P = runner:start(?t_erl_mk_float),
+ {term, {3.1415, 1.999999, 2.000000, 2.000001,
+ 2.000002, 12345.67890}} = get_term(P),
+ runner:recv_eot(P),
+ ok
end.
%% This tests the erl_mk_pid() function.
-t_erl_mk_pid(suite) -> [];
t_erl_mk_pid(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_pid),
+ P = runner:start(?t_erl_mk_pid),
- ?line {term, A_pid} = (get_term(P)),
- ?line {pid, kalle@localhost, 3, 2} = nc2vinfo(A_pid),
+ {term, A_pid} = (get_term(P)),
+ {pid, kalle@localhost, 3, 2} = nc2vinfo(A_pid),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
-t_erl_mk_xpid(suite) -> [];
t_erl_mk_xpid(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_xpid),
+ P = runner:start(?t_erl_mk_xpid),
- ?line {term, A_pid} = (get_term(P)),
- ?line {pid, kalle@localhost, 32767, 8191} = nc2vinfo(A_pid),
+ {term, A_pid} = (get_term(P)),
+ {pid, kalle@localhost, 32767, 8191} = nc2vinfo(A_pid),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_port() function.
-t_erl_mk_port(suite) -> [];
t_erl_mk_port(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_port),
+ P = runner:start(?t_erl_mk_port),
- ?line {term, A_port} = (get_term(P)),
- ?line {port, kalle@localhost, 4} = nc2vinfo(A_port),
+ {term, A_port} = (get_term(P)),
+ {port, kalle@localhost, 4} = nc2vinfo(A_port),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
-t_erl_mk_xport(suite) -> [];
t_erl_mk_xport(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_xport),
+ P = runner:start(?t_erl_mk_xport),
- ?line {term, A_port} = (get_term(P)),
- ?line {port, kalle@localhost, 268435455} = nc2vinfo(A_port),
+ {term, A_port} = (get_term(P)),
+ {port, kalle@localhost, 268435455} = nc2vinfo(A_port),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_ref() function.
-t_erl_mk_ref(suite) -> [];
t_erl_mk_ref(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_ref),
+ P = runner:start(?t_erl_mk_ref),
- ?line {term, A_ref} = (get_term(P)),
- ?line {ref, kalle@localhost, _Length, [6]} = nc2vinfo(A_ref),
+ {term, A_ref} = (get_term(P)),
+ {ref, kalle@localhost, _Length, [6]} = nc2vinfo(A_ref),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
-t_erl_mk_long_ref(suite) -> [];
t_erl_mk_long_ref(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_long_ref),
+ P = runner:start(?t_erl_mk_long_ref),
- ?line {term, A_ref} = (get_term(P)),
- ?line {ref, kalle@localhost, _Length, [4294967295,4294967295,262143]}
- = nc2vinfo(A_ref),
+ {term, A_ref} = (get_term(P)),
+ {ref, kalle@localhost, _Length, [4294967295,4294967295,262143]}
+ = nc2vinfo(A_ref),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_string() function.
-t_erl_mk_string(suite) -> [];
t_erl_mk_string(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_string),
-
- ?line {term, "madonna"} = (get_term(P)),
- ?line {term, "Madonna"} = (get_term(P)),
- ?line {term, "mad donna"} = (get_term(P)),
- ?line {term, "_madonna_"} = (get_term(P)),
- ?line {term, "/home/madonna/tour_plan"} = (get_term(P)),
- ?line {term, "http://www.madonna.com/tour_plan"} = (get_term(P)),
- ?line {term, "\'madonna\'"} = (get_term(P)),
- ?line {term, "\"madonna\""} = (get_term(P)),
- ?line {term, "\\madonna\\"} = (get_term(P)),
- ?line {term, "{madonna,21,'mad donna',12}"} = (get_term(P)),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?t_erl_mk_string),
+
+ {term, "madonna"} = (get_term(P)),
+ {term, "Madonna"} = (get_term(P)),
+ {term, "mad donna"} = (get_term(P)),
+ {term, "_madonna_"} = (get_term(P)),
+ {term, "/home/madonna/tour_plan"} = (get_term(P)),
+ {term, "http://www.madonna.com/tour_plan"} = (get_term(P)),
+ {term, "\'madonna\'"} = (get_term(P)),
+ {term, "\"madonna\""} = (get_term(P)),
+ {term, "\\madonna\\"} = (get_term(P)),
+ {term, "{madonna,21,'mad donna',12}"} = (get_term(P)),
+
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_estring() function.
-t_erl_mk_estring(suite) -> [];
t_erl_mk_estring(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_estring),
-
- ?line {term, "madonna"} = (get_term(P)),
- ?line {term, "Madonna"} = (get_term(P)),
- ?line {term, "mad donna"} = (get_term(P)),
- ?line {term, "_madonna_"} = (get_term(P)),
- ?line {term, "/home/madonna/tour_plan"} = (get_term(P)),
- ?line {term, "http://www.madonna.com/tour_plan"} = (get_term(P)),
- ?line {term, "\'madonna\'"} = (get_term(P)),
- ?line {term, "\"madonna\""} = (get_term(P)),
- ?line {term, "\\madonna\\"} = (get_term(P)),
- ?line {term, "{madonna,21,'mad donna',12}"} = (get_term(P)),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?t_erl_mk_estring),
+
+ {term, "madonna"} = (get_term(P)),
+ {term, "Madonna"} = (get_term(P)),
+ {term, "mad donna"} = (get_term(P)),
+ {term, "_madonna_"} = (get_term(P)),
+ {term, "/home/madonna/tour_plan"} = (get_term(P)),
+ {term, "http://www.madonna.com/tour_plan"} = (get_term(P)),
+ {term, "\'madonna\'"} = (get_term(P)),
+ {term, "\"madonna\""} = (get_term(P)),
+ {term, "\\madonna\\"} = (get_term(P)),
+ {term, "{madonna,21,'mad donna',12}"} = (get_term(P)),
+
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_uint() function.
-t_erl_mk_uint(suite) -> [];
t_erl_mk_uint(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_uint),
+ P = runner:start(?t_erl_mk_uint),
- ?line {term, 54321} = (get_term(P)),
- ?line {term, 2147483647} = (get_term(P)),
- ?line {term, 2147483648} = (get_term(P)),
- ?line {term, 2147483649} = (get_term(P)),
- ?line {term, 2147483650} = (get_term(P)),
- ?line {term, 4294967295} = (get_term(P)),
+ {term, 54321} = (get_term(P)),
+ {term, 2147483647} = (get_term(P)),
+ {term, 2147483648} = (get_term(P)),
+ {term, 2147483649} = (get_term(P)),
+ {term, 2147483650} = (get_term(P)),
+ {term, 4294967295} = (get_term(P)),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_mk_var() function.
-t_erl_mk_var(suite) -> [];
t_erl_mk_var(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_mk_var),
+ P = runner:start(?t_erl_mk_var),
- ?line {term, 1} = (get_term(P)),
- ?line {term, 0} = (get_term(P)),
- ?line {term, 1} = (get_term(P)),
- ?line {term, 0} = (get_term(P)),
- ?line {term, 1} = (get_term(P)),
- ?line {term, 0} = (get_term(P)),
- ?line {term, 1} = (get_term(P)),
+ {term, 1} = (get_term(P)),
+ {term, 0} = (get_term(P)),
+ {term, 1} = (get_term(P)),
+ {term, 0} = (get_term(P)),
+ {term, 1} = (get_term(P)),
+ {term, 0} = (get_term(P)),
+ {term, 1} = (get_term(P)),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_cons() function.
-t_erl_cons(suite) -> [];
t_erl_cons(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_cons),
+ P = runner:start(?t_erl_cons),
- ?line {term, [madonna, 21]} = get_term(P),
+ {term, [madonna, 21]} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
@@ -531,21 +489,20 @@ t_erl_cons(Config) when is_list(Config) ->
%% Tests the erl_length() function.
-t_erl_length(suite) -> [];
t_erl_length(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_length),
+ P = runner:start(?t_erl_length),
- ?line 0 = erl_length(P, []),
- ?line 1 = erl_length(P, [a]),
- ?line 2 = erl_length(P, [a, b]),
- ?line 3 = erl_length(P, [a, b, c]),
+ 0 = erl_length(P, []),
+ 1 = erl_length(P, [a]),
+ 2 = erl_length(P, [a, b]),
+ 3 = erl_length(P, [a, b, c]),
- ?line 4 = erl_length(P, [a, [x, y], c, []]),
+ 4 = erl_length(P, [a, [x, y], c, []]),
- ?line -1 = erl_length(P, [a|b]),
- ?line -1 = erl_length(P, a),
+ -1 = erl_length(P, [a|b]),
+ -1 = erl_length(P, a),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
%% Invokes the erl_length() function.
@@ -555,22 +512,21 @@ erl_length(Port, List) ->
%% Tests the erl_hd() function.
-t_erl_hd(suite) -> [];
t_erl_hd(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_hd),
-
- ?line 'NULL' = erl_hd(P, 42),
- ?line 'NULL' = erl_hd(P, abc),
- ?line 'NULL' = erl_hd(P, []),
-
- ?line [] = erl_hd(P, [[], a]),
- ?line a = erl_hd(P, [a]),
- ?line a = erl_hd(P, [a, b]),
- ?line a = erl_hd(P, [a, b, c]),
- ?line a = erl_hd(P, [a|b]),
-
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ P = runner:start(?t_erl_hd),
+
+ 'NULL' = erl_hd(P, 42),
+ 'NULL' = erl_hd(P, abc),
+ 'NULL' = erl_hd(P, []),
+
+ [] = erl_hd(P, [[], a]),
+ a = erl_hd(P, [a]),
+ a = erl_hd(P, [a, b]),
+ a = erl_hd(P, [a, b, c]),
+ a = erl_hd(P, [a|b]),
+
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
%% Invokes the erl_hd() function.
@@ -580,22 +536,21 @@ erl_hd(Port, List) ->
%% Tests the erl_tail() function.
-t_erl_tl(suite) -> [];
t_erl_tl(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_tl),
+ P = runner:start(?t_erl_tl),
- ?line 'NULL' = erl_tl(P, 42),
- ?line 'NULL' = erl_tl(P, abc),
- ?line 'NULL' = erl_tl(P, []),
+ 'NULL' = erl_tl(P, 42),
+ 'NULL' = erl_tl(P, abc),
+ 'NULL' = erl_tl(P, []),
- ?line [] = erl_tl(P, [a]),
- ?line [b] = erl_tl(P, [a, b]),
- ?line [b, c] = erl_tl(P, [a, b, c]),
+ [] = erl_tl(P, [a]),
+ [b] = erl_tl(P, [a, b]),
+ [b, c] = erl_tl(P, [a, b, c]),
- ?line b = erl_tl(P, [a|b]),
+ b = erl_tl(P, [a|b]),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
%% Invokes the erl_tail() function in erl_interface.
@@ -605,68 +560,63 @@ erl_tl(Port, List) ->
%% Tests the type checking macros (done in the C program).
-type_checks(suite) -> [];
type_checks(Config) when is_list(Config) ->
- ?line runner:test(?type_checks),
+ runner:test(?type_checks),
ok.
%% Tests the extractor macros (done in the C program).
-extractor_macros(suite) -> [];
extractor_macros(Config) when is_list(Config) ->
- ?line runner:test(?extractor_macros),
+ runner:test(?extractor_macros),
ok.
%% This tests the erl_size() function.
-t_erl_size(suite) -> [];
t_erl_size(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_size),
+ P = runner:start(?t_erl_size),
- ?line {term, 0} = (get_term(P)),
- ?line {term, 4} = (get_term(P)),
+ {term, 0} = (get_term(P)),
+ {term, 4} = (get_term(P)),
- ?line {term, 0} = (get_term(P)),
- ?line {term, 27} = (get_term(P)),
+ {term, 0} = (get_term(P)),
+ {term, 27} = (get_term(P)),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_var_content() function.
-t_erl_var_content(suite) -> [];
t_erl_var_content(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_var_content),
+ P = runner:start(?t_erl_var_content),
- ?line {term, 17} = (get_term(P)),
- ?line {term, "http://www.madonna.com"} = (get_term(P)),
- ?line {term, 2} = (get_term(P)),
- ?line {term, "http://www.madonna.com"} = (get_term(P)),
- ?line {term, 2} = (get_term(P)),
+ {term, 17} = (get_term(P)),
+ {term, "http://www.madonna.com"} = (get_term(P)),
+ {term, 2} = (get_term(P)),
+ {term, "http://www.madonna.com"} = (get_term(P)),
+ {term, 2} = (get_term(P)),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
%% This tests the erl_element() function.
-t_erl_element(suite) -> [];
t_erl_element(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_element),
+ P = runner:start(?t_erl_element),
- ?line {term, madonna} = get_term(P),
- ?line {term, 21} = get_term(P),
- ?line {term, 'mad donna'} = get_term(P),
- ?line {term, 12} = get_term(P),
+ {term, madonna} = get_term(P),
+ {term, 21} = get_term(P),
+ {term, 'mad donna'} = get_term(P),
+ {term, 12} = get_term(P),
- ?line {term, 'Madonna'} = get_term(P),
- ?line {term, 21} = get_term(P),
- ?line {term, {children,{"Isabella",2}}} = get_term(P),
- ?line {term, {'home page',"http://www.madonna.com/"}} = get_term(P),
+ {term, 'Madonna'} = get_term(P),
+ {term, 21} = get_term(P),
+ {term, {children,{"Isabella",2}}} = get_term(P),
+ {term, {'home page',"http://www.madonna.com/"}} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
@@ -679,65 +629,64 @@ t_erl_element(Config) when is_list(Config) ->
%% Tests the erl_iolist_length() function.
-t_erl_iolist_length(suite) -> [];
t_erl_iolist_length(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_iolist_length),
+ P = runner:start(?t_erl_iolist_length),
%% Flat lists.
- ?line 0 = erl_iolist_length(P, []),
- ?line 1 = erl_iolist_length(P, [10]),
- ?line 2 = erl_iolist_length(P, [10, 20]),
- ?line 3 = erl_iolist_length(P, [10, 20, 30]),
- ?line 256 = erl_iolist_length(P, lists:seq(0, 255)),
+ 0 = erl_iolist_length(P, []),
+ 1 = erl_iolist_length(P, [10]),
+ 2 = erl_iolist_length(P, [10, 20]),
+ 3 = erl_iolist_length(P, [10, 20, 30]),
+ 256 = erl_iolist_length(P, lists:seq(0, 255)),
%% Deep lists.
- ?line 0 = erl_iolist_length(P, [[]]),
- ?line 1 = erl_iolist_length(P, [[], 42]),
- ?line 1 = erl_iolist_length(P, [42, []]),
- ?line 2 = erl_iolist_length(P, [42, [], 45]),
+ 0 = erl_iolist_length(P, [[]]),
+ 1 = erl_iolist_length(P, [[], 42]),
+ 1 = erl_iolist_length(P, [42, []]),
+ 2 = erl_iolist_length(P, [42, [], 45]),
- ?line 3 = erl_iolist_length(P, [42, [90], 45]),
- ?line 3 = erl_iolist_length(P, [[42, [90]], 45]),
- ?line 3 = erl_iolist_length(P, [[42, [90]], 45]),
+ 3 = erl_iolist_length(P, [42, [90], 45]),
+ 3 = erl_iolist_length(P, [[42, [90]], 45]),
+ 3 = erl_iolist_length(P, [[42, [90]], 45]),
%% List with binaries.
- ?line 0 = erl_iolist_length(P, [list_to_binary([])]),
- ?line 0 = erl_iolist_length(P, [[], list_to_binary([])]),
- ?line 1 = erl_iolist_length(P, [[1], list_to_binary([])]),
- ?line 1 = erl_iolist_length(P, [[], list_to_binary([2])]),
- ?line 2 = erl_iolist_length(P, [[42], list_to_binary([2])]),
- ?line 4 = erl_iolist_length(P, [[42], list_to_binary([2, 3, 4])]),
+ 0 = erl_iolist_length(P, [list_to_binary([])]),
+ 0 = erl_iolist_length(P, [[], list_to_binary([])]),
+ 1 = erl_iolist_length(P, [[1], list_to_binary([])]),
+ 1 = erl_iolist_length(P, [[], list_to_binary([2])]),
+ 2 = erl_iolist_length(P, [[42], list_to_binary([2])]),
+ 4 = erl_iolist_length(P, [[42], list_to_binary([2, 3, 4])]),
%% Binaries as tail.
- ?line 0 = erl_iolist_length(P, [[]| list_to_binary([])]),
- ?line 1 = erl_iolist_length(P, [[1]| list_to_binary([])]),
- ?line 1 = erl_iolist_length(P, [[]| list_to_binary([2])]),
- ?line 2 = erl_iolist_length(P, [[42]| list_to_binary([2])]),
+ 0 = erl_iolist_length(P, [[]| list_to_binary([])]),
+ 1 = erl_iolist_length(P, [[1]| list_to_binary([])]),
+ 1 = erl_iolist_length(P, [[]| list_to_binary([2])]),
+ 2 = erl_iolist_length(P, [[42]| list_to_binary([2])]),
%% Binaries only.
- ?line 0 = erl_iolist_length(P, list_to_binary("")),
- ?line 1 = erl_iolist_length(P, list_to_binary([1])),
- ?line 2 = erl_iolist_length(P, list_to_binary([1, 2])),
+ 0 = erl_iolist_length(P, list_to_binary("")),
+ 1 = erl_iolist_length(P, list_to_binary([1])),
+ 2 = erl_iolist_length(P, list_to_binary([1, 2])),
%% Illegal cases.
- ?line -1 = erl_iolist_length(P, [42|43]),
- ?line -1 = erl_iolist_length(P, a),
+ -1 = erl_iolist_length(P, [42|43]),
+ -1 = erl_iolist_length(P, a),
- ?line -1 = erl_iolist_length(P, [a]),
- ?line -1 = erl_iolist_length(P, [256]),
- ?line -1 = erl_iolist_length(P, [257]),
- ?line -1 = erl_iolist_length(P, [-1]),
- ?line -1 = erl_iolist_length(P, [-2]),
- ?line -1 = erl_iolist_length(P, [-127]),
- ?line -1 = erl_iolist_length(P, [-128]),
+ -1 = erl_iolist_length(P, [a]),
+ -1 = erl_iolist_length(P, [256]),
+ -1 = erl_iolist_length(P, [257]),
+ -1 = erl_iolist_length(P, [-1]),
+ -1 = erl_iolist_length(P, [-2]),
+ -1 = erl_iolist_length(P, [-127]),
+ -1 = erl_iolist_length(P, [-128]),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
%% Invokes the erl_iolist_length() function.
@@ -747,143 +696,141 @@ erl_iolist_length(Port, List) ->
%% Tests the erl_iolist_to_binary() function.
-t_erl_iolist_to_binary(suite) -> [];
t_erl_iolist_to_binary(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_iolist_to_binary),
+ P = runner:start(?t_erl_iolist_to_binary),
%% Flat lists.
- ?line [] = iolist_to_list(P, []),
- ?line [10] = iolist_to_list(P, [10]),
- ?line [10, 20] = iolist_to_list(P, [10, 20]),
- ?line [10, 20, 30] = iolist_to_list(P, [10, 20, 30]),
- ?line AllBytes = lists:seq(0, 255),
- ?line AllBytes = iolist_to_list(P, AllBytes),
+ [] = iolist_to_list(P, []),
+ [10] = iolist_to_list(P, [10]),
+ [10, 20] = iolist_to_list(P, [10, 20]),
+ [10, 20, 30] = iolist_to_list(P, [10, 20, 30]),
+ AllBytes = lists:seq(0, 255),
+ AllBytes = iolist_to_list(P, AllBytes),
%% Deep lists.
- ?line [] = iolist_to_list(P, [[]]),
- ?line [42] = iolist_to_list(P, [[], 42]),
- ?line [42] = iolist_to_list(P, [42, []]),
- ?line [42, 45] = iolist_to_list(P, [42, [], 45]),
+ [] = iolist_to_list(P, [[]]),
+ [42] = iolist_to_list(P, [[], 42]),
+ [42] = iolist_to_list(P, [42, []]),
+ [42, 45] = iolist_to_list(P, [42, [], 45]),
- ?line [42, 90, 45] = iolist_to_list(P, [42, [90], 45]),
- ?line [42, 90, 45] = iolist_to_list(P, [[42, [90]], 45]),
- ?line [42, 90, 45] = iolist_to_list(P, [[42, [90]], 45]),
+ [42, 90, 45] = iolist_to_list(P, [42, [90], 45]),
+ [42, 90, 45] = iolist_to_list(P, [[42, [90]], 45]),
+ [42, 90, 45] = iolist_to_list(P, [[42, [90]], 45]),
%% List with binaries.
- ?line [] = iolist_to_list(P, [list_to_binary([])]),
- ?line [] = iolist_to_list(P, [[], list_to_binary([])]),
- ?line [1] = iolist_to_list(P, [[1], list_to_binary([])]),
- ?line [2] = iolist_to_list(P, [[], list_to_binary([2])]),
- ?line [42, 2] = iolist_to_list(P, [[42], list_to_binary([2])]),
- ?line [42, 2, 3, 4] = iolist_to_list(P, [[42], list_to_binary([2, 3, 4])]),
+ [] = iolist_to_list(P, [list_to_binary([])]),
+ [] = iolist_to_list(P, [[], list_to_binary([])]),
+ [1] = iolist_to_list(P, [[1], list_to_binary([])]),
+ [2] = iolist_to_list(P, [[], list_to_binary([2])]),
+ [42, 2] = iolist_to_list(P, [[42], list_to_binary([2])]),
+ [42, 2, 3, 4] = iolist_to_list(P, [[42], list_to_binary([2, 3, 4])]),
%% Binaries as tail.
- ?line [] = iolist_to_list(P, [[]| list_to_binary([])]),
- ?line [1] = iolist_to_list(P, [[1]| list_to_binary([])]),
- ?line [2] = iolist_to_list(P, [[]| list_to_binary([2])]),
- ?line [42, 2] = iolist_to_list(P, [[42]| list_to_binary([2])]),
+ [] = iolist_to_list(P, [[]| list_to_binary([])]),
+ [1] = iolist_to_list(P, [[1]| list_to_binary([])]),
+ [2] = iolist_to_list(P, [[]| list_to_binary([2])]),
+ [42, 2] = iolist_to_list(P, [[42]| list_to_binary([2])]),
%% Binaries only.
- ?line [] = iolist_to_list(P, list_to_binary("")),
- ?line [1] = iolist_to_list(P, list_to_binary([1])),
- ?line [1, 2] = iolist_to_list(P, list_to_binary([1, 2])),
+ [] = iolist_to_list(P, list_to_binary("")),
+ [1] = iolist_to_list(P, list_to_binary([1])),
+ [1, 2] = iolist_to_list(P, list_to_binary([1, 2])),
%% Illegal cases.
- ?line 'NULL' = iolist_to_list(P, [42|43]),
- ?line 'NULL' = iolist_to_list(P, a),
+ 'NULL' = iolist_to_list(P, [42|43]),
+ 'NULL' = iolist_to_list(P, a),
- ?line 'NULL' = iolist_to_list(P, [a]),
- ?line 'NULL' = iolist_to_list(P, [256]),
- ?line 'NULL' = iolist_to_list(P, [257]),
- ?line 'NULL' = iolist_to_list(P, [-1]),
- ?line 'NULL' = iolist_to_list(P, [-2]),
- ?line 'NULL' = iolist_to_list(P, [-127]),
- ?line 'NULL' = iolist_to_list(P, [-128]),
+ 'NULL' = iolist_to_list(P, [a]),
+ 'NULL' = iolist_to_list(P, [256]),
+ 'NULL' = iolist_to_list(P, [257]),
+ 'NULL' = iolist_to_list(P, [-1]),
+ 'NULL' = iolist_to_list(P, [-2]),
+ 'NULL' = iolist_to_list(P, [-127]),
+ 'NULL' = iolist_to_list(P, [-128]),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
iolist_to_list(Port, Term) ->
case call_erl_function(Port, Term) of
- 'NULL' ->
- 'NULL';
- Bin when is_binary(Bin) ->
- binary_to_list(Bin)
+ 'NULL' ->
+ 'NULL';
+ Bin when is_binary(Bin) ->
+ binary_to_list(Bin)
end.
%% Tests the erl_iolist_to_string() function.
-t_erl_iolist_to_string(suite) -> [];
t_erl_iolist_to_string(Config) when is_list(Config) ->
- ?line P = runner:start(?t_erl_iolist_to_string),
+ P = runner:start(?t_erl_iolist_to_string),
%% Flat lists.
- ?line [0] = iolist_to_string(P, []),
- ?line [10, 0] = iolist_to_string(P, [10]),
- ?line [10, 20, 0] = iolist_to_string(P, [10, 20]),
- ?line [10, 20, 30, 0] = iolist_to_string(P, [10, 20, 30]),
- ?line AllBytes = lists:seq(1, 255)++[0],
- ?line AllBytes = iolist_to_string(P, lists:seq(1, 255)),
+ [0] = iolist_to_string(P, []),
+ [10, 0] = iolist_to_string(P, [10]),
+ [10, 20, 0] = iolist_to_string(P, [10, 20]),
+ [10, 20, 30, 0] = iolist_to_string(P, [10, 20, 30]),
+ AllBytes = lists:seq(1, 255)++[0],
+ AllBytes = iolist_to_string(P, lists:seq(1, 255)),
%% Deep lists.
- ?line [0] = iolist_to_string(P, [[]]),
- ?line [42, 0] = iolist_to_string(P, [[], 42]),
- ?line [42, 0] = iolist_to_string(P, [42, []]),
- ?line [42, 45, 0] = iolist_to_string(P, [42, [], 45]),
+ [0] = iolist_to_string(P, [[]]),
+ [42, 0] = iolist_to_string(P, [[], 42]),
+ [42, 0] = iolist_to_string(P, [42, []]),
+ [42, 45, 0] = iolist_to_string(P, [42, [], 45]),
- ?line [42, 90, 45, 0] = iolist_to_string(P, [42, [90], 45]),
- ?line [42, 90, 45, 0] = iolist_to_string(P, [[42, [90]], 45]),
- ?line [42, 90, 45, 0] = iolist_to_string(P, [[42, [90]], 45]),
+ [42, 90, 45, 0] = iolist_to_string(P, [42, [90], 45]),
+ [42, 90, 45, 0] = iolist_to_string(P, [[42, [90]], 45]),
+ [42, 90, 45, 0] = iolist_to_string(P, [[42, [90]], 45]),
%% List with binaries.
- ?line [0] = iolist_to_string(P, [list_to_binary([])]),
- ?line [0] = iolist_to_string(P, [[], list_to_binary([])]),
- ?line [1, 0] = iolist_to_string(P, [[1], list_to_binary([])]),
- ?line [2, 0] = iolist_to_string(P, [[], list_to_binary([2])]),
- ?line [42, 2, 0] = iolist_to_string(P, [[42], list_to_binary([2])]),
- ?line [42, 2, 3, 4, 0] = iolist_to_string(P, [[42],
- list_to_binary([2, 3, 4])]),
+ [0] = iolist_to_string(P, [list_to_binary([])]),
+ [0] = iolist_to_string(P, [[], list_to_binary([])]),
+ [1, 0] = iolist_to_string(P, [[1], list_to_binary([])]),
+ [2, 0] = iolist_to_string(P, [[], list_to_binary([2])]),
+ [42, 2, 0] = iolist_to_string(P, [[42], list_to_binary([2])]),
+ [42, 2, 3, 4, 0] = iolist_to_string(P, [[42],
+ list_to_binary([2, 3, 4])]),
%% Binaries as tail.
- ?line [0] = iolist_to_string(P, [[]| list_to_binary([])]),
- ?line [1, 0] = iolist_to_string(P, [[1]| list_to_binary([])]),
- ?line [2, 0] = iolist_to_string(P, [[]| list_to_binary([2])]),
- ?line [42, 2, 0] = iolist_to_string(P, [[42]| list_to_binary([2])]),
+ [0] = iolist_to_string(P, [[]| list_to_binary([])]),
+ [1, 0] = iolist_to_string(P, [[1]| list_to_binary([])]),
+ [2, 0] = iolist_to_string(P, [[]| list_to_binary([2])]),
+ [42, 2, 0] = iolist_to_string(P, [[42]| list_to_binary([2])]),
%% Binaries only.
- ?line [0] = iolist_to_string(P, list_to_binary("")),
- ?line [1, 0] = iolist_to_string(P, list_to_binary([1])),
- ?line [1, 2, 0] = iolist_to_string(P, list_to_binary([1, 2])),
+ [0] = iolist_to_string(P, list_to_binary("")),
+ [1, 0] = iolist_to_string(P, list_to_binary([1])),
+ [1, 2, 0] = iolist_to_string(P, list_to_binary([1, 2])),
%% Illegal cases.
- ?line 'NULL' = iolist_to_string(P, [0]),
- ?line 'NULL' = iolist_to_string(P, [65, 0, 66]),
- ?line 'NULL' = iolist_to_string(P, [65, 66, 67, 0]),
+ 'NULL' = iolist_to_string(P, [0]),
+ 'NULL' = iolist_to_string(P, [65, 0, 66]),
+ 'NULL' = iolist_to_string(P, [65, 66, 67, 0]),
- ?line 'NULL' = iolist_to_string(P, [42|43]),
- ?line 'NULL' = iolist_to_string(P, a),
+ 'NULL' = iolist_to_string(P, [42|43]),
+ 'NULL' = iolist_to_string(P, a),
- ?line 'NULL' = iolist_to_string(P, [a]),
- ?line 'NULL' = iolist_to_string(P, [256]),
- ?line 'NULL' = iolist_to_string(P, [257]),
- ?line 'NULL' = iolist_to_string(P, [-1]),
- ?line 'NULL' = iolist_to_string(P, [-2]),
- ?line 'NULL' = iolist_to_string(P, [-127]),
- ?line 'NULL' = iolist_to_string(P, [-128]),
+ 'NULL' = iolist_to_string(P, [a]),
+ 'NULL' = iolist_to_string(P, [256]),
+ 'NULL' = iolist_to_string(P, [257]),
+ 'NULL' = iolist_to_string(P, [-1]),
+ 'NULL' = iolist_to_string(P, [-2]),
+ 'NULL' = iolist_to_string(P, [-127]),
+ 'NULL' = iolist_to_string(P, [-128]),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
%% Invokes the erl_iolist_to_string() function.
@@ -891,8 +838,8 @@ t_erl_iolist_to_string(Config) when is_list(Config) ->
iolist_to_string(Port, Term) ->
runner:send_term(Port, Term),
case get_term(Port) of
- {bytes, Result} -> Result;
- 'NULL' -> 'NULL'
+ {bytes, Result} -> Result;
+ 'NULL' -> 'NULL'
end.
@@ -902,38 +849,37 @@ iolist_to_string(Port, Term) ->
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-erl_print_term(suite) -> [];
-erl_print_term(doc) -> "Tests the erl_print_term() function";
+%% Tests the erl_print_term() function
erl_print_term(Config) when is_list(Config) ->
- ?line PrintTerm = print_term(Config),
- ?line P = open_port({spawn, PrintTerm}, [stream]),
+ PrintTerm = print_term(Config),
+ P = open_port({spawn, PrintTerm}, [stream]),
%% Lists.
- ?line print(P, "[]", []),
- ?line print(P, "[a]", [a]),
- ?line print(P, "[[a]]", [[a]]),
- ?line print(P, "[[]]", [[]]),
- ?line print(P, "[a,b,c]", [a,b,c]),
- ?line print(P, "[a,b|c]", [a,b|c]),
- ?line print(P, "[a,[],c]", [a,[],c]),
- ?line print(P, "[a,[1000,1],c]", [a,[1000,1],c]),
+ print(P, "[]", []),
+ print(P, "[a]", [a]),
+ print(P, "[[a]]", [[a]]),
+ print(P, "[[]]", [[]]),
+ print(P, "[a,b,c]", [a,b,c]),
+ print(P, "[a,b|c]", [a,b|c]),
+ print(P, "[a,[],c]", [a,[],c]),
+ print(P, "[a,[1000,1],c]", [a,[1000,1],c]),
%% Tuples.
- ?line print(P, "{}", {}),
- ?line print(P, "{ok}", {ok}),
- ?line print(P, "{1,2,3}", {1, 2, 3}),
+ print(P, "{}", {}),
+ print(P, "{ok}", {ok}),
+ print(P, "{1,2,3}", {1, 2, 3}),
%% Pids.
- ?line {_X, Y, Z} = split_pid(self()),
- ?line PidString = lists:flatten(io_lib:format("<~s.~w.~w>",
- [node(), Y, Z])),
- ?line print(P, PidString, self()),
+ {_X, Y, Z} = split_pid(self()),
+ PidString = lists:flatten(io_lib:format("<~s.~w.~w>",
+ [node(), Y, Z])),
+ print(P, PidString, self()),
- ?line unlink(P),
- ?line exit(P, die),
+ unlink(P),
+ exit(P, die),
ok.
split_pid(Pid) when is_pid(Pid) ->
@@ -948,23 +894,22 @@ split_pid([$.|Rest], Cur, Result) ->
split_pid([$>], Cur, Result) ->
list_to_tuple(Result++[Cur]).
-print_string(suite) -> [];
-print_string(doc) -> "Test printing a string with erl_print_term()";
+%% Test printing a string with erl_print_term()
print_string(Config) when is_list(Config) ->
- ?line PrintTerm = print_term(Config),
- ?line P = open_port({spawn, PrintTerm}, [stream]),
+ PrintTerm = print_term(Config),
+ P = open_port({spawn, PrintTerm}, [stream]),
%% Strings.
- ?line print(P, "\"ABC\"", "ABC"),
- ?line {11, "\"\\tABC\\r\\n\""} = print(P, "\tABC\r\n"),
+ print(P, "\"ABC\"", "ABC"),
+ {11, "\"\\tABC\\r\\n\""} = print(P, "\tABC\r\n"),
%% Not strings.
- ?line print(P, "[65,66,67,0]", "ABC\000"),
+ print(P, "[65,66,67,0]", "ABC\000"),
- ?line unlink(P),
- ?line exit(P, die),
+ unlink(P),
+ exit(P, die),
ok.
print(Port, TermString, Term) ->
@@ -983,15 +928,16 @@ print(Port, Term) ->
collect_line(Port, Result) ->
receive
- {Port, {data, Data}} ->
- case lists:reverse(Data) of
- [$\n|Rest] ->
- collect_line1(Rest++Result, []);
- Chars ->
- collect_line(Port, Chars++Result)
- end
- after test_server:seconds(5) ->
- test_server:fail("No response from C program")
+ {Port, {data, Data}} ->
+ case lists:reverse(Data) of
+ [$\n|Rest] ->
+ collect_line1(Rest++Result, []);
+ Chars ->
+ collect_line(Port, Chars++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) ->
@@ -1001,18 +947,16 @@ collect_line1([C|Rest], Result) ->
%% Test case submitted by Per Lundgren, ERV.
-high_chaparal(suite) -> [];
high_chaparal(Config) when is_list(Config) ->
- ?line P = runner:start(?high_chaparal),
- ?line {term, [hello, world]} = get_term(P),
- ?line runner:recv_eot(P),
+ P = runner:start(?high_chaparal),
+ {term, [hello, world]} = get_term(P),
+ runner:recv_eot(P),
ok.
%% OTP-7448
-broken_data(suite) -> [];
broken_data(Config) when is_list(Config) ->
- ?line P = runner:start(?broken_data),
- ?line runner:recv_eot(P),
+ P = runner:start(?broken_data),
+ runner:recv_eot(P),
ok.
%% This calls a C function with one parameter and returns the result.
@@ -1020,12 +964,12 @@ broken_data(Config) when is_list(Config) ->
call_erl_function(Port, Term) ->
runner:send_term(Port, Term),
case get_term(Port) of
- {term, Result} -> Result;
- 'NULL' -> 'NULL'
+ {term, Result} -> Result;
+ 'NULL' -> 'NULL'
end.
print_term(Config) when is_list(Config) ->
- filename:join(?config(data_dir, Config), "print_term").
+ filename:join(proplists:get_value(data_dir, Config), "print_term").
@@ -1034,57 +978,57 @@ print_term(Config) when is_list(Config) ->
%%% back, without having been mutated into short form. We must take
%%% care then to check the actual returned ref, and not the original
%%% one, which is equal to it.
-cnode_1(suite) -> [];
-cnode_1(doc) -> "Tests involving cnode: sends a long ref from a cnode to us";
+
+%% Tests involving cnode: sends a long ref from a cnode to us
cnode_1(Config) when is_list(Config) ->
- ?line Cnode = filename:join(?config(data_dir, Config), "cnode"),
- ?line register(mip, self()),
- ?line spawn_link(?MODULE, start_cnode, [Cnode]),
- ?line Ref1 = get_ref(),
+ Cnode = filename:join(proplists:get_value(data_dir, Config), "cnode"),
+ register(mip, self()),
+ spawn_link(?MODULE, start_cnode, [Cnode]),
+ Ref1 = get_ref(),
io:format("Ref1 ~p~n", [Ref1]),
- ?line check_ref(Ref1),
- ?line Ref2 = make_ref(),
- ?line receive
- Pid -> Pid
- end,
- ?line Fun1 = fun(X) -> {Pid, X} end, % sneak in a fun test here
- %?line Fun1 = {wait_with_funs, new_dist_format},
- ?line Term = {Ref2, Fun1, {1,2,3,4,5,6,7,8,9,10}},
+ check_ref(Ref1),
+ Ref2 = make_ref(),
+ 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}},
%% A term which will overflow the original buffer used in 'cnode'.
- ?line Pid ! Term,
- ?line receive
- Term2 ->
- io:format("received ~p~n", [Term2]),
- case Term2 of
- Term ->
- {Ref22,_,_} = Term2,
- ?line check_ref(Ref22);
- X ->
- test_server:fail({receive1,X})
- end
- after 5000 ->
- test_server:fail(receive1)
- end,
- ?line receive
- Pid ->
- ok;
- Y ->
- test_server:fail({receive1,Y})
- after 5000 ->
- test_server:fail(receive2)
- end,
- ?line io:format("ref = ~p~n", [Ref1]),
- ?line check_ref(Ref1),
+ Pid ! Term,
+ receive
+ Term2 ->
+ io:format("received ~p~n", [Term2]),
+ case Term2 of
+ Term ->
+ {Ref22,_,_} = Term2,
+ check_ref(Ref22);
+ X ->
+ ct:fail({receive1,X})
+ end
+ after 5000 ->
+ ct:fail(receive1)
+ end,
+ receive
+ Pid ->
+ ok;
+ Y ->
+ ct:fail({receive1,Y})
+ after 5000 ->
+ ct:fail(receive2)
+ end,
+ io:format("ref = ~p~n", [Ref1]),
+ check_ref(Ref1),
ok.
check_ref(Ref) ->
case bin_ext_type(Ref) of
- 101 ->
- test_server:fail(oldref);
- 114 ->
- ok;
- Type ->
- test_server:fail({type, Type})
+ 101 ->
+ ct:fail(oldref);
+ 114 ->
+ ok;
+ Type ->
+ ct:fail({type, Type})
end.
bin_ext_type(T) ->
@@ -1093,10 +1037,10 @@ bin_ext_type(T) ->
get_ref() ->
receive
- X when is_reference(X) ->
- X
+ X when is_reference(X) ->
+ X
after 5000 ->
- test_server:fail({cnode, timeout})
+ ct:fail({cnode, timeout})
end.
start_cnode(Cnode) ->
@@ -1105,35 +1049,33 @@ start_cnode(Cnode) ->
rec_cnode() ->
receive
- X ->
- io:format("from cnode: ~p~n", [X]),
- rec_cnode()
+ X ->
+ io:format("from cnode: ~p~n", [X]),
+ rec_cnode()
end.
nc2vinfo(Pid) when is_pid(Pid) ->
- ?line [_NodeStr, NumberStr, SerialStr]
- = string:tokens(pid_to_list(Pid), "<.>"),
- ?line Number = list_to_integer(NumberStr),
- ?line Serial = list_to_integer(SerialStr),
- ?line {pid, node(Pid), Number, Serial};
+ [_NodeStr, NumberStr, SerialStr]
+ = string:tokens(pid_to_list(Pid), "<.>"),
+ Number = list_to_integer(NumberStr),
+ Serial = list_to_integer(SerialStr),
+ {pid, node(Pid), Number, Serial};
nc2vinfo(Port) when is_port(Port) ->
- ?line ["#Port", _NodeStr, NumberStr]
- = string:tokens(erlang:port_to_list(Port), "<.>"),
- ?line Number = list_to_integer(NumberStr),
- ?line {port, node(Port), Number};
+ ["#Port", _NodeStr, NumberStr]
+ = string:tokens(erlang:port_to_list(Port), "<.>"),
+ Number = list_to_integer(NumberStr),
+ {port, node(Port), Number};
nc2vinfo(Ref) when is_reference(Ref) ->
- ?line ["#Ref", _NodeStr | NumStrList]
- = string:tokens(erlang:ref_to_list(Ref), "<.>"),
- ?line {Len, RevNumList} = lists:foldl(fun ("0", {N, []}) ->
- {N+1, []};
- (IStr, {N, Is}) ->
- {N+1,
- [list_to_integer(IStr)|Is]}
- end,
- {0, []},
- NumStrList),
- ?line {ref, node(Ref), Len, lists:reverse(RevNumList)};
+ ["#Ref", _NodeStr | NumStrList]
+ = string:tokens(erlang:ref_to_list(Ref), "<.>"),
+ {Len, RevNumList} = lists:foldl(fun ("0", {N, []}) ->
+ {N+1, []};
+ (IStr, {N, Is}) ->
+ {N+1,
+ [list_to_integer(IStr)|Is]}
+ end,
+ {0, []},
+ NumStrList),
+ {ref, node(Ref), Len, lists:reverse(RevNumList)};
nc2vinfo(Other) ->
- ?line {badarg, Other}.
-
-
+ {badarg, Other}.
diff --git a/lib/erl_interface/test/erl_ext_SUITE.erl b/lib/erl_interface/test/erl_ext_SUITE.erl
index cbc93b4cfb..9b2f3d3017 100644
--- a/lib/erl_interface/test/erl_ext_SUITE.erl
+++ b/lib/erl_interface/test/erl_ext_SUITE.erl
@@ -24,74 +24,44 @@
-include_lib("common_test/include/ct.hrl").
-include("erl_ext_SUITE_data/ext_test_cases.hrl").
--export([
- all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- compare_tuple/1,
- compare_list/1,
- compare_string/1,
- compare_list_string/1,
- compare_nc_ext/1
- ]).
+-export([all/0, suite/0,
+ compare_tuple/1,
+ compare_list/1,
+ compare_string/1,
+ compare_list_string/1,
+ compare_nc_ext/1]).
-import(runner, [get_term/1]).
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[compare_tuple, compare_list, compare_string,
compare_list_string, compare_nc_ext].
-groups() ->
- [].
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
-compare_tuple(suite) -> [];
-compare_tuple(doc) -> [];
compare_tuple(Config) when is_list(Config) ->
- ?line P = runner:start(?compare_tuple),
- ?line runner:recv_eot(P),
+ P = runner:start(?compare_tuple),
+ runner:recv_eot(P),
ok.
-compare_list(suite) -> [];
-compare_list(doc) -> [];
compare_list(Config) when is_list(Config) ->
- ?line P = runner:start(?compare_list),
- ?line runner:recv_eot(P),
+ P = runner:start(?compare_list),
+ runner:recv_eot(P),
ok.
-compare_string(suite) -> [];
-compare_string(doc) -> [];
compare_string(Config) when is_list(Config) ->
- ?line P = runner:start(?compare_string),
- ?line runner:recv_eot(P),
+ P = runner:start(?compare_string),
+ runner:recv_eot(P),
ok.
-compare_list_string(suite) -> [];
-compare_list_string(doc) -> [];
compare_list_string(Config) when is_list(Config) ->
- ?line P = runner:start(?compare_list_string),
- ?line runner:recv_eot(P),
+ P = runner:start(?compare_list_string),
+ runner:recv_eot(P),
ok.
-compare_nc_ext(suite) -> [];
-compare_nc_ext(doc) -> [];
compare_nc_ext(Config) when is_list(Config) ->
- ?line P = runner:start(?compare_nc_ext),
- ?line runner:recv_eot(P),
+ P = runner:start(?compare_nc_ext),
+ runner:recv_eot(P),
ok.
-
-
-
diff --git a/lib/erl_interface/test/erl_format_SUITE.erl b/lib/erl_interface/test/erl_format_SUITE.erl
index afbbe6a241..32b0571f5e 100644
--- a/lib/erl_interface/test/erl_format_SUITE.erl
+++ b/lib/erl_interface/test/erl_format_SUITE.erl
@@ -24,134 +24,108 @@
-include_lib("common_test/include/ct.hrl").
-include("erl_format_SUITE_data/format_test_cases.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2, atoms/1, tuples/1, lists/1]).
+-export([all/0, suite/0,
+ atoms/1, tuples/1, lists/1]).
-import(runner, [get_term/1]).
%% This test suite test the erl_format() function.
%% It uses the port program "format_test".
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[atoms, tuples, lists].
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
%% Tests formatting various atoms.
-atoms(suite) -> [];
atoms(Config) when is_list(Config) ->
- ?line P = runner:start(?atoms),
-
- ?line {term, ''} = get_term(P),
- ?line {term, 'a'} = get_term(P),
- ?line {term, 'A'} = get_term(P),
- ?line {term, 'abc'} = get_term(P),
- ?line {term, 'Abc'} = get_term(P),
- ?line {term, 'ab@c'} = get_term(P),
- ?line {term, 'The rain in Spain stays mainly in the plains'} =
- get_term(P),
-
- ?line {term, a} = get_term(P),
- ?line {term, ab} = get_term(P),
- ?line {term, abc} = get_term(P),
- ?line {term, ab@c} = get_term(P),
- ?line {term, abcdefghijklmnopq} = get_term(P),
-
- ?line {term, ''} = get_term(P),
- ?line {term, 'a'} = get_term(P),
- ?line {term, 'A'} = get_term(P),
- ?line {term, 'abc'} = get_term(P),
- ?line {term, 'Abc'} = get_term(P),
- ?line {term, 'ab@c'} = get_term(P),
- ?line {term, 'The rain in Spain stays mainly in the plains'} =
- get_term(P),
-
- ?line {term, a} = get_term(P),
- ?line {term, ab} = get_term(P),
- ?line {term, abc} = get_term(P),
- ?line {term, ab@c} = get_term(P),
- ?line {term, ' abcdefghijklmnopq '} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?atoms),
+
+ {term, ''} = get_term(P),
+ {term, 'a'} = get_term(P),
+ {term, 'A'} = get_term(P),
+ {term, 'abc'} = get_term(P),
+ {term, 'Abc'} = get_term(P),
+ {term, 'ab@c'} = get_term(P),
+ {term, 'The rain in Spain stays mainly in the plains'} = get_term(P),
+
+ {term, a} = get_term(P),
+ {term, ab} = get_term(P),
+ {term, abc} = get_term(P),
+ {term, ab@c} = get_term(P),
+ {term, abcdefghijklmnopq} = get_term(P),
+
+ {term, ''} = get_term(P),
+ {term, 'a'} = get_term(P),
+ {term, 'A'} = get_term(P),
+ {term, 'abc'} = get_term(P),
+ {term, 'Abc'} = get_term(P),
+ {term, 'ab@c'} = get_term(P),
+ {term, 'The rain in Spain stays mainly in the plains'} = get_term(P),
+
+ {term, a} = get_term(P),
+ {term, ab} = get_term(P),
+ {term, abc} = get_term(P),
+ {term, ab@c} = get_term(P),
+ {term, ' abcdefghijklmnopq '} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Tests formatting various tuples
-tuples(suite) -> [];
tuples(Config) when is_list(Config) ->
- ?line P = runner:start(?tuples),
-
- ?line {term, {}} = get_term(P),
- ?line {term, {a}} = get_term(P),
- ?line {term, {a, b}} = get_term(P),
- ?line {term, {a, b, c}} = get_term(P),
- ?line {term, {1}} = get_term(P),
- ?line {term, {[]}} = get_term(P),
- ?line {term, {[], []}} = get_term(P),
- ?line {term, {[], a, b, c}} = get_term(P),
- ?line {term, {[], a, [], b, c}} = get_term(P),
- ?line {term, {[], a, '', b, c}} = get_term(P),
-
- ?line runner:recv_eot(P),
+ P = runner:start(?tuples),
+
+ {term, {}} = get_term(P),
+ {term, {a}} = get_term(P),
+ {term, {a, b}} = get_term(P),
+ {term, {a, b, c}} = get_term(P),
+ {term, {1}} = get_term(P),
+ {term, {[]}} = get_term(P),
+ {term, {[], []}} = get_term(P),
+ {term, {[], a, b, c}} = get_term(P),
+ {term, {[], a, [], b, c}} = get_term(P),
+ {term, {[], a, '', b, c}} = get_term(P),
+
+ runner:recv_eot(P),
ok.
%% Tests formatting various lists
-lists(suite) -> [];
lists(Config) when is_list(Config) ->
- ?line P = runner:start(?lists),
-
- ?line {term, []} = get_term(P),
- ?line {term, [a]} = get_term(P),
- ?line {term, [a, b]} = get_term(P),
- ?line {term, [a, b, c]} = get_term(P),
- ?line {term, [1]} = get_term(P),
- ?line {term, [[]]} = get_term(P),
- ?line {term, [[], []]} = get_term(P),
- ?line {term, [[], a, b, c]} = get_term(P),
- ?line {term, [[], a, [], b, c]} = get_term(P),
- ?line {term, [[], a, '', b, c]} = get_term(P),
-
- ?line {term, [{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]} =
- get_term(P),
+ P = runner:start(?lists),
+
+ {term, []} = get_term(P),
+ {term, [a]} = get_term(P),
+ {term, [a, b]} = get_term(P),
+ {term, [a, b, c]} = get_term(P),
+ {term, [1]} = get_term(P),
+ {term, [[]]} = get_term(P),
+ {term, [[], []]} = get_term(P),
+ {term, [[], a, b, c]} = get_term(P),
+ {term, [[], a, [], b, c]} = get_term(P),
+ {term, [[], a, '', b, c]} = get_term(P),
+
+ {term, [{name, 'Madonna'}, {age, 21}, {data, [{addr, "E-street", 42}]}]} = get_term(P),
case os:type() of
- vxworks ->
- ?line {term, [{pi, _}, {'cos(70)', _}]} = get_term(P),
- ?line {term, [[pi, _], ['cos(70)', _]]} = get_term(P),
- ?line {term, [[pi, _], [], ["cos(70)", _]]} =
- get_term(P);
- _ ->
- ?line {term, [{pi, 3.1415}, {'cos(70)', 0.34202}]} = get_term(P),
- ?line {term, [[pi, 3.1415], ['cos(70)', 0.34202]]} = get_term(P),
- ?line {term, [[pi, 3.1415], [], ["cos(70)", 0.34202]]} =
- get_term(P)
+ vxworks ->
+ {term, [{pi, _}, {'cos(70)', _}]} = get_term(P),
+ {term, [[pi, _], ['cos(70)', _]]} = get_term(P),
+ {term, [[pi, _], [], ["cos(70)", _]]} = get_term(P);
+ _ ->
+ {term, [{pi, 3.1415}, {'cos(70)', 0.34202}]} = get_term(P),
+ {term, [[pi, 3.1415], ['cos(70)', 0.34202]]} = get_term(P),
+ {term, [[pi, 3.1415], [], ["cos(70)", 0.34202]]} = get_term(P)
end,
- ?line {term, [-1]} = get_term(P),
+ {term, [-1]} = get_term(P),
- ?line runner:recv_eot(P),
+ runner:recv_eot(P),
ok.
-
-
-
diff --git a/lib/erl_interface/test/erl_global_SUITE.erl b/lib/erl_interface/test/erl_global_SUITE.erl
index 493ad576c9..cf0ec80f66 100644
--- a/lib/erl_interface/test/erl_global_SUITE.erl
+++ b/lib/erl_interface/test/erl_global_SUITE.erl
@@ -24,9 +24,9 @@
-include_lib("common_test/include/ct.hrl").
-include("erl_global_SUITE_data/erl_global_test_cases.hrl").
--export([all/0,suite/0,init_per_suite/1,end_per_suite/1,
- init_per_testcase/2,end_per_testcase/2,
- erl_global_registration/1, erl_global_whereis/1, erl_global_names/1]).
+-export([all/0,suite/0,
+ erl_global_registration/1,
+ erl_global_whereis/1, erl_global_names/1]).
-import(runner, [get_term/1,send_term/2]).
@@ -35,62 +35,50 @@
all() ->
[erl_global_registration, erl_global_whereis, erl_global_names].
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {seconds, 30}}].
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_testcase(_Case, Config) ->
- Dog = ?t:timetrap(?t:minutes(0.25)),
- [{watchdog, Dog}|Config].
-
-end_per_testcase(_Case, Config) ->
- Dog = ?config(watchdog, Config),
- test_server:timetrap_cancel(Dog),
- ok.
erl_global_registration(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0),
+ P = runner:start(?interpret),
+ {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0),
- ?line ok = erl_global_register(P, Fd, ?GLOBAL_NAME),
- ?line ok = erl_global_unregister(P, Fd, ?GLOBAL_NAME),
+ ok = erl_global_register(P, Fd, ?GLOBAL_NAME),
+ ok = erl_global_unregister(P, Fd, ?GLOBAL_NAME),
- ?line 0 = erl_close_connection(P,Fd),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ 0 = erl_close_connection(P,Fd),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
erl_global_whereis(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0),
-
- ?line Self = self(),
- ?line yes = global:register_name(?GLOBAL_NAME, Self),
- ?line Self = erl_global_whereis(P, Fd, ?GLOBAL_NAME),
- ?line global:unregister_name(?GLOBAL_NAME),
- ?line 0 = erl_close_connection(P, Fd),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ P = runner:start(?interpret),
+ {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0),
+
+ Self = self(),
+ yes = global:register_name(?GLOBAL_NAME, Self),
+ Self = erl_global_whereis(P, Fd, ?GLOBAL_NAME),
+ global:unregister_name(?GLOBAL_NAME),
+ 0 = erl_close_connection(P, Fd),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
erl_global_names(Config) when is_list(Config) ->
- ?line P = runner:start(?interpret),
- ?line {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0),
-
- ?line Self = self(),
- ?line global:register_name(?GLOBAL_NAME, Self),
- ?line {Names1, _N1} = erl_global_names(P, Fd),
- ?line true = lists:member(atom_to_list(?GLOBAL_NAME), Names1),
- ?line global:unregister_name(?GLOBAL_NAME),
- ?line {Names2, _N2} = erl_global_names(P, Fd),
- ?line false = lists:member(atom_to_list(?GLOBAL_NAME), Names2),
- ?line 0 = erl_close_connection(P, Fd),
- ?line runner:send_eot(P),
- ?line runner:recv_eot(P),
+ P = runner:start(?interpret),
+ {ok, Fd} = erl_connect(P, node(), 42, erlang:get_cookie(), 0),
+
+ Self = self(),
+ global:register_name(?GLOBAL_NAME, Self),
+ {Names1, _N1} = erl_global_names(P, Fd),
+ true = lists:member(atom_to_list(?GLOBAL_NAME), Names1),
+ global:unregister_name(?GLOBAL_NAME),
+ {Names2, _N2} = erl_global_names(P, Fd),
+ false = lists:member(atom_to_list(?GLOBAL_NAME), Names2),
+ 0 = erl_close_connection(P, Fd),
+ runner:send_eot(P),
+ runner:recv_eot(P),
ok.
%%% Interface functions for erl_interface functions.
@@ -98,14 +86,14 @@ erl_global_names(Config) when is_list(Config) ->
erl_connect(P, Node, Num, Cookie, Creation) ->
send_command(P, erl_connect, [Num, Node, Cookie, Creation]),
case get_term(P) of
- {term,{Fd,_}} when Fd >= 0 -> {ok,Fd};
- {term,{-1,Errno}} -> {error,Errno}
+ {term,{Fd,_}} when Fd >= 0 -> {ok,Fd};
+ {term,{-1,Errno}} -> {error,Errno}
end.
erl_close_connection(P, FD) ->
send_command(P, erl_close_connection, [FD]),
case get_term(P) of
- {term,Int} when is_integer(Int) -> Int
+ {term,Int} when is_integer(Int) -> Int
end.
erl_global_register(P, Fd, Name) ->
@@ -115,15 +103,15 @@ erl_global_register(P, Fd, Name) ->
erl_global_whereis(P, Fd, Name) ->
send_command(P, erl_global_whereis, [Fd,Name]),
case get_term(P) of
- {term, What} ->
- What
+ {term, What} ->
+ What
end.
erl_global_names(P, Fd) ->
send_command(P, erl_global_names, [Fd]),
case get_term(P) of
- {term, What} ->
- What
+ {term, What} ->
+ What
end.
erl_global_unregister(P, Fd, Name) ->
@@ -132,11 +120,11 @@ erl_global_unregister(P, Fd, Name) ->
get_send_result(P) ->
case get_term(P) of
- {term,{1,_}} -> ok;
- {term,{0, 0}} -> ok;
- {term,{-1, Errno}} -> {error,Errno};
- {term,{_,_}}->
- ?t:fail(bad_return_value)
+ {term,{1,_}} -> ok;
+ {term,{0, 0}} -> ok;
+ {term,{-1, Errno}} -> {error,Errno};
+ {term,{_,_}}->
+ ct:fail(bad_return_value)
end.
send_command(P, Name, Args) ->
diff --git a/lib/erl_interface/test/erl_match_SUITE.erl b/lib/erl_interface/test/erl_match_SUITE.erl
index ecdebad212..5a40c19e3b 100644
--- a/lib/erl_interface/test/erl_match_SUITE.erl
+++ b/lib/erl_interface/test/erl_match_SUITE.erl
@@ -24,246 +24,218 @@
-include_lib("common_test/include/ct.hrl").
-include("erl_match_SUITE_data/match_test_cases.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- atoms/1, lists/1, tuples/1, references/1, pids/1, ports/1,
- bind/1, integers/1, floats/1, binaries/1, strings/1]).
+-export([all/0, suite/0,
+ atoms/1, lists/1, tuples/1, references/1, pids/1, ports/1,
+ bind/1, integers/1, floats/1, binaries/1, strings/1]).
%% For interactive running of matcher.
-export([start_matcher/1, erl_match/3]).
%% This test suite tests the erl_match() function.
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
all() ->
[atoms, lists, tuples, references, pids, ports, bind,
integers, floats, binaries, strings].
-groups() ->
- [].
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-
-atoms(suite) -> [];
atoms(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
+ P = start_matcher(Config),
- ?line eq(P, '', ''),
- ?line eq(P, a, a),
- ?line ne(P, a, b),
- ?line ne(P, a, aa),
- ?line eq(P, kalle, kalle),
- ?line ne(P, kalle, arne),
+ eq(P, '', ''),
+ eq(P, a, a),
+ ne(P, a, b),
+ ne(P, a, aa),
+ eq(P, kalle, kalle),
+ ne(P, kalle, arne),
- ?line ne(P, kalle, 42),
- ?line ne(P, 42, kalle),
+ ne(P, kalle, 42),
+ ne(P, 42, kalle),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
-lists(suite) -> [];
lists(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line eq(P, [], []),
+ P = start_matcher(Config),
+ eq(P, [], []),
- ?line ne(P, [], [a]),
- ?line ne(P, [a], []),
+ ne(P, [], [a]),
+ ne(P, [a], []),
- ?line eq(P, [a], [a]),
- ?line ne(P, [a], [b]),
+ eq(P, [a], [a]),
+ ne(P, [a], [b]),
- ?line eq(P, [a|b], [a|b]),
- ?line ne(P, [a|b], [a|x]),
+ eq(P, [a|b], [a|b]),
+ ne(P, [a|b], [a|x]),
- ?line eq(P, [a, b], [a, b]),
- ?line ne(P, [a, b], [a, x]),
+ eq(P, [a, b], [a, b]),
+ ne(P, [a, b], [a, x]),
- ?line eq(P, [a, b, c], [a, b, c]),
- ?line ne(P, [a, b|c], [a, b|x]),
- ?line ne(P, [a, b, c], [a, b, x]),
- ?line ne(P, [a, b|c], [a, b|x]),
- ?line ne(P, [a, x|c], [a, b|c]),
- ?line ne(P, [a, b, c], [a, x, c]),
+ eq(P, [a, b, c], [a, b, c]),
+ ne(P, [a, b|c], [a, b|x]),
+ ne(P, [a, b, c], [a, b, x]),
+ ne(P, [a, b|c], [a, b|x]),
+ ne(P, [a, x|c], [a, b|c]),
+ ne(P, [a, b, c], [a, x, c]),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
-tuples(suite) -> [];
tuples(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
+ P = start_matcher(Config),
- ?line ne(P, {}, {a, b}),
- ?line ne(P, {a, b}, {}),
- ?line ne(P, {a}, {a, b}),
- ?line ne(P, {a, b}, {a}),
+ ne(P, {}, {a, b}),
+ ne(P, {a, b}, {}),
+ ne(P, {a}, {a, b}),
+ ne(P, {a, b}, {a}),
- ?line eq(P, {}, {}),
+ eq(P, {}, {}),
- ?line eq(P, {a}, {a}),
- ?line ne(P, {a}, {b}),
+ eq(P, {a}, {a}),
+ ne(P, {a}, {b}),
- ?line eq(P, {1}, {1}),
- ?line ne(P, {1}, {2}),
+ eq(P, {1}, {1}),
+ ne(P, {1}, {2}),
- ?line eq(P, {a, b}, {a, b}),
- ?line ne(P, {x, b}, {a, b}),
+ eq(P, {a, b}, {a, b}),
+ ne(P, {x, b}, {a, b}),
- ?line ne(P, {error, x}, {error, y}),
- ?line ne(P, {error, {undefined, {subscriber, last}}},
- {error, {undefined, {subscriber, name}}}),
+ ne(P, {error, x}, {error, y}),
+ ne(P, {error, {undefined, {subscriber, last}}},
+ {error, {undefined, {subscriber, name}}}),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
-references(suite) -> [];
references(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line Ref1 = make_ref(),
- ?line Ref2 = make_ref(),
-
- ?line eq(P, Ref1, Ref1),
- ?line eq(P, Ref2, Ref2),
- ?line ne(P, Ref1, Ref2),
- ?line ne(P, Ref2, Ref1),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ Ref1 = make_ref(),
+ Ref2 = make_ref(),
+
+ eq(P, Ref1, Ref1),
+ eq(P, Ref2, Ref2),
+ ne(P, Ref1, Ref2),
+ ne(P, Ref2, Ref1),
+
+ runner:finish(P),
ok.
-pids(suite) -> [];
pids(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line Pid1 = c:pid(0,1,2),
- ?line Pid2 = c:pid(0,1,3),
-
- ?line eq(P, self(), self()),
- ?line eq(P, Pid1, Pid1),
- ?line ne(P, Pid1, self()),
- ?line ne(P, Pid2, Pid1),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ Pid1 = c:pid(0,1,2),
+ Pid2 = c:pid(0,1,3),
+
+ eq(P, self(), self()),
+ eq(P, Pid1, Pid1),
+ ne(P, Pid1, self()),
+ ne(P, Pid2, Pid1),
+
+ runner:finish(P),
ok.
-ports(suite) -> [];
ports(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skipped,"not on vxworks, pucko"};
- _ ->
- ?line P = start_matcher(Config),
- ?line P2 = start_matcher(Config),
-
- ?line eq(P, P, P),
- ?line ne(P, P, P2),
-
- ?line runner:finish(P),
- ?line runner:finish(P2),
- ok
+ vxworks ->
+ {skipped,"not on vxworks, pucko"};
+ _ ->
+ P = start_matcher(Config),
+ P2 = start_matcher(Config),
+
+ eq(P, P, P),
+ ne(P, P, P2),
+
+ runner:finish(P),
+ runner:finish(P2),
+ ok
end.
-integers(suite) -> [];
integers(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line I1 = 123,
- ?line I2 = 12345,
- ?line I3 = -123,
- ?line I4 = 2234,
-
- ?line eq(P, I1, I1),
- ?line eq(P, I2, I2),
- ?line ne(P, I1, I2),
- ?line ne(P, I1, I3),
- ?line eq(P, I4, I4),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ I1 = 123,
+ I2 = 12345,
+ I3 = -123,
+ I4 = 2234,
+
+ eq(P, I1, I1),
+ eq(P, I2, I2),
+ ne(P, I1, I2),
+ ne(P, I1, I3),
+ eq(P, I4, I4),
+
+ runner:finish(P),
ok.
-floats(suite) -> [];
floats(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line F1 = 3.1414,
- ?line F2 = 3.1415,
- ?line F3 = 3.1416,
-
- ?line S1 = "string",
- ?line S2 = "string2",
-
- ?line eq(P, F1, F1),
- ?line eq(P, F2, F2),
- ?line ne(P, F1, F2),
- ?line ne(P, F3, F2),
-
- ?line eq(P, S2, S2),
- ?line ne(P, S1, S2),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ F1 = 3.1414,
+ F2 = 3.1415,
+ F3 = 3.1416,
+
+ S1 = "string",
+ S2 = "string2",
+
+ eq(P, F1, F1),
+ eq(P, F2, F2),
+ ne(P, F1, F2),
+ ne(P, F3, F2),
+
+ eq(P, S2, S2),
+ ne(P, S1, S2),
+
+ runner:finish(P),
ok.
-binaries(suite) -> [];
binaries(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line Bin1 = term_to_binary({kalle, 146015, {kungsgatan, 23}}),
- ?line Bin2 = term_to_binary(sune),
- ?line Bin3 = list_to_binary("sune"),
-
- ?line eq(P, Bin1, Bin1),
- ?line eq(P, Bin2, Bin2),
- ?line eq(P, Bin3, Bin3),
- ?line ne(P, Bin1, Bin2),
- ?line ne(P, Bin1, Bin3),
- ?line ne(P, Bin2, Bin3),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ Bin1 = term_to_binary({kalle, 146015, {kungsgatan, 23}}),
+ Bin2 = term_to_binary(sune),
+ Bin3 = list_to_binary("sune"),
+
+ eq(P, Bin1, Bin1),
+ eq(P, Bin2, Bin2),
+ eq(P, Bin3, Bin3),
+ ne(P, Bin1, Bin2),
+ ne(P, Bin1, Bin3),
+ ne(P, Bin2, Bin3),
+
+ runner:finish(P),
ok.
-
-strings(suite) -> [];
strings(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
+ P = start_matcher(Config),
- ?line S1 = "string",
- ?line S2 = "streng",
- ?line S3 = "String",
-
- ?line eq(P, S1, S1),
- ?line ne(P, S1, S2),
- ?line ne(P, S1, S3),
+ S1 = "string",
+ S2 = "streng",
+ S3 = "String",
- ?line runner:finish(P),
- ok.
+ eq(P, S1, S1),
+ ne(P, S1, S2),
+ ne(P, S1, S3),
+ runner:finish(P),
+ ok.
-bind(suite) -> [];
bind(Config) when is_list(Config) ->
- ?line P = start_bind(Config),
- ?line S = "[X,Y,Z]",
- ?line L1 = [301,302,302],
- ?line L2 = [65,66,67],
-
- ?line bind_ok(P, S, L1),
- ?line bind_ok(P, S, L2),
-
- ?line runner:finish(P),
+ P = start_bind(Config),
+ S = "[X,Y,Z]",
+ L1 = [301,302,302],
+ L2 = [65,66,67],
+
+ bind_ok(P, S, L1),
+ bind_ok(P, S, L2),
+
+ runner:finish(P),
ok.
start_bind(Config) ->
@@ -279,15 +251,12 @@ erl_bind(Port, Pattern, Term) ->
Port ! {self(), {command, [$b, Pattern, 0]}},
runner:send_term(Port, Term),
case runner:get_term(Port) of
- {term, 0} -> false;
- {term, 1} -> true
+ {term, 0} -> false;
+ {term, 1} -> true
end.
-
-
-
start_matcher(Config) ->
runner:start(?erl_match_server).
@@ -303,8 +272,6 @@ erl_match(Port, Pattern, Term) ->
runner:send_term(Port, Pattern),
runner:send_term(Port, Term),
case runner:get_term(Port) of
- {term, 0} -> false;
- {term, 1} -> true
+ {term, 0} -> false;
+ {term, 1} -> true
end.
-
-
diff --git a/lib/erl_interface/test/port_call_SUITE.erl b/lib/erl_interface/test/port_call_SUITE.erl
index 3bc1a03eab..26e1e0eeb4 100644
--- a/lib/erl_interface/test/port_call_SUITE.erl
+++ b/lib/erl_interface/test/port_call_SUITE.erl
@@ -32,96 +32,78 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2, basic/1]).
+-export([all/0, suite/0, basic/1]).
+
% Private exports
-include_lib("common_test/include/ct.hrl").
-
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap, {seconds, 10}}].
all() ->
-[basic].
-
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
+ [basic].
-basic(suite) -> [];
basic(Config) when is_list(Config) ->
case os:type() of
- {unix, linux} ->
- do_basic(Config);
- {unix, sunos} ->
- do_basic(Config);
- {win32,_} ->
- do_basic(Config);
- _ ->
- {skipped, "Dynamic linking and erl_interface not fully examined"
- " on this platform..."}
+ {unix, linux} ->
+ do_basic(Config);
+ {unix, sunos} ->
+ do_basic(Config);
+ {win32,_} ->
+ do_basic(Config);
+ _ ->
+ {skipped, "Dynamic linking and erl_interface not fully examined"
+ " on this platform..."}
end.
do_basic(Config) ->
- ?line Dog = test_server:timetrap(test_server:seconds(10)),
- ?line Path = ?config(data_dir, Config),
+ Path = proplists:get_value(data_dir, Config),
- ?line erl_ddll:start(),
+ erl_ddll:start(),
%% Load the echo driver and verify that it was loaded.
{ok,L1,L2}=load_port_call_driver(Path),
%% Verify that the driver works.
- ?line Port = open_port({spawn, port_call_drv}, [eof]),
- ?line {hej, "hopp",4711,123445567436543653} =
- erlang:port_call(Port,{hej, "hopp",4711,123445567436543653}),
- ?line {hej, "hopp",4711,123445567436543653} =
- erlang:port_call(Port,0,{hej, "hopp",4711,123445567436543653}),
- ?line {[], a, [], b, c} =
- erlang:port_call(Port,1,{hej, "hopp",4711,123445567436543653}),
- ?line {return, {[], a, [], b, c}} =
- erlang:port_call(Port,2,{[], a, [], b, c}),
- ?line List = lists:duplicate(200,5),
- ?line {return, List} = erlang:port_call(Port,2,List),
- ?line {'EXIT',{badarg,_}} = (catch erlang:port_call(Port,4711,[])),
- ?line {'EXIT',{badarg,_}} = (catch erlang:port_call(sune,2,[])),
- ?line register(gunnar,Port),
- ?line {return, List} = erlang:port_call(gunnar,2,List),
- ?line {return, a} = erlang:port_call(gunnar,2,a),
- ?line erlang:port_close(Port),
+ Port = open_port({spawn, port_call_drv}, [eof]),
+ {hej, "hopp",4711,123445567436543653} =
+ erlang:port_call(Port,{hej, "hopp",4711,123445567436543653}),
+ {hej, "hopp",4711,123445567436543653} =
+ erlang:port_call(Port,0,{hej, "hopp",4711,123445567436543653}),
+ {[], a, [], b, c} =
+ erlang:port_call(Port,1,{hej, "hopp",4711,123445567436543653}),
+ {return, {[], a, [], b, c}} =
+ erlang:port_call(Port,2,{[], a, [], b, c}),
+ List = lists:duplicate(200,5),
+ {return, List} = erlang:port_call(Port,2,List),
+ {'EXIT',{badarg,_}} = (catch erlang:port_call(Port,4711,[])),
+ {'EXIT',{badarg,_}} = (catch erlang:port_call(sune,2,[])),
+ register(gunnar,Port),
+ {return, List} = erlang:port_call(gunnar,2,List),
+ {return, a} = erlang:port_call(gunnar,2,a),
+ erlang:port_close(Port),
%% Unload the driver and verify that it was unloaded.
ok=unload_port_call_driver(L1,L2),
- ?line {error, {already_started, _}} = erl_ddll:start(),
- ?line ok = erl_ddll:stop(),
-
- ?line test_server:timetrap_cancel(Dog),
+ {error, {already_started, _}} = erl_ddll:start(),
+ ok = erl_ddll:stop(),
ok.
load_port_call_driver(Path) ->
- ?line {ok, L1} = erl_ddll:loaded_drivers(),
- ?line ok = erl_ddll:load_driver(Path, port_call_drv),
- ?line {ok, L2} = erl_ddll:loaded_drivers(),
- ?line ["port_call_drv"] = ordsets:to_list(ordsets:subtract(ordsets:from_list(L2),
- ordsets:from_list(L1))),
+ {ok, L1} = erl_ddll:loaded_drivers(),
+ ok = erl_ddll:load_driver(Path, port_call_drv),
+ {ok, L2} = erl_ddll:loaded_drivers(),
+ ["port_call_drv"] = ordsets:to_list(ordsets:subtract(ordsets:from_list(L2),
+ ordsets:from_list(L1))),
{ok,L1,L2}.
unload_port_call_driver(L1,L2) ->
- ?line {ok, L2} = erl_ddll:loaded_drivers(),
- ?line ok = erl_ddll:unload_driver(port_call_drv),
- ?line {ok, L3} = erl_ddll:loaded_drivers(),
- ?line [] = ordsets:to_list(ordsets:subtract(ordsets:from_list(L3),
- ordsets:from_list(L1))),
+ {ok, L2} = erl_ddll:loaded_drivers(),
+ ok = erl_ddll:unload_driver(port_call_drv),
+ {ok, L3} = erl_ddll:loaded_drivers(),
+ [] = ordsets:to_list(ordsets:subtract(ordsets:from_list(L3),
+ ordsets:from_list(L1))),
ok.
-
diff --git a/lib/erl_interface/test/runner.erl b/lib/erl_interface/test/runner.erl
index ae2598abf8..3854981ad1 100644
--- a/lib/erl_interface/test/runner.erl
+++ b/lib/erl_interface/test/runner.erl
@@ -25,7 +25,7 @@
start/1, send_term/2, finish/1, send_eot/1, recv_eot/1,
get_term/1, get_term/2]).
--define(default_timeout, test_server:seconds(5)).
+-define(default_timeout, 5000).
%% Executes a test case in a C program.
%%
@@ -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.