diff options
author | Lukas Larsson <[email protected]> | 2017-10-17 09:12:33 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2017-10-17 09:12:33 +0200 |
commit | 62db6a63625ef67d7474da1efc8d4f65bfd8c251 (patch) | |
tree | faa6bdb140a5ae8720816178b280b02c8a40ba96 | |
parent | 11fcc4b2b4581da4e24b94128a4f38ae98a2f466 (diff) | |
parent | addb7f717be0d93eb1d8ed3942763af37fe50af9 (diff) | |
download | otp-62db6a63625ef67d7474da1efc8d4f65bfd8c251.tar.gz otp-62db6a63625ef67d7474da1efc8d4f65bfd8c251.tar.bz2 otp-62db6a63625ef67d7474da1efc8d4f65bfd8c251.zip |
Merge branch 'maint'
-rw-r--r-- | lib/jinterface/test/jinterface_SUITE.erl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/jinterface/test/jinterface_SUITE.erl b/lib/jinterface/test/jinterface_SUITE.erl index 73851f47e0..8c6a6368a9 100644 --- a/lib/jinterface/test/jinterface_SUITE.erl +++ b/lib/jinterface/test/jinterface_SUITE.erl @@ -176,11 +176,29 @@ init_per_suite(Config) when is_list(Config) -> {error,bad_name} -> false; P -> filelib:is_dir(P) end of true -> - jitu:init_all(Config); + case hostname_resolves() of + true -> + jitu:init_all(Config); + Skip -> + Skip + end; false -> {skip,"No jinterface application"} end. +%% Check if inet:gethostname() can be resolved by +%% the native resolver. If it can, we know that +%% jinterface name resolution works. If it cannot +%% jinterface tests will fail. +hostname_resolves() -> + {ok, HN} = inet:gethostname(), + case inet_gethost_native:gethostbyname(HN) of + {ok, _} -> + true; + _ -> + {skip, "Cannot resolve short hostname, add " ++ HN ++ " to /etc/hosts"} + end. + end_per_suite(Config) when is_list(Config) -> jitu:finish_all(Config). |