From 098638cc6ca85c54465f34dd0c8e1cd8ff9ba4c7 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Fri, 16 Aug 2024 21:18:26 -0700 Subject: [PATCH] Fix pthread_kill_test flake on qemu --- libc/stdio/fleaks.c | 3 +++ test/libc/thread/footek_test.c | 32 +++++++++++++++---------------- tool/emacs/cosmo-cpp-constants.el | 1 + 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/libc/stdio/fleaks.c b/libc/stdio/fleaks.c index 20a1d4a7b..462c6ddb7 100644 --- a/libc/stdio/fleaks.c +++ b/libc/stdio/fleaks.c @@ -17,6 +17,7 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" +#include "libc/dce.h" #include "libc/errno.h" #include "libc/fmt/itoa.h" #include "libc/runtime/runtime.h" @@ -31,6 +32,8 @@ void CheckForFileLeaks(void) { char *p = msg; char *pe = msg + 256; bool gotsome = false; + if (IsQemuUser()) + usleep(1); // weird qemu mt flake for (int fd = 3; fd < MIN_CLANDESTINE_FD; ++fd) { if (fcntl(fd, F_GETFL) != -1) { if (!gotsome) { diff --git a/test/libc/thread/footek_test.c b/test/libc/thread/footek_test.c index acaae0727..029e46522 100644 --- a/test/libc/thread/footek_test.c +++ b/test/libc/thread/footek_test.c @@ -14,22 +14,22 @@ // with futexes // 30 threads / 100000 iterations // -// 54,183 us real -// 84,723 us user -// 741,667 us sys -// footek_test on studio.test. 609 µs 14'106 µs 65'607 µs -// 406,588 us real -// 884,696 us user -// 720,567 us sys -// footek_test on pi5.test. 334 µs 13'398 µs 408'450 µs -// 1,253,808 us real -// 3,608,426 us user -// 1,378,765 us sys -// footek_test on freebsdarm.test. 367 µs 16'466 µs 1'287'915 µs -// 1,316,058 us real -// 3,286,528 us user -// 1,738,756 us sys -// footek_test on pi.test. 450 µs 16'787 µs 1'338'420 µs +// 46,481 us real +// 68,745 us user +// 586,871 us sys +// footek_test on studio.test. 585 µs 13'597 µs 57'473 µs +// 389,619 us real +// 839,848 us user +// 679,112 us sys +// footek_test on pi5.test. 335 µs 13'034 µs 432'358 µs +// 463,799 us real +// 1,259,267 us user +// 547,681 us sys +// footek_test on pi.test. 479 µs 16'539 µs 476'395 µs +// 1,256,134 us real +// 3,770,473 us user +// 1,214,755 us sys +// footek_test on freebsdarm.test. 364 µs 16'898 µs 1'288'594 µs // arm fleet // without futexes diff --git a/tool/emacs/cosmo-cpp-constants.el b/tool/emacs/cosmo-cpp-constants.el index 106c8bc17..80636c337 100644 --- a/tool/emacs/cosmo-cpp-constants.el +++ b/tool/emacs/cosmo-cpp-constants.el @@ -73,6 +73,7 @@ "__BMI2__" "__FMA__" "__FAST_MATH__" + "__FINITE_MATH_ONLY__" "__ROUNDING_MATH__" "__NO_MATH_ERRNO__" "__FMA4__"