[compiler-rt] 61f594e - [NFC, msan] Increase stack in small stack tests
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 19:42:07 PDT 2020
Author: Vitaly Buka
Date: 2020-04-15T19:41:57-07:00
New Revision: 61f594e45a5d38b04ea050d7a6d98154dfdd6730
URL: https://github.com/llvm/llvm-project/commit/61f594e45a5d38b04ea050d7a6d98154dfdd6730
DIFF: https://github.com/llvm/llvm-project/commit/61f594e45a5d38b04ea050d7a6d98154dfdd6730.diff
LOG: [NFC, msan] Increase stack in small stack tests
Test fails in our setup if used with libunwind.
It needs just few bytest to pass.
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 2d67b6ff645a..53b9a3e563e9 100644
--- a/compiler-rt/lib/msan/tests/msan_test.cpp
+++ b/compiler-rt/lib/msan/tests/msan_test.cpp
@@ -3275,11 +3275,9 @@ static void *SmallStackThread_threadfn(void* data) {
}
#ifdef PTHREAD_STACK_MIN
-# define SMALLSTACKSIZE PTHREAD_STACK_MIN
-# define SMALLPRESTACKSIZE PTHREAD_STACK_MIN
+constexpr int kThreadStackMin = PTHREAD_STACK_MIN;
#else
-# define SMALLSTACKSIZE 64 * 1024
-# define SMALLPRESTACKSIZE 16 * 1024
+constexpr int kThreadStackMin = 0;
#endif
TEST(MemorySanitizer, SmallStackThread) {
@@ -3289,7 +3287,7 @@ TEST(MemorySanitizer, SmallStackThread) {
int res;
res = pthread_attr_init(&attr);
ASSERT_EQ(0, res);
- res = pthread_attr_setstacksize(&attr, SMALLSTACKSIZE);
+ res = pthread_attr_setstacksize(&attr, std::max(kThreadStackMin, 64 * 1024));
ASSERT_EQ(0, res);
res = pthread_create(&t, &attr, SmallStackThread_threadfn, NULL);
ASSERT_EQ(0, res);
@@ -3306,7 +3304,7 @@ TEST(MemorySanitizer, SmallPreAllocatedStackThread) {
res = pthread_attr_init(&attr);
ASSERT_EQ(0, res);
void *stack;
- const size_t kStackSize = SMALLPRESTACKSIZE;
+ const size_t kStackSize = std::max(kThreadStackMin, 32 * 1024);
res = posix_memalign(&stack, 4096, kStackSize);
ASSERT_EQ(0, res);
res = pthread_attr_setstack(&attr, stack, kStackSize);
More information about the llvm-commits
mailing list