Erlang Mailing Lists

Author Message

<  Erlang bugs mailing list  ~  Eunit test process killed when unloading module with tests

Guest
Posted: Mon Jun 07, 2010 12:37 pm Reply with quote
Guest
Hi!

We've encountered a rare eunit bug related to test
generators and code loading.

Erlang version: R13B04 (reproduced in R13B03 as well).
OS: Mac OS X 10.5, 10.6, Ubuntu 8.1 (probably all platforms).

How to reproduce (minimal):

* Create two modules: a_mod.erl and b_mod.erl, with the
content as seen below
* In an Erlang shell:
c(a_mod), c(b_mod).
eunit:test([a_mod, b_mod]).
*unexpected termination of test process*
::killed

It seems that after running the a_mod test module,
eunit leaves a process that is executing inside it
(or that is what we believe).
This causes the test process to be killed when
the second test runs code:purge(a_mod).

* This only occurs when the module that is unloaded
has a test generator (first_test_ in this example),
not if it has a 'normal' test function.

Now, you may wonder why anyone would want to do this.
Well, in this minimal example it is not apparent, but
we have white-box unit tests in header files that we
conditionally include in our modules. Sometimes
we mock other modules in the same application, and
then we hit this bug.

a_mod.erl:
-------------------------------------------------
-module(a_mod).

-include_lib("eunit/include/eunit.hrl").

first_test_() ->
{foreach, fun setup/0, fun teardown/1,
[
fun first_/0
]}.


setup() ->
ok.

teardown(_) ->
ok.

first_() ->
ok.
-------------------------------------------------

b_mod.erl:
----------------------
-module(b_mod).

-include_lib("eunit/include/eunit.hrl").

second_test() ->
code:delete(a_mod),
code:purge(a_mod),
ok.
----------------------

---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com


________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com

Post received from mailinglist
wailian
Posted: Tue Mar 20, 2012 2:16 am Reply with quote
Guest
i/p transducer requires a standard input and is for use with linear pneumatic actuators and has high air capacity. It can be easy change of the output signal from. electro pneumatic transducer is used, for example, in the biomedical field for the pneumatic control of a cardiac module, or artificial heart.

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum