[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EUnit failure?

From: Romain Lenglet
Subject: Re: EUnit failure?
Date: Wed, 19 Aug 2009 10:56:36 +0900
User-agent: Thunderbird (Macintosh/20090605)

Ralf Wildenhues wrote:
> Hi Romain,
> * Romain Lenglet wrote on Tue, Aug 18, 2009 at 02:55:05PM CEST:
>> I can't reproduce an error message like the one above. I don't understand 
>> what 
>> is hapening.
>> Can you please try to compile and run the my_testsuite.erl by hand?
>> $ erlc my_testsuite.erl   # produces a my_testsuite.beam
> Works, exits 0, produces no stdout/stderr output, and a file
> my_testsuite.beam.
>> $ erl -s my_testsuite test    # runs the test, and should exit with code 1:
> $ erl -s my_testsuite test
> Erlang (BEAM) emulator version 5.5.5 [source] [64-bit] [async-threads:0]
> [kernel-poll:false]
> {"init terminating in
> do_boot",{undef,[{init,stop,"M"},{init,start_it,1},{init,start_em,1}]}}
> Crash dump was written to: erl_crash.dump
> init terminating in do_boot ()
> $

I got access to an Ubuntu Hardy x86_64 box, with the same erlang-base
package version as you run. And I can reproduce the bug.

The reason is that, in that version of Erlang/OTP (R12), the init:stop()
function doesn't take any argument. Only the more recent versions take
the exit code as an argument. The "M" in the error message is because
the test program calls init:stop(77) (character M has ASCII code 77),
and that fails because no arg is allowed.

So I can't either use init:stop() alone, because that always return with
code 0, nor halt(ReturnValue), because that truncates the standard
output (which is bad, since eunit writes information users need on the
standard output).

The solution I have is to write the return result into a temp file
(conftest.out), and call init:stop() with no arg to cleanly flush the
standard output and exit with code 0. And then macro will do a
AT_CHECK() to test the contents of conftest.out to know the results of
the test (0, 1 or 77).
I will send you a patch soon to do that.

> Produces a file erl_crash.dump (I think I sent to you before).
> Maybe I should report a bug with Ubuntu?

The bug is in my code.

Thanks for your help fixing this!

Romain Lenglet

reply via email to

[Prev in Thread] Current Thread [Next in Thread]