[erlang-questions] Problems with dynamically compiled eunit test

Paulo F. Oliveira paulo.ferraz.oliveira@REDACTED
Fri Jun 13 14:39:15 CEST 2014


Something similar happened to me recently, while using Cowboy as a
dependency. I had the following in rebar.config:

{erl_opts, [{src_dirs, ["src", "test", ...

which made both my application's and all my dependencies' "src" and "test"
folder be compiled leading to a "module already present/compiled"-like
exception.

I changed rebar.config to:

{erl_opts, [{src_dirs, ["src", "../myapp/test", ...

which, probably not being the best solution, at least solved my problem.

Cheers.

- Paulo F. Oliveira


On 13 June 2014 11:30, Martin Koroudjiev <mrtndimitrov@REDACTED> wrote:

> Just for the record.
>
> It turned out I had a module in the code path called eunit_test. There
> is a module called the same in eunit lib.
>
> Martin
>
> On 6/12/2014 8:20 AM, Martin Koroudjiev wrote:
> > Hello,
> >
> > I've used eunit framework many times before with no problems but now I
> > try to compile dynamically a test module and to run the tests. I get
> > this error:
> >
> > undefined
> > *unexpected termination of test process*
> > ::{undef,[{eunit_test,mf_wrapper,[my_test,fib_test_],[]},
> >           {eunit_data,parse,1,[{file,"eunit_data.erl"},{line,245}]},
> >           {eunit_data,next,1,[{file,"eunit_data.erl"},{line,170}]},
> >           {eunit_data,lookahead,1,[{file,"eunit_data.erl"},{line,530}]},
> >           {eunit_data,group,1,[{file,[...]},{line,...}]},
> >           {eunit_data,next,1,[{file,...},{...}]},
> >           {eunit_data,iter_next,1,[{...}|...]},
> >           {eunit_proc,get_next_item,1,[...]}]}
> >
> > =======================================================
> >   Failed: 0.  Skipped: 0.  Passed: 0.
> > One or more tests were cancelled.
> >
> > =ERROR REPORT==== 12-Jun-2014::08:10:16 ===
> > Error in process <0.185.0> on node 'dilbert@REDACTED' with exit value:
> >
> {undef,[{eunit_test,mf_wrapper,[my_test,fib_test_],[]},{eunit_data,parse,1,[{file,"eunit_data.erl"},{line,245}]},{eunit_data,next,1,[{file,"eunit_data.erl"},{line,170}]},{eunit_data,lookahead,1,[{file,"eunit_data.erl"},{line...
> >
> >
> > error
> >
> > The test module is the fib example from the doc page:
> >
> > -module(my_test).
> >
> > -include_lib("eunit/include/eunit.hrl").
> >
> > -export([fib/1]).
> >
> > fib(0) -> 1;
> >    fib(1) -> 1;
> >    fib(N) when N > 1 -> fib(N-1) + fib(N-2).
> >
> > fib_test_() ->
> >    [?_assert(fib(0) =:= 1),
> >     ?_assert(fib(1) =:= 1),
> >     ?_assert(fib(2) =:= 2),
> >     ?_assert(fib(3) =:= 3),
> >     ?_assert(fib(4) =:= 5),
> >     ?_assert(fib(5) =:= 8),
> >     ?_assertException(error, function_clause, fib(-1)),
> >     ?_assert(fib(31) =:= 2178309)
> >        ].
> >
> > Does anyone know what can be wrong? Thanks in advance for your time.
> >
> > Regards,
> > Martin
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140613/e90f6850/attachment.htm>


More information about the erlang-questions mailing list