Index: base/threading/thread_unittest.cc |
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc |
index 0867a6401e9d0a3a52491c21fb9c6d912b73c07c..92ccc87d2b581b76da8e083f9dc179744cbf6c92 100644 |
--- a/base/threading/thread_unittest.cc |
+++ b/base/threading/thread_unittest.cc |
@@ -5,6 +5,7 @@ |
#include "base/threading/thread.h" |
#include <stddef.h> |
+#include <stdint.h> |
#include <vector> |
@@ -136,14 +137,16 @@ void ReturnThreadId(base::Thread* thread, |
TEST_F(ThreadTest, StartWithOptions_StackSize) { |
Thread a("StartWithStackSize"); |
// Ensure that the thread can work with only 12 kb and still process a |
- // message. |
+ // message. At the same time, we should scale with the bitness of the system |
+ // where 12 kb is definitely not enough. |
+ // 12 kb = 3072 Slots on a 32-bit system, so we'll scale based off of that. |
Thread::Options options; |
#if defined(ADDRESS_SANITIZER) || !defined(NDEBUG) |
- // ASan bloats the stack variables and overflows the 12 kb stack. Some debug |
- // builds also grow the stack too much. |
- options.stack_size = 24*1024; |
+ // ASan bloats the stack variables and overflows the 3072 slot stack. Some |
+ // debug builds also grow the stack too much. |
+ options.stack_size = 2 * 3072 * sizeof(uintptr_t); |
#else |
- options.stack_size = 12*1024; |
+ options.stack_size = 3072 * sizeof(uintptr_t); |
#endif |
EXPECT_TRUE(a.StartWithOptions(options)); |
EXPECT_TRUE(a.message_loop()); |