[erlang-patches] eunit: fix race conditions

Klas Johansson <>
Mon Apr 18 11:06:39 CEST 2011


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


More information about the erlang-patches mailing list