aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-10-17 09:12:17 +0200
committerLukas Larsson <[email protected]>2017-10-17 09:12:17 +0200
commitaddb7f717be0d93eb1d8ed3942763af37fe50af9 (patch)
treebe4fa4d21ec3a967efeb4ff3891102465f2321da
parent02b4f09c161b27e44a2beef724d2edd6b00d4d29 (diff)
parentc97216ecdd9e684f6f6e3bfee8fae8e2e8933f13 (diff)
downloadotp-addb7f717be0d93eb1d8ed3942763af37fe50af9.tar.gz
otp-addb7f717be0d93eb1d8ed3942763af37fe50af9.tar.bz2
otp-addb7f717be0d93eb1d8ed3942763af37fe50af9.zip
Merge branch 'lukas/jinterface/disable-travis' into maint
* lukas/jinterface/disable-travis: jinterface: Skip tests when hostname cannot be resolved
-rw-r--r--lib/jinterface/test/jinterface_SUITE.erl20
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).