aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-05-02 13:10:11 +0200
committerHans Nilsson <[email protected]>2016-05-02 13:10:11 +0200
commit857a1d4b17508608241e10315f17988cf2d22ecc (patch)
tree3542e6dee0f802baae8bcb0ed7100c89b3b331b0 /lib/ssh/test/ssh_test_lib.erl
parent7cc731c30c4701251fec17d93a88ce2a8739b5b1 (diff)
parent6282a81eca93e015445e04d09be9ac7854bb96d6 (diff)
downloadotp-857a1d4b17508608241e10315f17988cf2d22ecc.tar.gz
otp-857a1d4b17508608241e10315f17988cf2d22ecc.tar.bz2
otp-857a1d4b17508608241e10315f17988cf2d22ecc.zip
Merge branch 'hans/ssh/daemon_port_0/OTP-13527'
Conflicts: lib/ssh/test/ssh_test_lib.erl
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 5cf2925671..c6541461a1 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -42,27 +42,33 @@ connect(Host, Port, Options) ->
ConnectionRef.
daemon(Options) ->
- daemon(any, inet_port(), Options).
+ daemon(any, 0, Options).
daemon(Port, Options) when is_integer(Port) ->
daemon(any, Port, Options);
daemon(Host, Options) ->
- daemon(Host, inet_port(), Options).
+ daemon(Host, 0, Options).
+
daemon(Host, Port, Options) ->
ct:log("~p:~p Calling ssh:daemon(~p, ~p, ~p)",[?MODULE,?LINE,Host,Port,Options]),
case ssh:daemon(Host, Port, Options) of
{ok, Pid} when Host == any ->
ct:log("ssh:daemon ok (1)",[]),
- {Pid, hostname(), Port};
+ {Pid, hostname(), daemon_port(Port,Pid)};
{ok, Pid} ->
ct:log("ssh:daemon ok (2)",[]),
- {Pid, Host, Port};
+ {Pid, Host, daemon_port(Port,Pid)};
Error ->
ct:log("ssh:daemon error ~p",[Error]),
Error
end.
+daemon_port(0, Pid) -> {ok,Dinf} = ssh:daemon_info(Pid),
+ proplists:get_value(port, Dinf);
+daemon_port(Port, _) -> Port.
+
+
std_daemon(Config, ExtraOpts) ->
PrivDir = ?config(priv_dir, Config),