[erlang-questions] slave:start/3 time out when EUnit started with ERL_FLAGS

yfyf <>
Wed Sep 7 11:14:32 CEST 2011


On 09/07/2011 11:26 AM, Ulf Wiger wrote:
>
> On 7 Sep 2011, at 10:14, Ignas Vyšniauskas wrote:
>
>> bug: compile
>>    EUNIT="verbose" ERL_FLAGS="-sname foobar" erl -s eunit test foo
>
> From the init(3) man page on the '-s' flag:
>
> "The functions are executed sequentially in an initialization process,
> which then terminates normally and passes control to the user. This
> means that a -s call which does not return will block further
> processing; to avoid this, use some variant of spawn in such cases."
>
> eunit:test/1 runs to completion, blocking until the tests are done.
> Therefore, it can't be used directly with the -s flag.
>
Is the '-s' flag really relevant here? Consider this:

------------------------------------------------------------
[~/dev/fooApp]$ ERL_FLAGS="-sname foobar" erl
Erlang R14B (erts-5.8.1) [source] [rq:1] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
()1> eunit:test(foo).

=INFO REPORT==== 7-Sep-2011::11:58:33 ===
Node  is alive? true
foo: bug_test (module 'foo')...*timed out*
undefined
=======================================================
  Failed: 0.  Skipped: 0.  Passed: 0.
One or more tests were cancelled.
------------------------------------------------------------

However:

------------------------------------------------------------
[~/dev/fooApp]$ erl -sname foobar
Erlang R14B (erts-5.8.1) [source] [rq:1] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
()1> eunit:test(foo).

=INFO REPORT==== 7-Sep-2011::12:00:11 ===
Node  is alive? true
  Test passed.
ok
------------------------------------------------------------


Did I misunderstand your answer? If so, could you maybe explain it in a
bit more detail.
The reason why I ended up in this situation is that before I was using
net_kernel:start([eunit, shortnames]) in my test setup functions, but
then Mnesia stopped responding to EUnit's calls for some reason and I
started digging for the problem and found this.

An off topic, but related question: is using net_kernel:start/1 in EUnit
a bad idea in general?

Thank you for your help.



More information about the erlang-questions mailing list