aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/test/port_call_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erl_interface/test/port_call_SUITE.erl')
-rw-r--r--lib/erl_interface/test/port_call_SUITE.erl110
1 files changed, 46 insertions, 64 deletions
diff --git a/lib/erl_interface/test/port_call_SUITE.erl b/lib/erl_interface/test/port_call_SUITE.erl
index 04b80de34a..fb10bd895f 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.
-