[erlang-bugs] Eunit, test generators and code:purge()
Andrew Thompson
andrew@REDACTED
Wed May 29 21:46:24 CEST 2013
So, I've been chasing a failure in a test suite for the last couple
days. Turns out, the problem is the test suite does this:
* Test module A, with a test generator function
* Test module B, and meck module A
Eunit's runner is holding a reference to something in module A (probably
a fun), so when meck does a purge on A as part of test B, the code
server kills the eunit test runner process. This bug was actually
reported three years ago:
http://erlang.org/pipermail/erlang-bugs/2010-June/001844.html
But it still affects at least R15B03, which is what I'm using.
I have a slightly modified version of b_mod that proves that eunit is
holding a ref to something from a_mod:
-module(b_mod).
-include_lib("eunit/include/eunit.hrl").
second_test() ->
?debugFmt("I am ~p ~p~n", [self(), erlang:process_info(self())]),
true = code:delete(a_mod),
?debugFmt("processes using a_mod: ~p~n", [[P || P <- processes(), erlang:check_process_code(P, a_mod)]]),
true = code:soft_purge(a_mod),
ok.
I looked into trying to patch this, but the eunit code is too convoluted
for me to understand where it is holding the problematic reference.
Andrew
More information about the erlang-bugs
mailing list