[all-commits] [llvm/llvm-project] 261d21: [libc++] Fixes a flaky test.

Mark de Wever via All-commits all-commits at lists.llvm.org
Fri Feb 17 09:22:25 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 261d21f8c3754e148eaf6608d359ec6e56fa276c
      https://github.com/llvm/llvm-project/commit/261d21f8c3754e148eaf6608d359ec6e56fa276c
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2023-02-17 (Fri, 17 Feb 2023)

  Changed paths:
    M libcxx/test/std/thread/thread.condition/notify_all_at_thread_exit_lwg3343.pass.cpp

  Log Message:
  -----------
  [libc++] Fixes a flaky test.

While investigating the flaky tests on the mac backdeployment targets
it seems the tests are different than suggested in the LWG issue.
That tests "does work", grabs the mutex, marks the task as done, and
finally calls the notifier.
Our test emulated "does work" after the notification, effectively
sleeping with a lock held. This has been fixed.

A second improvement is that the test fails when, due to OS
scheduling, the condition variable is not used in the main thread.

During discussing the approach of the patch with @ldionne, he
noticed the real reason why the test is flaky; the Apple
backdeployment targets use a dylib, which does not contain the
fix. So the test can't be tested on that platform; it only
proves the LWG issue was correct and the Standard contained
a bug.

Reviewed By: ldionne, #libc

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




More information about the All-commits mailing list