aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime_tools
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-04 14:55:45 +0200
committerSverker Eriksson <[email protected]>2016-05-04 19:53:38 +0200
commite8fa9bb9e4c9bbd38371dc47791fd4c1f3d932ff (patch)
tree6355b3ffb0ceec580e5e222402bb32e5ba07ff69 /lib/runtime_tools
parentbc274db5918286eae72acc8050a12ad6d6fe05bf (diff)
downloadotp-e8fa9bb9e4c9bbd38371dc47791fd4c1f3d932ff.tar.gz
otp-e8fa9bb9e4c9bbd38371dc47791fd4c1f3d932ff.tar.bz2
otp-e8fa9bb9e4c9bbd38371dc47791fd4c1f3d932ff.zip
runtime_tools: Add send tpe testcase
Diffstat (limited to 'lib/runtime_tools')
-rw-r--r--lib/runtime_tools/test/dbg_SUITE.erl81
1 files changed, 81 insertions, 0 deletions
diff --git a/lib/runtime_tools/test/dbg_SUITE.erl b/lib/runtime_tools/test/dbg_SUITE.erl
index 9c9d6ca352..db4aad7341 100644
--- a/lib/runtime_tools/test/dbg_SUITE.erl
+++ b/lib/runtime_tools/test/dbg_SUITE.erl
@@ -22,6 +22,7 @@
%% Test functions
-export([all/0, suite/0,
big/1, tiny/1, simple/1, message/1, distributed/1, port/1,
+ send/1,
ip_port/1, file_port/1, file_port2/1, file_port_schedfix/1,
ip_port_busy/1, wrap_port/1, wrap_port_time/1,
with_seq_trace/1, dead_suspend/1, local_trace/1,
@@ -39,6 +40,7 @@ suite() ->
all() ->
[big, tiny, simple, message, distributed, port, ip_port,
+ send,
file_port, file_port2, file_port_schedfix, ip_port_busy,
wrap_port, wrap_port_time, with_seq_trace, dead_suspend,
local_trace, saved_patterns, tracer_exit_on_stop,
@@ -151,6 +153,74 @@ message(Config) when is_list(Config) ->
{trace,S,call,{dbg,ln,[]},S}] = flush(),
ok.
+send(Config) when is_list(Config) ->
+ {ok, _} = start(),
+ try
+ S = self(),
+ Rcvr = spawn_link(fun F() ->
+ receive M ->
+ S ! M,
+ F()
+ end
+ end),
+
+ {ok, [{matched, _, 1}]} = dbg:p(Rcvr, send),
+ R1 = Rcvr ! make_ref(),
+ receive R1 -> ok end,
+ [{trace, Rcvr, send, R1, S}] = flush(),
+
+ {ok, [{matched, _node, 1}, {saved, 1}]} = dbg:tpe(send, [{[S,'_'],[],[]}]),
+ R2 = Rcvr ! make_ref(),
+ receive R2 -> ok end,
+ [{trace, Rcvr, send, R2, S}] = flush(),
+
+ {ok, [{matched, _node, 1}, {saved, 2}]} =
+ dbg:tpe(send, [{['$1','_'],[{'==','$1',{self}}],[]}]),
+ R3 = Rcvr ! make_ref(),
+ receive R3 -> ok end,
+ [] = flush(),
+
+ {ok, [{matched, _node, 1}, {saved, 3}]} =
+ dbg:tpe(send, [{['_','_'],[{'==',Rcvr,{self}}],[]}]),
+ R4 = Rcvr ! make_ref(),
+ receive R4 -> ok end,
+ [{trace, Rcvr, send, R4, S}] = flush(),
+
+ {ok, [{matched, _node, 1}, {saved, 4}]} =
+ dbg:tpe(send, [{['_','_'],[{'==',Rcvr,{self}}],[{message, hello}]}]),
+ R5 = Rcvr ! make_ref(),
+ receive R5 -> ok end,
+ [{trace, Rcvr, send, R5, S, hello}] = flush(),
+
+ {ok, [{matched, _node, 1}, {saved, 2}]} = dbg:tpe(send, 2),
+ R6 = Rcvr ! make_ref(),
+ receive R6 -> ok end,
+ [] = flush(),
+
+ {ok, [{matched, _node, 1}]} = dbg:ctpe(send),
+ R7 = Rcvr ! make_ref(),
+ receive R7 -> ok end,
+ [{trace, Rcvr, send, R7, S, hello}] = flush(),
+
+ R8 = make_ref(),
+ {ok, [{matched, _node, 1}, {saved, 5}]} =
+ dbg:tpe(send, [{['_','$2'],[{'==',R8,{element, 1, {element, 2, '$2'}}}],
+ [{message, hello}]}]),
+ Msg1 = Rcvr ! {test, {R8}, <<0:(8*1024)>>},
+ receive Msg1 -> ok end,
+ [{trace, Rcvr, send, Msg1, S, hello}] = flush(),
+
+ R9 = make_ref(),
+ Msg2 = Rcvr ! {test, {R9}, <<0:(8*1024)>>},
+ receive Msg2 -> ok end,
+ [] = flush(),
+
+ ok
+
+ after
+ stop()
+ end.
+
%% Simple test of distributed tracing
distributed(Config) when is_list(Config) ->
{ok, _} = start(),
@@ -859,6 +929,17 @@ flush(Acc) ->
Acc
end.
+flush_trace() ->
+ flush_trace([]).
+flush_trace(Acc) ->
+ receive
+ X when element(1,X) =:= trace;
+ element(1,X) =:= trace_ts
+ -> flush_trace(Acc ++ [X])
+ after 1000 ->
+ Acc
+ end.
+
start() ->
stop(),
dbg:tracer(process, {fun myhandler/2, self()}).