Skip to content
Snippets Groups Projects
  1. Feb 23, 2016
  2. Feb 22, 2016
  3. Feb 20, 2016
  4. Feb 19, 2016
  5. Feb 18, 2016
  6. Feb 17, 2016
  7. Feb 13, 2016
  8. Feb 12, 2016
  9. Feb 10, 2016
    • Mike Pennisi's avatar
      Runner: Re-use lock to share access to stdout · b791cc4f
      Mike Pennisi authored
      When executing multiple tests in parallel, each "child" thread would
      write to the process's standard output buffer immediately upon test
      completion. Because thread execution order and instruction interleaving
      is non-deterministic, this made it possible for characters to be emitted
      out-of-order.
      
      When extended to support multiple concurrent threads, the runner was
      outfitted with a "log lock" dedicated to sharing access to the output
      file (when applicable). Re-use this lock when writing to standard out,
      ensuring proper ordering of test result messages.
      b791cc4f
    • Mike Pennisi's avatar
      Test runner: Avoid race condition · 21781289
      Mike Pennisi authored
      A recent extension to the test runner introduced support for running
      tests in parallel using multi-threading. Following this, the runner
      would incorrectly emit the "final report" before all individual test
      results.
      
      In order to emit the "final report" at the end of the output stream, the
      parent thread would initialize all children and wait for availability of
      a "log lock" shared by all children.
      
      According to the documentation on the "threading" module's Lock object
      [1]:
      
      > When more than one thread is blocked in acquire() waiting for the state
      > to turn to unlocked, only one thread proceeds when a release() call
      > resets the state to unlocked; which one of the waiting threads proceeds
      > is not defined, and may vary across implementations.
      
      This means the primitive cannot be used by the parent thread to reliably
      detect completion of all child threads.
      
      Update the parent to maintain a reference for each child thread, and to
      explicitly wait for every child thread to complete before emitting the
      final result.
      
      [1] https://docs.python.org/2/library/threading.html#lock-objects
      21781289
Loading