[compiler-rt] 19c1d03 - tsan: ignore some errors in the clone_setns test

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 12 05:12:40 PST 2021


Author: Dmitry Vyukov
Date: 2021-11-12T14:12:36+01:00
New Revision: 19c1d03f97188206c96a5a54bbe4a8b5a9643d27

URL: https://github.com/llvm/llvm-project/commit/19c1d03f97188206c96a5a54bbe4a8b5a9643d27
DIFF: https://github.com/llvm/llvm-project/commit/19c1d03f97188206c96a5a54bbe4a8b5a9643d27.diff

LOG: tsan: ignore some errors in the clone_setns test

Some bots failed with:
unshare failed: 1
https://lab.llvm.org/buildbot/#/builders/70/builds/14101

Look only for the target EINVAL error.

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

Added: 
    

Modified: 
    compiler-rt/test/tsan/Linux/clone_setns.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/tsan/Linux/clone_setns.cpp b/compiler-rt/test/tsan/Linux/clone_setns.cpp
index 25e30345cce9..88acb6917d45 100644
--- a/compiler-rt/test/tsan/Linux/clone_setns.cpp
+++ b/compiler-rt/test/tsan/Linux/clone_setns.cpp
@@ -11,7 +11,10 @@
 #include <sys/wait.h>
 
 static int cloned(void *arg) {
-  if (unshare(CLONE_NEWUSER)) {
+  // Unshare can fail for other reasons, e.g. no permissions,
+  // so check only the error we are interested in:
+  // if the process is multi-threaded unshare must return EINVAL.
+  if (unshare(CLONE_NEWUSER) && errno == EINVAL) {
     fprintf(stderr, "unshare failed: %d\n", errno);
     exit(1);
   }


        


More information about the llvm-commits mailing list