diff options
author | Lukas Larsson <[email protected]> | 2016-06-07 09:45:01 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-06-07 09:45:01 +0200 |
commit | ac18b8705c78be8bec5bdc14c412af2ced740916 (patch) | |
tree | f6a0a03215e409bb82f3087d9363c06d593de16f /lib/kernel/test/heart_SUITE.erl | |
parent | d26c15e07229c90ba8353bd78d5406ada0f13271 (diff) | |
parent | 85996c92853e90cb233a1405b1c8c7bb1b8ca54e (diff) | |
download | otp-ac18b8705c78be8bec5bdc14c412af2ced740916.tar.gz otp-ac18b8705c78be8bec5bdc14c412af2ced740916.tar.bz2 otp-ac18b8705c78be8bec5bdc14c412af2ced740916.zip |
Merge branch 'dotsimon/erts/heart_no_kill/OTP-13650'
* dotsimon/erts/heart_no_kill/OTP-13650:
erts: make HEART_NO_KILL have to be set to TRUE
Don't kill old erlang if HEART_NO_KILL is set
Conflicts:
lib/kernel/doc/src/heart.xml
Diffstat (limited to 'lib/kernel/test/heart_SUITE.erl')
-rw-r--r-- | lib/kernel/test/heart_SUITE.erl | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl index 548b27db97..e63ed34973 100644 --- a/lib/kernel/test/heart_SUITE.erl +++ b/lib/kernel/test/heart_SUITE.erl @@ -29,11 +29,11 @@ set_cmd/1, clear_cmd/1, get_cmd/1, callback_api/1, options_api/1, - dont_drop/1, kill_pid/1]). + dont_drop/1, kill_pid/1, heart_no_kill/1]). -export([init_per_testcase/2, end_per_testcase/2]). --export([start_heart_stress/1, mangle/1, suicide_by_heart/0]). +-export([start_heart_stress/1, mangle/1, suicide_by_heart/0, non_suicide_by_heart/0]). -define(DEFAULT_TIMEOUT_SECS, 120). @@ -491,6 +491,30 @@ do_kill_pid(_Config) -> false end. + +heart_no_kill(suite) -> + []; +heart_no_kill(doc) -> + ["Tests that heart doesn't kill the old erlang node when ", + "HEART_NO_KILL is set."]; +heart_no_kill(Config) when is_list(Config) -> + ok = do_no_kill(Config). + +do_no_kill(_Config) -> + Name = heart_test, + {ok,Node} = start_node_run(Name,[],non_suicide_by_heart,[]), + io:format("Node is ~p~n", [Node]), + ok = wait_for_node(Node,15), + io:format("wait_for_node is ~p~n", [ok]), + erlang:monitor_node(Node, true), + receive {nodedown,Node} -> false + after 30000 -> + io:format("Node didn't die..\n"), + rpc:call(Node,init,stop,[]), + io:format("done init:stop..\n"), + ok + end. + wait_for_node(_,0) -> false; wait_for_node(Node,N) -> @@ -609,6 +633,18 @@ suicide_by_heart() -> sallad end. +non_suicide_by_heart() -> + P = open_port({spawn,"heart -ht 11 -pid "++os:getpid()},[exit_status, {env, {"HEART_NO_KILL", "TRUE"}}, {packet,2}]), + receive X -> X end, + %% Just hang and wait for heart to timeout + receive + {P,{exit_status,_}} -> + ok + after + 20000 -> + exit(timeout) + end. + %% generate a module from binary generate(Module, Attributes, FunStrings) -> |