Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Unified Diff: base/threading/thread_unittest.cc

Issue 2395303002: Scale Stack Limits in ThreadTest.StartWithOptions_StackSize with Bitness (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698