aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/trace_SUITE.erl
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-03-17 16:35:08 +0100
committerSverker Eriksson <[email protected]>2016-05-04 19:53:37 +0200
commit5cb62b003d082c5a32ef5b12a89d872a317fd05f (patch)
tree04cae6377f78cfad3db7165d44daa37c525be507 /erts/emulator/test/trace_SUITE.erl
parent8b2906d9974decf9e8bab24a8f753ba81a025410 (diff)
downloadotp-5cb62b003d082c5a32ef5b12a89d872a317fd05f.tar.gz
otp-5cb62b003d082c5a32ef5b12a89d872a317fd05f.tar.bz2
otp-5cb62b003d082c5a32ef5b12a89d872a317fd05f.zip
erts: Add matchspec restrictions for 'receive' trace
and non-call-trace. This is the easy way out to avoid difficult locking scenarios when accessing tracing flags on another process.
Diffstat (limited to 'erts/emulator/test/trace_SUITE.erl')
-rw-r--r--erts/emulator/test/trace_SUITE.erl25
1 files changed, 21 insertions, 4 deletions
diff --git a/erts/emulator/test/trace_SUITE.erl b/erts/emulator/test/trace_SUITE.erl
index 7eb52dcdeb..de1d292d27 100644
--- a/erts/emulator/test/trace_SUITE.erl
+++ b/erts/emulator/test/trace_SUITE.erl
@@ -119,10 +119,26 @@ receive_trace(Config) when is_list(Config) ->
{'EXIT', Intruder, {badarg, _}} = receive_first(),
%% Untrace the process; we should not receive anything.
- 1 = erlang:trace(Receiver, false, ['receive']),
- Receiver ! {hello, there},
- Receiver ! any_garbage,
- receive_nothing(),
+ ?line 1 = erlang:trace(Receiver, false, ['receive']),
+ ?line Receiver ! {hello, there},
+ ?line Receiver ! any_garbage,
+ ?line receive_nothing(),
+
+ %% Verify restrictions in matchspec for 'receive'
+ F2 = fun (Pat) -> {'EXIT', {badarg,_}} = (catch erlang:trace_pattern('receive', Pat, [])) end,
+ lists:foreach(F2, [[{['_','_'],[],[{message, {process_dump}}]}],
+ [{['_','_'],[{is_seq_trace}],[]}],
+ [{['_','_'],[],[{set_seq_token,label,4711}]}],
+ [{['_','_'],[],[{get_seq_token}]}],
+ [{['_','_'],[],[{enable_trace,call}]}],
+ [{['_','_'],[],[{enable_trace,self(),call}]}],
+ [{['_','_'],[],[{disable_trace,call}]}],
+ [{['_','_'],[],[{disable_trace,self(),call}]}],
+ [{['_','_'],[],[{trace,[call],[]}]}],
+ [{['_','_'],[],[{trace,self(),[],[call]}]}],
+ [{['_','_'],[],[{caller}]}],
+ [{['_','_'],[],[{silent,true}]}]]),
+
ok.
%% Tests that receive of a message always happens before a call with
@@ -409,6 +425,7 @@ send_trace(Config) when is_list(Config) ->
{'EXIT',{badarg,_}} = (catch erlang:trace_pattern(send, true, [call_time])),
{'EXIT',{badarg,_}} = (catch erlang:trace_pattern(send, restart, [])),
{'EXIT',{badarg,_}} = (catch erlang:trace_pattern(send, pause, [])),
+ {'EXIT',{badarg,_}} = (catch erlang:trace_pattern(send, [{['_','_'],[],[{caller}]}], [])),
%% Done.
ok.