[compiler-rt] 62309ed - [msan][test] Fix cpusetsize for another pthread_getaffinity_np.cpp test

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 20:08:11 PDT 2022


Author: Fangrui Song
Date: 2022-06-08T20:08:05-07:00
New Revision: 62309ed955e223d2d67754c1565e2295b0761164

URL: https://github.com/llvm/llvm-project/commit/62309ed955e223d2d67754c1565e2295b0761164
DIFF: https://github.com/llvm/llvm-project/commit/62309ed955e223d2d67754c1565e2295b0761164.diff

LOG: [msan][test] Fix cpusetsize for another pthread_getaffinity_np.cpp test

Similar to D127368

Added: 
    

Modified: 
    compiler-rt/test/msan/Linux/pthread_getaffinity_np.cpp
    compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/msan/Linux/pthread_getaffinity_np.cpp b/compiler-rt/test/msan/Linux/pthread_getaffinity_np.cpp
index 41adb7de5f91e..e87b898a7bc5d 100644
--- a/compiler-rt/test/msan/Linux/pthread_getaffinity_np.cpp
+++ b/compiler-rt/test/msan/Linux/pthread_getaffinity_np.cpp
@@ -6,10 +6,10 @@
 #include <sanitizer/msan_interface.h>
 
 int main() {
-  cpu_set_t set_x;
-  int res = pthread_getaffinity_np(pthread_self(), sizeof(set_x), &set_x);
+  cpu_set_t set_x[4];
+  int res = pthread_getaffinity_np(pthread_self(), sizeof(set_x), set_x);
   assert(res == 0);
-  __msan_check_mem_is_initialized(&set_x, sizeof(set_x));
+  __msan_check_mem_is_initialized(set_x, sizeof(set_x));
 
   return 0;
 }

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
index b9b072fa352a1..e878a8914cf73 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
@@ -5,10 +5,6 @@
 // sched_getaffinity).
 // UNSUPPORTED: android
 
-#ifndef _GNU_SOURCE
-#  define _GNU_SOURCE
-#endif
-
 #include <assert.h>
 #include <pthread.h>
 #include <sys/sysinfo.h>


        


More information about the llvm-commits mailing list