aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-12-07 15:06:49 +0100
committerHans Nilsson <[email protected]>2015-12-07 15:06:49 +0100
commitb424835b0d08c9fdf2650782e481e3e7a08eb1ae (patch)
tree4b4e13523b523162cae22b1e1ffc85838acd3ca6 /lib/ssh/test
parent52701a71707e44bef90c7ad8db8dc8a0f9a1feaf (diff)
downloadotp-b424835b0d08c9fdf2650782e481e3e7a08eb1ae.tar.gz
otp-b424835b0d08c9fdf2650782e481e3e7a08eb1ae.tar.bz2
otp-b424835b0d08c9fdf2650782e481e3e7a08eb1ae.zip
ssh: add check for available ipv6 addr in test case
Diffstat (limited to 'lib/ssh/test')
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl8
-rw-r--r--lib/ssh/test/ssh_test_lib.erl12
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index 85a6bac972..6c4c215b3d 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -311,6 +311,14 @@ init_per_testcase(TC, Config) when TC==shell_no_unicode ;
ct:log("file:native_name_encoding() = ~p,~nio:getopts() = ~p",
[file:native_name_encoding(),io:getopts()]),
wait_for_erlang_first_line([{io,IO}, {shell,Shell}, {sftpd, Sftpd} | Config]);
+
+init_per_testcase(inet6_option, Config) ->
+ case ssh_test_lib:has_inet6_address() of
+ true ->
+ init_per_testcase('__default__', Config);
+ false ->
+ {skip,"No ipv6 interface address"}
+ end;
init_per_testcase(_TestCase, Config) ->
ssh:start(),
Config.
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 424afc76fe..ed76f4f795 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -646,3 +646,15 @@ ssh_supports(Alg, SshDefaultAlg_tag) ->
{false,UnSup}
end
end.
+
+%%%----------------------------------------------------------------
+has_inet6_address() ->
+ try
+ [throw(6) || {ok,L} <- [inet:getifaddrs()],
+ {_,L1} <- L,
+ {addr,{_,_,_,_,_,_,_,_}} <- L1]
+ of
+ [] -> false
+ catch
+ throw:6 -> true
+ end.