[compiler-rt] a86b171 - [msan][test] Use a large cpusetsize for pthread_getaffinity_np
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 8 18:50:31 PDT 2022
Author: Fangrui Song
Date: 2022-06-08T18:50:23-07:00
New Revision: a86b171d8cd01ff2a003533d7d3e3d79ce22161e
URL: https://github.com/llvm/llvm-project/commit/a86b171d8cd01ff2a003533d7d3e3d79ce22161e
DIFF: https://github.com/llvm/llvm-project/commit/a86b171d8cd01ff2a003533d7d3e3d79ce22161e.diff
LOG: [msan][test] Use a large cpusetsize for pthread_getaffinity_np
pthread_getaffinity_np (Linux `kernel/sched/core.c:sched_getaffinity`) fails
with EINVAL if 8*cpusetsize (constant in glibc: 1024) is smaller than
`nr_cpu_ids` (CONFIG_NR_CPUS, which is 2048 for several arch/powerpc/configs
configurations).
The build bot clang-ppc64le-linux-lnt seems to have a larger `nr_cpu_ids`.
Differential Revision: https://reviews.llvm.org/D127368
Added:
Modified:
compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_getaffinity_np.cpp
Removed:
################################################################################
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 49c40d3287bc..b9b072fa352a 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
@@ -11,22 +11,16 @@
#include <assert.h>
#include <pthread.h>
-#include <stdio.h>
#include <sys/sysinfo.h>
#include <sanitizer/msan_interface.h>
int main() {
- cpu_set_t set_x;
+ cpu_set_t set_x[4];
pthread_t tid = pthread_self();
- int res = pthread_getaffinity_np(tid, sizeof(set_x), &set_x);
- if (res != 0) {
- fprintf(stderr, "tid: %lu\n", tid);
- fprintf(stderr, "sizeof(set_x): %d\n", sizeof(set_x));
- fprintf(stderr, "res: %d\n", res);
- }
+ int res = pthread_getaffinity_np(tid, sizeof(set_x), set_x);
assert(res == 0);
- assert(CPU_COUNT_S(sizeof(set_x), &set_x) == get_nprocs());
+ assert(CPU_COUNT_S(sizeof(set_x), set_x) == get_nprocs());
return 0;
}
More information about the llvm-commits
mailing list