[erlang-questions] EUnit/escript bug - fails to terminate long-running (infinite) test

Tim Bates tim@REDACTED
Thu Apr 26 15:01:12 CEST 2007


Hi,
I'm trying to use escript to simplify my makefiles. When trying to run 
eunit from an escript I found that it behaves differently to when called 
using erl.

The test:

infinite_loop_test() ->
     infinite_loop_test().


The escript call:

main(["eunit" | BeamFiles]) ->
     Paths = [filename:dirname(Beam) || Beam <- BeamFiles],
     code:add_pathsa(uniq(lists:sort(Paths))),
     Modules = [list_to_atom(filename:basename(Beam, ".beam")) || Beam 
<- BeamFiles],
     case eunit:test(Modules) of
         ok ->
             ok;
         error ->
             error;
         Other ->
             io:fwrite("~p~n", [Other])
     end;


The result:

When calling eunit:test(mytest) from within an Erlang shell I get

mytest:infinite_loop_test...*timed out*

=======================================================
   Failed: 0.  Aborted: 1.  Skipped: 0.  Succeeded: 0.
error

When running my escript I get as far as the "timed out" message and then 
it hangs - not using CPU, so the test isn't still running, but the 
script never terminates.

Any idea why eunit should behave differently when called from escript 
compared to the Erlang shell?

Thanks,
Tim.

-- 
Tim Bates
tim@REDACTED



More information about the erlang-questions mailing list