Skip to content

Commit 5fea6c4

Browse files
committed
Merge branch 'michal/observer/fix-zero-fault-issue-in-etop-suite' into maint
OTP-19754 * michal/observer/fix-zero-fault-issue-in-etop-suite: Handle quoted node names Wait for processes to exit when stopping
2 parents 79dacb7 + 5759d34 commit 5fea6c4

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lib/observer/src/etop.erl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ stop() ->
137137
case whereis(etop_server) of
138138
undefined -> not_started;
139139
Pid when is_pid(Pid) ->
140-
Result = etop_server ! stop,
140+
MonRef = monitor(process, Pid),
141+
Pid ! stop,
141142
stop_etop_input_server(),
142-
Result
143+
receive {'DOWN', MonRef, process, Pid, _} -> ok end,
144+
stop
143145
end.
144146

145147
-doc """
@@ -328,7 +330,13 @@ stop(Reader, Opts) ->
328330
etop_tr:stop_tracer(Opts),
329331
%% Stop reader process so it doesn't crash on deleted accumulator table
330332
%% when our process dies.
331-
exit(Pid, stop);
333+
case is_process_alive(Pid) of
334+
true ->
335+
MonRef = monitor(process, Pid),
336+
exit(Pid, stop),
337+
receive {'DOWN', MonRef, process, Pid, _} -> ok end;
338+
false -> ok
339+
end;
332340
_ ->
333341
ok
334342
end,

lib/observer/test/etop_SUITE.erl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ text_in_terminal(Config) when is_list(Config) ->
232232
Node = proplists:get_value(node, Config),
233233
Term = proplists:get_value(term, Config),
234234
ExpectedLineCount = 10 + proplists:get_value(lines, Config, 10) + 2,
235-
236-
EtopStartCmd = "spawn_link(etop, start, [[{node,"++atom_to_list(Node)++"},{output,text},{interval,1}]]).",
235+
EtopStartCmd = io_lib:format("spawn_link(etop, start, [[{node,~w},{output,text},{interval,1}]]).", [Node]),
237236
shell_test_lib:send_tty(Term, EtopStartCmd),
238237
shell_test_lib:send_tty(Term, "Enter"),
239238

@@ -406,8 +405,8 @@ verify_dup_line(Char, Line) ->
406405
true = string:equal(ExpectedLine, Line).
407406

408407
verify_node_and_time_line(Node, NodeAndTimeLine) ->
409-
NodeString = atom_to_binary(Node),
410408
[NodeString | SplitLine] = string:split(string:trim(NodeAndTimeLine), " ", all),
409+
Node = binary_to_atom(string:trim(NodeString, both, "'")),
411410

412411
TimeLine = lists:last(SplitLine),
413412
[Hour, Minute, Second] = string:split(TimeLine, ":", all),

0 commit comments

Comments
 (0)