Skip to content

Commit 664a602

Browse files
committed
Limit message tracing to the test process
Otherwise, sometimes system or CT messages would be caught, resulting in flaky tests (too many traces collected).
1 parent 27f0c88 commit 664a602

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/tr_SUITE.erl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ single_pid_with_msg(_Config) ->
183183
msg_after_traced_call(_Config) ->
184184
Pid = spawn_link(fun ?MODULE:async_factorial/0),
185185
MFA = {?MODULE, factorial, 1},
186-
tr:trace(#{modules => [MFA], msg => all}),
186+
tr:trace(#{modules => [MFA], pids => [Pid], msg => all}),
187187
Self = self(),
188188
Pid ! {do_factorial, 0, Self},
189189
receive {ok, _} -> ok end,
@@ -693,8 +693,9 @@ trace_fib3() ->
693693

694694
trace_wait_and_reply() ->
695695
Self = self(),
696-
tr:trace(#{modules => [MFA = {?MODULE, wait_and_reply, 1}], msg => all}),
697-
Pid = spawn_link(?MODULE, wait_and_reply, [self()]),
696+
Pid = spawn_wait_and_reply(self()),
697+
tr:trace(#{modules => [MFA = {?MODULE, wait_and_reply, 1}], pids => [Pid], msg => all}),
698+
Pid ! start,
698699
receive {started, Pid} -> ok end,
699700
Pid ! reply,
700701
receive {finished, Pid} -> ok end,
@@ -759,6 +760,12 @@ fib(N) when N > 1 -> fib(N - 1) + fib(N - 2);
759760
fib(1) -> 1;
760761
fib(0) -> 0.
761762

763+
spawn_wait_and_reply(Sender) ->
764+
spawn_link(fun() ->
765+
receive start -> ok end,
766+
wait_and_reply(Sender)
767+
end).
768+
762769
wait_and_reply(Sender) ->
763770
Sender ! {started, self()},
764771
receive reply -> ok end,

0 commit comments

Comments
 (0)