aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2015-03-13 09:16:04 +0100
committerRaimo Niskanen <[email protected]>2015-03-13 09:16:04 +0100
commitc7df506f66f605948b5b45a305d68cfc430916d6 (patch)
tree92f68d0b1e56d8f9e25c53caaa157d9100ea3d21 /lib/kernel/test
parentf806f1fee2dd176fbde81d9b712ae2ca54541ffa (diff)
parent8ea256d59afe60a8dab437e763af7df5204df9cc (diff)
downloadotp-c7df506f66f605948b5b45a305d68cfc430916d6.tar.gz
otp-c7df506f66f605948b5b45a305d68cfc430916d6.tar.bz2
otp-c7df506f66f605948b5b45a305d68cfc430916d6.zip
Merge branch 'raimo/infinite-loop-gethostbyname/OTP-12133' into maint
* raimo/infinite-loop-gethostbyname/OTP-12133: Restore lookup order after test
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/inet_SUITE.erl26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl
index 849013ac79..44a32fc1ec 100644
--- a/lib/kernel/test/inet_SUITE.erl
+++ b/lib/kernel/test/inet_SUITE.erl
@@ -88,10 +88,30 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
+init_per_testcase(lookup_bad_search_option, Config) ->
+ Db = inet_db,
+ Key = res_lookup,
+ %% The bad option can not enter through inet_db:set_lookup/1,
+ %% but through e.g .inetrc.
+ Prev = ets:lookup(Db, Key),
+ ets:delete(Db, Key),
+ ets:insert(Db, {Key,[lookup_bad_search_option]}),
+ ?t:format("Misconfigured resolver lookup order", []),
+ Dog = test_server:timetrap(test_server:seconds(60)),
+ [{Key,Prev},{watchdog,Dog}|Config];
init_per_testcase(_Func, Config) ->
Dog = test_server:timetrap(test_server:seconds(60)),
[{watchdog,Dog}|Config].
+end_per_testcase(lookup_bad_search_option, Config) ->
+ Dog = ?config(watchdog, Config),
+ test_server:timetrap_cancel(Dog),
+ Db = inet_db,
+ Key = res_lookup,
+ Prev = ?config(Key, Config),
+ ets:delete(Db, Key),
+ ets:insert(Db, Prev),
+ ?t:format("Restored resolver lookup order", []);
end_per_testcase(_Func, Config) ->
Dog = ?config(watchdog, Config),
test_server:timetrap_cancel(Dog).
@@ -915,10 +935,8 @@ lookup_bad_search_option(suite) ->
lookup_bad_search_option(doc) ->
["Test lookup with erroneously configured lookup option (OTP-12133)"];
lookup_bad_search_option(Config) when is_list(Config) ->
- Db = inet_db,
- %% The bad option can not enter through inet_db:set_lookup/1,
- %% but through e.g .inetrc.
- ets:insert(Db, {res_lookup,[lookup_bad_search_option]}),
+ %% Manipulation of resolver config is done in init_per_testcase
+ %% and end_per_testcase to ensure cleanup.
{ok,Hostname} = inet:gethostname(),
{ok,_Hent} = inet:gethostbyname(Hostname), % Will hang loop for this bug
ok.