aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-03-15 19:53:42 +0100
committerSverker Eriksson <[email protected]>2016-05-04 19:53:37 +0200
commit8b2906d9974decf9e8bab24a8f753ba81a025410 (patch)
tree988f201ee7791214067393e73914c7b8e170d6ee /erts/emulator/test
parent3261d580be2263b7b4b70ec3c7670a5de963e91c (diff)
downloadotp-8b2906d9974decf9e8bab24a8f753ba81a025410.tar.gz
otp-8b2906d9974decf9e8bab24a8f753ba81a025410.tar.bz2
otp-8b2906d9974decf9e8bab24a8f753ba81a025410.zip
erts: Add matchspec to 'receive' trace
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/trace_SUITE.erl20
1 files changed, 20 insertions, 0 deletions
diff --git a/erts/emulator/test/trace_SUITE.erl b/erts/emulator/test/trace_SUITE.erl
index c8cc0fc6e8..7eb52dcdeb 100644
--- a/erts/emulator/test/trace_SUITE.erl
+++ b/erts/emulator/test/trace_SUITE.erl
@@ -94,6 +94,26 @@ receive_trace(Config) when is_list(Config) ->
{trace, Receiver, 'receive', Hello2} = receive_first_trace(),
receive_nothing(),
+ %% Test 'receive' with matchspec
+ F1 = fun ({Pat, IsMatching}) ->
+ set_trace_pattern('receive', Pat, []),
+ Receiver ! Hello,
+ case IsMatching of
+ true ->
+ {trace, Receiver, 'receive', Hello} = receive_first_trace();
+ false ->
+ ok
+ end,
+ receive_nothing()
+ end,
+ lists:foreach(F1, [{no, true},
+ {[{[undefined,"Unexpected"],[],[]}], false},
+ {[{['_','_'],[],[]}], true},
+ {[{['$1','_'],[{is_integer,'$1'}],[]}], false},
+ {[{['_','$1'],[{is_tuple,'$1'}],[]}], true},
+ {false, false},
+ {true, true}]),
+
%% Another process should not be able to trace Receiver.
Intruder = fun_spawn(fun() -> erlang:trace(Receiver, true, ['receive']) end),
{'EXIT', Intruder, {badarg, _}} = receive_first(),