From 20ae6a9238d3fd09587bd3f4179a8ae25f1e3aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 10 Mar 2016 18:19:16 +0100 Subject: Remove ?line macros --- erts/emulator/test/busy_port_SUITE.erl | 544 ++++++++++++++++----------------- 1 file changed, 264 insertions(+), 280 deletions(-) (limited to 'erts/emulator/test/busy_port_SUITE.erl') diff --git a/erts/emulator/test/busy_port_SUITE.erl b/erts/emulator/test/busy_port_SUITE.erl index ce9fdfa10d..c582f8d77b 100644 --- a/erts/emulator/test/busy_port_SUITE.erl +++ b/erts/emulator/test/busy_port_SUITE.erl @@ -65,11 +65,11 @@ end_per_testcase(_Case, Config) when is_list(Config) -> io_to_busy(Config) when is_list(Config) -> ct:timetrap({seconds, 30}), - ?line start_busy_driver(Config), - ?line process_flag(trap_exit, true), - ?line Writer = fun_spawn(fun writer/0), - ?line Generator = fun_spawn(fun() -> generator(100, Writer) end), - ?line wait_for([Writer, Generator]), + start_busy_driver(Config), + process_flag(trap_exit, true), + Writer = fun_spawn(fun writer/0), + Generator = fun_spawn(fun() -> generator(100, Writer) end), + wait_for([Writer, Generator]), ok. generator(N, Writer) -> @@ -116,21 +116,21 @@ forget(_) -> message_order(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), - ?line start_busy_driver(Config), - ?line Self = self(), - ?line Busy = fun_spawn(fun () -> send_to_busy_1(Self) end), - ?line receive after 1000 -> ok end, - ?line Busy ! first, - ?line Busy ! second, - ?line receive after 1 -> ok end, - ?line unlock_slave(), - ?line Busy ! third, - ?line receive - {Busy, first} -> - ok; - Other -> - ct:fail({unexpected_message, Other}) - end, + start_busy_driver(Config), + Self = self(), + Busy = fun_spawn(fun () -> send_to_busy_1(Self) end), + receive after 1000 -> ok end, + Busy ! first, + Busy ! second, + receive after 1 -> ok end, + unlock_slave(), + Busy ! third, + receive + {Busy, first} -> + ok; + Other -> + ct:fail({unexpected_message, Other}) + end, ok. send_to_busy_1(Parent) -> @@ -147,59 +147,55 @@ send_to_busy_1(Parent) -> send_3(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), %% - ?line start_busy_driver(Config), - ?line {Owner,Slave} = get_slave(), - ?line ok = erlang:send(Slave, {Owner,{command,"set busy"}}, - [nosuspend]), + start_busy_driver(Config), + {Owner,Slave} = get_slave(), + ok = erlang:send(Slave, {Owner,{command,"set busy"}}, [nosuspend]), receive after 100 -> ok end, % ensure command reached port - ?line nosuspend = erlang:send(Slave, {Owner,{command,"busy"}}, - [nosuspend]), - ?line unlock_slave(), - ?line ok = erlang:send(Slave, {Owner,{command,"not busy"}}, - [nosuspend]), - ?line ok = command(stop), + nosuspend = erlang:send(Slave, {Owner,{command,"busy"}}, [nosuspend]), + unlock_slave(), + ok = erlang:send(Slave, {Owner,{command,"not busy"}}, [nosuspend]), + ok = command(stop), ok. %% Test the erlang:system_monitor(Pid, [busy_port]) system_monitor(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), - ?line Self = self(), + Self = self(), %% - ?line OldMonitor = erlang:system_monitor(Self, [busy_port]), - ?line {Self,[busy_port]} = erlang:system_monitor(), - ?line Void = make_ref(), - ?line start_busy_driver(Config), - ?line {Owner,Slave} = get_slave(), - ?line Master = command(get_master), - ?line Parent = self(), - ?line Busy = - spawn_link( - fun() -> - (catch port_command(Slave, "set busy")), - receive {Parent,alpha} -> ok end, - (catch port_command(Slave, "busy")), - (catch port_command(Slave, "free")), - Parent ! {self(),alpha}, - command(lock), - receive {Parent,beta} -> ok end, - command({port_command,"busy"}), - command({port_command,"free"}), - Parent ! {self(),beta} - end), - ?line Void = rec(Void), - ?line Busy ! {self(),alpha}, - ?line {monitor,Busy,busy_port,Slave} = rec(Void), - ?line unlock_slave(), - ?line {Busy,alpha} = rec(Void), - ?line Void = rec(Void), - ?line Busy ! {self(), beta}, - ?line {monitor,Owner,busy_port,Slave} = rec(Void), - ?line port_command(Master, "u"), - ?line {Busy,beta} = rec(Void), - ?line Void = rec(Void), - ?line _NewMonitor = erlang:system_monitor(OldMonitor), - ?line OldMonitor = erlang:system_monitor(), - ?line OldMonitor = erlang:system_monitor(OldMonitor), + OldMonitor = erlang:system_monitor(Self, [busy_port]), + {Self,[busy_port]} = erlang:system_monitor(), + Void = make_ref(), + start_busy_driver(Config), + {Owner,Slave} = get_slave(), + Master = command(get_master), + Parent = self(), + Busy = spawn_link( + fun() -> + (catch port_command(Slave, "set busy")), + receive {Parent,alpha} -> ok end, + (catch port_command(Slave, "busy")), + (catch port_command(Slave, "free")), + Parent ! {self(),alpha}, + command(lock), + receive {Parent,beta} -> ok end, + command({port_command,"busy"}), + command({port_command,"free"}), + Parent ! {self(),beta} + end), + Void = rec(Void), + Busy ! {self(),alpha}, + {monitor,Busy,busy_port,Slave} = rec(Void), + unlock_slave(), + {Busy,alpha} = rec(Void), + Void = rec(Void), + Busy ! {self(), beta}, + {monitor,Owner,busy_port,Slave} = rec(Void), + port_command(Master, "u"), + {Busy,beta} = rec(Void), + Void = rec(Void), + _NewMonitor = erlang:system_monitor(OldMonitor), + OldMonitor = erlang:system_monitor(), + OldMonitor = erlang:system_monitor(OldMonitor), ok. rec(Tag) -> @@ -218,22 +214,21 @@ rec(Tag) -> no_trap_exit(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), - ?line process_flag(trap_exit, true), - ?line Pid = fun_spawn(fun no_trap_exit_process/3, - [self(), linked, Config]), - ?line receive - {Pid, port_created, Port} -> - io:format("Process ~w created port ~w", [Pid, Port]), - ?line exit(Port, die); - Other1 -> - ct:fail({unexpected_message, Other1}) - end, - ?line receive - {'EXIT', Pid, die} -> - ok; - Other2 -> - ct:fail({unexpected_message, Other2}) - end, + process_flag(trap_exit, true), + Pid = fun_spawn(fun no_trap_exit_process/3, [self(), linked, Config]), + receive + {Pid, port_created, Port} -> + io:format("Process ~w created port ~w", [Pid, Port]), + exit(Port, die); + Other1 -> + ct:fail({unexpected_message, Other1}) + end, + receive + {'EXIT', Pid, die} -> + ok; + Other2 -> + ct:fail({unexpected_message, Other2}) + end, ok. %% The same scenario as above, but the port has been explicitly @@ -241,35 +236,35 @@ no_trap_exit(Config) when is_list(Config) -> no_trap_exit_unlinked(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), - ?line process_flag(trap_exit, true), - ?line Pid = fun_spawn(fun no_trap_exit_process/3, - [self(), unlink, Config]), - ?line receive - {Pid, port_created, Port} -> - io:format("Process ~w created port ~w", [Pid, Port]), - ?line exit(Port, die); - Other1 -> - ct:fail({unexpected_message, Other1}) - end, - ?line receive - {'EXIT', Pid, normal} -> - ok; - Other2 -> - ct:fail({unexpected_message, Other2}) - end, + process_flag(trap_exit, true), + Pid = fun_spawn(fun no_trap_exit_process/3, + [self(), unlink, Config]), + receive + {Pid, port_created, Port} -> + io:format("Process ~w created port ~w", [Pid, Port]), + exit(Port, die); + Other1 -> + ct:fail({unexpected_message, Other1}) + end, + receive + {'EXIT', Pid, normal} -> + ok; + Other2 -> + ct:fail({unexpected_message, Other2}) + end, ok. no_trap_exit_process(ResultTo, Link, Config) -> - ?line load_busy_driver(Config), - ?line _Master = open_port({spawn, "busy_drv master"}, [eof]), - ?line Slave = open_port({spawn, "busy_drv slave"}, [eof]), - ?line case Link of - linked -> ok; - unlink -> unlink(Slave) - end, - ?line (catch port_command(Slave, "lock port")), - ?line ResultTo ! {self(), port_created, Slave}, - ?line (catch port_command(Slave, "suspend me")), + load_busy_driver(Config), + _Master = open_port({spawn, "busy_drv master"}, [eof]), + Slave = open_port({spawn, "busy_drv slave"}, [eof]), + case Link of + linked -> ok; + unlink -> unlink(Slave) + end, + (catch port_command(Slave, "lock port")), + ResultTo ! {self(), port_created, Slave}, + (catch port_command(Slave, "suspend me")), ok. %% Assuming the following scenario, @@ -285,17 +280,17 @@ no_trap_exit_process(ResultTo, Link, Config) -> trap_exit(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), - ?line Pid = fun_spawn(fun busy_port_exit_process/2, [self(), Config]), - ?line receive + Pid = fun_spawn(fun busy_port_exit_process/2, [self(), Config]), + receive {Pid, port_created, Port} -> io:format("Process ~w created port ~w", [Pid, Port]), - ?line unlink(Pid), - ?line {status, suspended} = process_info(Pid, status), - ?line exit(Port, die); + unlink(Pid), + {status, suspended} = process_info(Pid, status), + exit(Port, die); Other1 -> ct:fail({unexpected_message, Other1}) end, - ?line receive + receive {Pid, ok} -> ok; Other2 -> @@ -304,13 +299,13 @@ trap_exit(Config) when is_list(Config) -> ok. busy_port_exit_process(ResultTo, Config) -> - ?line process_flag(trap_exit, true), - ?line load_busy_driver(Config), - ?line _Master = open_port({spawn, "busy_drv master"}, [eof]), - ?line Slave = open_port({spawn, "busy_drv slave"}, [eof]), - ?line (catch port_command(Slave, "lock port")), - ?line ResultTo ! {self(), port_created, Slave}, - ?line (catch port_command(Slave, "suspend me")), + process_flag(trap_exit, true), + load_busy_driver(Config), + _Master = open_port({spawn, "busy_drv master"}, [eof]), + Slave = open_port({spawn, "busy_drv slave"}, [eof]), + (catch port_command(Slave, "lock port")), + ResultTo ! {self(), port_created, Slave}, + (catch port_command(Slave, "suspend me")), receive {'EXIT', Slave, die} -> ResultTo ! {self(), ok}; @@ -325,16 +320,16 @@ busy_port_exit_process(ResultTo, Config) -> multiple_writers(Config) when is_list(Config) -> ct:timetrap({seconds, 10}), - ?line start_busy_driver(Config), - ?line process_flag(trap_exit, true), + start_busy_driver(Config), + process_flag(trap_exit, true), %% Start the waiters and make sure they have blocked. - ?line W1 = fun_spawn(fun quick_writer/0), - ?line W2 = fun_spawn(fun quick_writer/0), - ?line W3 = fun_spawn(fun quick_writer/0), - ?line W4 = fun_spawn(fun quick_writer/0), - ?line W5 = fun_spawn(fun quick_writer/0), - ?line test_server:sleep(500), % Make sure writers have blocked. + W1 = fun_spawn(fun quick_writer/0), + W2 = fun_spawn(fun quick_writer/0), + W3 = fun_spawn(fun quick_writer/0), + W4 = fun_spawn(fun quick_writer/0), + W5 = fun_spawn(fun quick_writer/0), + test_server:sleep(500), % Make sure writers have blocked. %% Kill two of the processes. exit(W1, kill), @@ -343,8 +338,8 @@ multiple_writers(Config) when is_list(Config) -> receive {'EXIT', W3, killed} -> ok end, %% Unlock the port. The surviving processes should be become runnable. - ?line unlock_slave(), - ?line wait_for([W2, W4, W5]), + unlock_slave(), + wait_for([W2, W4, W5]), ok. quick_writer() -> @@ -360,199 +355,188 @@ soft_busy_driver(Config) when is_list(Config) -> hs_test(Config, false). hs_test(Config, HardBusy) when is_list(Config) -> - ?line DrvName = case HardBusy of - true -> 'hard_busy_drv'; - false -> 'soft_busy_drv' - end, - ?line erl_ddll:start(), - ?line Path = proplists:get_value(data_dir, Config), + DrvName = case HardBusy of + true -> 'hard_busy_drv'; + false -> 'soft_busy_drv' + end, + erl_ddll:start(), + Path = proplists:get_value(data_dir, Config), case erl_ddll:load_driver(Path, DrvName) of - ok -> ok; - {error, Error} -> + ok -> ok; + {error, Error} -> ct:fail(erl_ddll:format_error(Error)) end, - ?line Port = open_port({spawn, DrvName}, []), - + Port = open_port({spawn, DrvName}, []), + NotSuspended = fun (Proc) -> - chk_not_value({status,suspended}, - process_info(Proc, status)) - end, + chk_not_value({status,suspended}, + process_info(Proc, status)) + end, NotBusyEnd = fun (Proc, Res, Time) -> - receive - {Port, caller, Proc} -> ok - after - 500 -> exit(missing_caller_message) - end, - chk_value({return, true}, Res), - chk_range(0, Time, 100) - end, + receive + {Port, caller, Proc} -> ok + after + 500 -> exit(missing_caller_message) + end, + chk_value({return, true}, Res), + chk_range(0, Time, 100) + end, ForceEnd = fun (Proc, Res, Time) -> - case HardBusy of - false -> - NotBusyEnd(Proc, Res, Time); - true -> - chk_value({error, notsup}, Res), - chk_range(0, Time, 100), - receive - Msg -> exit({unexpected_msg, Msg}) - after - 500 -> ok - end - end - end, + case HardBusy of + false -> + NotBusyEnd(Proc, Res, Time); + true -> + chk_value({error, notsup}, Res), + chk_range(0, Time, 100), + receive + Msg -> exit({unexpected_msg, Msg}) + after + 500 -> ok + end + end + end, BadArg = fun (_Proc, Res, Time) -> - chk_value({error, badarg}, Res), - chk_range(0, Time, 100) - end, + chk_value({error, badarg}, Res), + chk_range(0, Time, 100) + end, %% Not busy %% Not busy; nosuspend option - ?line hs_busy_pcmd(Port, [nosuspend], NotSuspended, NotBusyEnd), + hs_busy_pcmd(Port, [nosuspend], NotSuspended, NotBusyEnd), %% Not busy; force option - ?line hs_busy_pcmd(Port, [force], NotSuspended, ForceEnd), + hs_busy_pcmd(Port, [force], NotSuspended, ForceEnd), %% Not busy; force and nosuspend option - ?line hs_busy_pcmd(Port, [force, nosuspend], NotSuspended, ForceEnd), + hs_busy_pcmd(Port, [force, nosuspend], NotSuspended, ForceEnd), %% Not busy; no option - ?line hs_busy_pcmd(Port, [], NotSuspended, NotBusyEnd), + hs_busy_pcmd(Port, [], NotSuspended, NotBusyEnd), %% Not busy; bad option - ?line hs_busy_pcmd(Port, [bad_option], NotSuspended, BadArg), + hs_busy_pcmd(Port, [bad_option], NotSuspended, BadArg), %% Make busy - ?line erlang:port_control(Port, $B, []), + erlang:port_control(Port, $B, []), %% Busy; nosuspend option - ?line hs_busy_pcmd(Port, [nosuspend], NotSuspended, - fun (_Proc, Res, Time) -> - chk_value({return, false}, Res), - chk_range(0, Time, 100), - receive - Msg -> exit({unexpected_msg, Msg}) - after - 500 -> ok - end - end), + hs_busy_pcmd(Port, [nosuspend], NotSuspended, + fun (_Proc, Res, Time) -> + chk_value({return, false}, Res), + chk_range(0, Time, 100), + receive + Msg -> exit({unexpected_msg, Msg}) + after + 500 -> ok + end + end), %% Busy; force option - ?line hs_busy_pcmd(Port, [force], NotSuspended, ForceEnd), + hs_busy_pcmd(Port, [force], NotSuspended, ForceEnd), %% Busy; force and nosuspend option - ?line hs_busy_pcmd(Port, [force, nosuspend], NotSuspended, ForceEnd), + hs_busy_pcmd(Port, [force, nosuspend], NotSuspended, ForceEnd), %% Busy; bad option - ?line hs_busy_pcmd(Port, [bad_option], NotSuspended, BadArg), + hs_busy_pcmd(Port, [bad_option], NotSuspended, BadArg), %% no option on busy port - ?line hs_busy_pcmd(Port, [], - fun (Proc) -> - receive after 1000 -> ok end, - chk_value({status,suspended}, - process_info(Proc, status)), - - %% Make not busy - erlang:port_control(Port, $N, []) - end, - fun (_Proc, Res, Time) -> - chk_value({return, true}, Res), - chk_range(1000, Time, 2000) - end), - - ?line true = erlang:port_close(Port), - ?line ok = erl_ddll:unload_driver(DrvName), - ?line ok = erl_ddll:stop(), - ?line ok. + hs_busy_pcmd(Port, [], + fun (Proc) -> + receive after 1000 -> ok end, + chk_value({status,suspended}, + process_info(Proc, status)), + + %% Make not busy + erlang:port_control(Port, $N, []) + end, + fun (_Proc, Res, Time) -> + chk_value({return, true}, Res), + chk_range(1000, Time, 2000) + end), + + true = erlang:port_close(Port), + ok = erl_ddll:unload_driver(DrvName), + ok = erl_ddll:stop(), + ok. hs_busy_pcmd(Prt, Opts, StartFun, EndFun) -> Tester = self(), P = spawn_link(fun () -> - erlang:yield(), - Tester ! {self(), doing_port_command}, - Start = erlang:monotonic_time(micro_seconds), - Res = try {return, - port_command(Prt, [], Opts)} - catch Exception:Error -> {Exception, Error} - end, - End = erlang:monotonic_time(micro_seconds), - Time = round((End - Start)/1000), - Tester ! {self(), port_command_result, Res, Time} - end), + erlang:yield(), + Tester ! {self(), doing_port_command}, + Start = erlang:monotonic_time(micro_seconds), + Res = try {return, + port_command(Prt, [], Opts)} + catch Exception:Error -> {Exception, Error} + end, + End = erlang:monotonic_time(micro_seconds), + Time = round((End - Start)/1000), + Tester ! {self(), port_command_result, Res, Time} + end), receive - {P, doing_port_command} -> - ok + {P, doing_port_command} -> + ok end, StartFun(P), receive - {P, port_command_result, Res, Time} -> - EndFun(P, Res, Time) + {P, port_command_result, Res, Time} -> + EndFun(P, Res, Time) end. scheduling_delay_busy(Config) -> - - Scenario = - [{1,{spawn,[{var,drvname},undefined]}}, - {2,{call,[{var,1},open_port]}}, - {3,{spawn,[{var,2},{var,1}]}}, - {0,{ack,[{var,1},{busy,1,250}]}}, - {0,{cast,[{var,3},{command,2}]}}, - [{0,{cast,[{var,3},{command,I}]}} - || I <- lists:seq(3,50)], - {0,{cast,[{var,3},take_control]}}, - {0,{cast,[{var,1},{new_owner,{var,3}}]}}, - {0,{cast,[{var,3},close]}}, - {0,{timer,sleep,[300]}}, - {0,{erlang,port_command,[{var,2},<<$N>>,[force]]}}, - [{0,{cast,[{var,1},{command,I}]}} - || I <- lists:seq(101,127)] - ,{10,{call,[{var,3},get_data]}} - ], + Scenario = [{1,{spawn,[{var,drvname},undefined]}}, + {2,{call,[{var,1},open_port]}}, + {3,{spawn,[{var,2},{var,1}]}}, + {0,{ack,[{var,1},{busy,1,250}]}}, + {0,{cast,[{var,3},{command,2}]}}, + [{0,{cast,[{var,3},{command,I}]}} || I <- lists:seq(3,50)], + {0,{cast,[{var,3},take_control]}}, + {0,{cast,[{var,1},{new_owner,{var,3}}]}}, + {0,{cast,[{var,3},close]}}, + {0,{timer,sleep,[300]}}, + {0,{erlang,port_command,[{var,2},<<$N>>,[force]]}}, + [{0,{cast,[{var,1},{command,I}]}} || I <- lists:seq(101,127)], + {10,{call,[{var,3},get_data]}}], Validation = [{seq,10,lists:seq(1,50)}], port_scheduling(Scenario,Validation,proplists:get_value(data_dir,Config)). scheduling_delay_busy_nosuspend(Config) -> - - Scenario = - [{1,{spawn,[{var,drvname},undefined]}}, - {2,{call,[{var,1},open_port]}}, - {0,{cast,[{var,1},{command,1,100}]}}, - {0,{cast,[{var,1},{busy,2}]}}, - {0,{timer,sleep,[200]}}, % ensure reached port - {10,{call,[{var,1},{command,3,[nosuspend]}]}}, - {0,{timer,sleep,[200]}}, - {0,{erlang,port_command,[{var,2},<<$N>>,[force]]}}, - {0,{cast,[{var,1},close]}}, - {20,{call,[{var,1},get_data]}} - ], + Scenario = [{1,{spawn,[{var,drvname},undefined]}}, + {2,{call,[{var,1},open_port]}}, + {0,{cast,[{var,1},{command,1,100}]}}, + {0,{cast,[{var,1},{busy,2}]}}, + {0,{timer,sleep,[200]}}, % ensure reached port + {10,{call,[{var,1},{command,3,[nosuspend]}]}}, + {0,{timer,sleep,[200]}}, + {0,{erlang,port_command,[{var,2},<<$N>>,[force]]}}, + {0,{cast,[{var,1},close]}}, + {20,{call,[{var,1},get_data]}}], Validation = [{eq,10,nosuspend},{seq,20,[1,2]}], port_scheduling(Scenario,Validation,proplists:get_value(data_dir,Config)). scheduling_busy_link(Config) -> - - Scenario = - [{1,{spawn,[{var,drvname},undefined]}}, - {2,{call,[{var,1},open_port]}}, - {3,{spawn,[{var,2},{var,1}]}}, - {0,{cast,[{var,1},unlink]}}, - {0,{cast,[{var,1},{busy,1}]}}, - {0,{cast,[{var,1},{command,2}]}}, - {0,{cast,[{var,1},link]}}, - {0,{timer,sleep,[1000]}}, - {0,{ack,[{var,3},take_control]}}, - {0,{cast,[{var,1},{new_owner,{var,3}}]}}, - {0,{cast,[{var,3},close]}}, - {10,{call,[{var,3},get_data]}}, - {20,{call,[{var,1},get_exit]}} - ], + Scenario = [{1,{spawn,[{var,drvname},undefined]}}, + {2,{call,[{var,1},open_port]}}, + {3,{spawn,[{var,2},{var,1}]}}, + {0,{cast,[{var,1},unlink]}}, + {0,{cast,[{var,1},{busy,1}]}}, + {0,{cast,[{var,1},{command,2}]}}, + {0,{cast,[{var,1},link]}}, + {0,{timer,sleep,[1000]}}, + {0,{ack,[{var,3},take_control]}}, + {0,{cast,[{var,1},{new_owner,{var,3}}]}}, + {0,{cast,[{var,3},close]}}, + {10,{call,[{var,3},get_data]}}, + {20,{call,[{var,1},get_exit]}}], Validation = [{seq,10,[1]}, {seq,20,[{'EXIT',noproc}]}], @@ -656,11 +640,11 @@ handle_msg(close,Port,Owner,_Data) -> handle_msg(get_data,Port,_Owner,{[],_Exit}) -> %% Wait for data if it has not arrived yet receive - {Port,{data,Data}} -> - Data + {Port,{data,Data}} -> + Data after 2000 -> - pal("~p",[erlang:process_info(self())]), - exit(did_not_get_port_data) + pal("~p",[erlang:process_info(self())]), + exit(did_not_get_port_data) end; handle_msg(get_data,_Port,Owner,{Data,Exit}) -> pal("GetData",[]), @@ -852,8 +836,8 @@ fun_spawn(Fun, Args) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load_busy_driver(Config) when is_list(Config) -> - ?line DataDir = proplists:get_value(data_dir, Config), - ?line erl_ddll:start(), + DataDir = proplists:get_value(data_dir, Config), + erl_ddll:start(), case erl_ddll:load_driver(DataDir, "busy_drv") of ok -> ok; {error, Error} -> @@ -863,8 +847,8 @@ load_busy_driver(Config) when is_list(Config) -> %%% Interface functions. start_busy_driver(Config) when is_list(Config) -> - ?line Pid = spawn_link(?MODULE, init, [Config, self()]), - ?line receive + Pid = spawn_link(?MODULE, init, [Config, self()]), + receive {Pid, started} -> ok; Other -> @@ -875,15 +859,15 @@ unlock_slave() -> command(unlock). get_slave() -> - ?line command(get_slave). + command(get_slave). %% Internal functions. command(Msg) -> - ?line whereis(busy_drv_server) ! {self(), Msg}, - ?line receive - {busy_drv_reply, Reply} -> - Reply + whereis(busy_drv_server) ! {self(), Msg}, + receive + {busy_drv_reply, Reply} -> + Reply end. %%% Server. -- cgit v1.2.3