eunit question

Amit Murthy amit.murthy@REDACTED
Sun Aug 16 14:24:47 CEST 2009


My bad.

Seems like the default timeout for a single test is 5 seconds. I increased
it using the "timeout" test descriptor and things are OK now.

But I still don't understand why my erlang console should just hang after
the "met_fb:request_content_ban_test...*timed out*" message is printed.

  Amit

On Sun, Aug 16, 2009 at 3:32 PM, Amit Murthy <amit.murthy@REDACTED> wrote:

> Hi,
>
> I am using eunit for some simple tests and within a test have a need to
> sleep for a couple of seconds, i.e. the test function flows something like
> this:
>
> func_test() ->
>  some erlang code...
>  wait_for_2_seconds(),
>  some more erlang code....
>
>
> To implement the wait_for_2_seconds() I have tried
>   receive after 2000 -> ok end,            and
>    timer:sleep(2000),
>    as well as writing a simple spin wait function that just does idle
> recursive execution in place for 2 seconds.
>
> All of the above basically result in my eunit test function just hanging
> forever and the last line printed on screen is
>
> met_fb:request_content_ban_test...*timed out*
>
> where met_fb is the module under test and request_content_ban_test is the
> test function.
>
> The actual test function is
>
> request_content_ban_test() ->
>     ?debugFmt("~n~nTEST : request_content_ban", []),
>     ok = request_content_ban(2, 1, 1, 2, 1),
>     ok = request_content_ban(3, 1, 1, 3, 2),
>
>     % spin loop for 2 seconds
>     spin_loop(epoch_secs(), 2),
>
>     ?debugFmt("~n~nTEST : get_content_to_review", []),
>     Now = epoch_secs(),
>     [2,3] = get_content_to_review(1, 1, Now - 120),
>
>
>     ok = request_content_ban(4, 1, 1, 9, 3),
>     [4] = get_content_to_review(1, 1, Now - 1).
>
>
>
> Would appreciate any help in figuring out what is going on here.
>
> Regards,
>   Amit
>


More information about the erlang-questions mailing list