[all-commits] [llvm/llvm-project] 945bdb: [test] Remove problematic thread from MainLoopTest...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Fri Sep 2 10:32:03 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 945bdb167ff5d73559780acc2391dabb816ce9e1
      https://github.com/llvm/llvm-project/commit/945bdb167ff5d73559780acc2391dabb816ce9e1
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2022-09-02 (Fri, 02 Sep 2022)

  Changed paths:
    M lldb/unittests/Host/MainLoopTest.cpp

  Log Message:
  -----------
  [test] Remove problematic thread from MainLoopTest to fix flakiness

This test, specifically `TwoSignalCallbacks`, can be a little bit flaky, failing in around 5/2000 runs.

POSIX says:

> If the value of pid causes sig to be generated for the sending process, and if sig is not blocked for the calling thread and if no other thread has sig unblocked or is waiting in a sigwait() function for sig, either sig or at least one pending unblocked signal shall be delivered to the sending thread before kill() returns.

The problem is that in test setup, we create a new thread with `std::async` and that is occasionally not cleaned up. This leaves that thread available to eat the signal we're polling for.

The need for this to be async does not apply anymore, so we can just make it synchronous.

This makes the test passes in 10000 runs.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D133181




More information about the All-commits mailing list