[compiler-rt] a27398a - [PowerPC] Update MemorySanitizer test to cater for number of CPUs > 1024
Ahsan Saghir via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 13:29:28 PDT 2020
Author: Ahsan Saghir
Date: 2020-09-02T15:29:13-05:00
New Revision: a27398a8151dc553dae85ede12f966e5b981b64b
URL: https://github.com/llvm/llvm-project/commit/a27398a8151dc553dae85ede12f966e5b981b64b
DIFF: https://github.com/llvm/llvm-project/commit/a27398a8151dc553dae85ede12f966e5b981b64b.diff
LOG: [PowerPC] Update MemorySanitizer test to cater for number of CPUs > 1024
MemorySanitizer test fails on systems with more than 1024 CPUs.
This patch updates the test to make it work for machines that
have more than 1024 CPUs. This helps to fix errors on the PowerPC
sanitizer bot.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D87053
Added:
Modified:
compiler-rt/lib/msan/tests/msan_test.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/msan/tests/msan_test.cpp b/compiler-rt/lib/msan/tests/msan_test.cpp
index 53b9a3e563e9..4c98bb4861f2 100644
--- a/compiler-rt/lib/msan/tests/msan_test.cpp
+++ b/compiler-rt/lib/msan/tests/msan_test.cpp
@@ -3229,9 +3229,19 @@ TEST(MemorySanitizer, dlopenFailed) {
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
TEST(MemorySanitizer, sched_getaffinity) {
cpu_set_t mask;
- int res = sched_getaffinity(getpid(), sizeof(mask), &mask);
- ASSERT_EQ(0, res);
- EXPECT_NOT_POISONED(mask);
+ if (sched_getaffinity(getpid(), sizeof(mask), &mask) == 0)
+ EXPECT_NOT_POISONED(mask);
+ else {
+ // The call to sched_getaffinity() may have failed because the Affinity
+ // mask is too small for the number of CPUs on the system (i.e. the
+ // system has more than 1024 CPUs). Allocate a mask large enough for
+ // twice as many CPUs.
+ cpu_set_t *DynAffinity;
+ DynAffinity = CPU_ALLOC(2048);
+ int res = sched_getaffinity(getpid(), CPU_ALLOC_SIZE(2048), DynAffinity);
+ ASSERT_EQ(0, res);
+ EXPECT_NOT_POISONED(*DynAffinity);
+ }
}
#endif
More information about the llvm-commits
mailing list