From b424835b0d08c9fdf2650782e481e3e7a08eb1ae Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Mon, 7 Dec 2015 15:06:49 +0100 Subject: ssh: add check for available ipv6 addr in test case --- lib/ssh/test/ssh_basic_SUITE.erl | 8 ++++++++ lib/ssh/test/ssh_test_lib.erl | 12 ++++++++++++ 2 files changed, 20 insertions(+) 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. -- cgit v1.2.3