tsan: don't use pipe2 in tests
authorDmitry Vyukov <dvyukov@google.com>
Fri, 24 Sep 2021 15:48:48 +0000 (17:48 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Fri, 24 Sep 2021 15:52:16 +0000 (17:52 +0200)
MacOS buildbots failed:
stress.cpp:57:7: error: use of undeclared identifier 'pipe2'
https://green.lab.llvm.org/green//job/clang-stage1-RA/24209/consoleFull#-3468768778254eaf0-7326-4999-85b0-388101f2d404

Fix the test to not use pipe2.

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

compiler-rt/test/tsan/stress.cpp

index 0565c67..d678395 100644 (file)
@@ -54,8 +54,12 @@ void *Thread(void *x) {
 
 int main() {
   ANNOTATE_BENIGN_RACE(stop);
-  if (pipe2(fds, O_NONBLOCK))
-    exit((perror("pipe2"), 1));
+  if (pipe(fds))
+    exit((perror("pipe"), 1));
+  if (fcntl(fds[0], F_SETFL, O_NONBLOCK))
+    exit((perror("fcntl"), 1));
+  if (fcntl(fds[1], F_SETFL, O_NONBLOCK))
+    exit((perror("fcntl"), 1));
   const int kActions = 9;
   const int kMultiplier = 4;
   pthread_t t[kActions * kMultiplier];