aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-04-07 18:03:42 +0200
committerHans Nilsson <[email protected]>2016-04-28 20:37:30 +0200
commit6282a81eca93e015445e04d09be9ac7854bb96d6 (patch)
treef4f57e24a15088a8b55911b946c3993d003f197c /lib/ssh/test/ssh_test_lib.erl
parentb90f22861404f2a2cdd305055c786bb73464af01 (diff)
downloadotp-6282a81eca93e015445e04d09be9ac7854bb96d6.tar.gz
otp-6282a81eca93e015445e04d09be9ac7854bb96d6.tar.bz2
otp-6282a81eca93e015445e04d09be9ac7854bb96d6.zip
ssh: test cases changed for port 0 as arg to ssh:daemon
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 4db7d09ccd..0e3500e0c1 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -49,23 +49,31 @@ 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) ->
case ssh:daemon(Host, Port, Options) of
{ok, Pid} when Host == any ->
- {Pid, hostname(), Port};
+ ct:log("ssh:daemon ok (1)",[]),
+ {Pid, hostname(), daemon_port(Port,Pid)};
{ok, Pid} ->
- {Pid, Host, Port};
+ ct:log("ssh:daemon ok (2)",[]),
+ {Pid, Host, daemon_port(Port,Pid)};
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),