of course you would call it as<div>call_and_sleep({gateway_api,send,[Msg]}, {gen_gwserver, ack_sent, 1}).</div><div><br></div><div>Also, If you need to check the Args passed to ack_sent, you can add some MatchSpec to the trace_pattern to do that.<br>
<br><div class="gmail_quote">2012/1/3 Ahmed Omar <span dir="ltr"><<a href="mailto:spawn.think@gmail.com">spawn.think@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ignas, <div>The problem is not in the flags, it's just that the process can't trace itself. </div><div>For example you can't do this</div><div>erlang:trace(self(), true, [call, {tracer,self()}]).</div><div><br>
</div><div>If u wanna use tracing for this, you can simply write the desired api as :</div><div><div>call_and_sleep({ModC, FunC, ArgC}=_Call, {ModS,FunS,ArgS}=_SleepFor)-></div><div> erlang:trace(all ,true, [call]),</div>
<div> erlang:trace_pattern({ModS, FunS, ArgS}, true, []),</div><div> spawn(ModC, FunC, ArgC),</div><div class="im"><div> receive</div><div> {trace, _, _, _} -></div><div> ok</div></div><div>
end.</div><div><div class="h5"><br><div class="gmail_quote">
2012/1/2 Ignas Vyšniauskas <span dir="ltr"><<a href="mailto:baliulia@gmail.com" target="_blank">baliulia@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 2012.01.02 19:57, Gianfranco Alongi wrote:<br>
> Hi - just throwing this out there.<br>
><br>
> I started thinking about this too and wanted some kind of lib for<br>
> side-effect testing and got only as far as whipping up some basic<br>
> stuff<br>
><br>
> <a href="https://github.com/Gianfrancoalongi/Audit-Collector---A-real-time-version-of-Frame-Axiom/" target="_blank">https://github.com/Gianfrancoalongi/Audit-Collector---A-real-time-version-of-Frame-Axiom/</a><br>
><br>
> I didn't have too much time back then and it was mostly a proof of concept<br>
><br>
> /G<br>
<br>
</div>Hmm, this is interesting, I was thinking of abusing the Erlang tracer as<br>
well.<br>
<br>
For the question Motiejus raised, could something like this possibly work:<br>
<br>
erlang:trace(all, true, [call, {tracer, self()}]),<br>
% I tried all of the flags: global, local and meta, all failed<br>
erlang:trace_pattern({gen_gwserver, ack_sent, 1}, true, [local]),<br>
gateway_api:send(Msg),<br>
receive<br>
{trace, _, _, _} -><br>
ok % gen_gwserver:ack_sent/1 was called, we can proceed<br>
end,<br>
?assert(Something)<br>
<br>
I tried this, but it didn't work. Unfortunately, my understanding of<br>
Erlang's trace mechanism is very poor, so I couldn't work out whether<br>
it's possible to fix it somehow.<br>
<br>
Thanks,<br>
Ignas<br>
<div><div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br>Best Regards,<br>- Ahmed Omar<div><a href="http://nl.linkedin.com/in/adiaa" target="_blank">http://nl.linkedin.com/in/adiaa</a></div>
<div>Follow me on twitter</div>
<div><a href="http://twitter.com/#!/spawn_think" target="_blank">@spawn_think</a></div><br>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best Regards,<br>- Ahmed Omar<div><a href="http://nl.linkedin.com/in/adiaa" target="_blank">http://nl.linkedin.com/in/adiaa</a></div><div>Follow me on twitter</div>
<div><a href="http://twitter.com/#!/spawn_think" target="_blank">@spawn_think</a></div><br>
</div>