Quantcast

eunit: fix race conditions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

eunit: fix race conditions

Klas Johansson
Hi,

When playing around with eunit's surefire XML reports I
noticed that the files are sometimes not generated and
I decided to have a look:

  Wait until all eunit listeners terminate

  Ensure that all eunit listeners (like
  eunit_surefire) get the chance to finish their work
  before terminating.  Prior to this fix, the
  eunit_surefire XML was sometimes not generated.

While addressing that problem I also noticed the
following:

  Don't let eunit_surefire report back to eunit when stopping

  When eunit is terminating, a stop message is sent
  to all listeners and eunit then waits for *one*
  result message but previously both eunit_tty and
  eunit_surefire sent a response on error.  Don't
  send a result message from eunit_surefire; let
  eunit_tty take care of all result reporting, both
  positive and negative to avoid race conditions and
  inconsistencies.

Tested manually by running eunit with surefire report
generation over and over again (with a timer:sleep/1
inserted to make sure that XML file generation takes
time to complete).


Code here:

   git fetch git://github.com/klajo/otp.git eunit-race-cond



Cheers,
Klas
_______________________________________________
erlang-patches mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-patches
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: eunit: fix race conditions

Henrik Nord-2
On 04/18/2011 11:06 AM, Klas Johansson wrote:

> Hi,
>
> When playing around with eunit's surefire XML reports I
> noticed that the files are sometimes not generated and
> I decided to have a look:
>
>    Wait until all eunit listeners terminate
>
>    Ensure that all eunit listeners (like
>    eunit_surefire) get the chance to finish their work
>    before terminating.  Prior to this fix, the
>    eunit_surefire XML was sometimes not generated.
>
> While addressing that problem I also noticed the
> following:
>
>    Don't let eunit_surefire report back to eunit when stopping
>
>    When eunit is terminating, a stop message is sent
>    to all listeners and eunit then waits for *one*
>    result message but previously both eunit_tty and
>    eunit_surefire sent a response on error.  Don't
>    send a result message from eunit_surefire; let
>    eunit_tty take care of all result reporting, both
>    positive and negative to avoid race conditions and
>    inconsistencies.
>
> Tested manually by running eunit with surefire report
> generation over and over again (with a timer:sleep/1
> inserted to make sure that XML file generation takes
> time to complete).
>
>
> Code here:
>
>     git fetch git://github.com/klajo/otp.git eunit-race-cond
>
>
>
> Cheers,
> Klas
> _______________________________________________
> erlang-patches mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-patches
Hi
Thank you for the contribution!
you branch is now cooking in 'pu'

--
/Henrik Nord Erlang/OTP

_______________________________________________
erlang-patches mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-patches
Loading...