diff options
author | Elliott Hughes <enh@google.com> | 2016-02-05 11:18:41 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2016-02-05 11:18:41 -0800 |
commit | 43f7c875654cb94e589ff9d0c4ac58ca9616093e (patch) | |
tree | b59e65b86870ef89c3965f32b18c52910f6038b4 /tests/time_test.cpp | |
parent | b90837c3d316c6ea8d6f0b0b6a3643d0d3245a0e (diff) |
Add a test for snprintf on a PTHREAD_STACK_MIN-sized stack.
This is a common thing for people to want to do, snprintf requires
a lot of stack for itself, and PTHREAD_STACK_MIN should be usable
for realistic code.
Change-Id: Ib09cfb4e0beec1c69ee0944c3ea4c5d03a94c491
Diffstat (limited to 'tests/time_test.cpp')
-rw-r--r-- | tests/time_test.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/time_test.cpp b/tests/time_test.cpp index ec1b54908..6cdabd219 100644 --- a/tests/time_test.cpp +++ b/tests/time_test.cpp @@ -59,19 +59,13 @@ TEST(time, gmtime_no_stack_overflow_14313703) { // Is it safe to call tzload on a thread with a small stack? // http://b/14313703 // https://code.google.com/p/android/issues/detail?id=61130 - pthread_attr_t attributes; - ASSERT_EQ(0, pthread_attr_init(&attributes)); -#if defined(__BIONIC__) - ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, PTHREAD_STACK_MIN)); -#else - // PTHREAD_STACK_MIN not currently in the host GCC sysroot. - ASSERT_EQ(0, pthread_attr_setstacksize(&attributes, 4 * getpagesize())); -#endif + pthread_attr_t a; + ASSERT_EQ(0, pthread_attr_init(&a)); + ASSERT_EQ(0, pthread_attr_setstacksize(&a, PTHREAD_STACK_MIN)); pthread_t t; - ASSERT_EQ(0, pthread_create(&t, &attributes, gmtime_no_stack_overflow_14313703_fn, NULL)); - void* result; - ASSERT_EQ(0, pthread_join(t, &result)); + ASSERT_EQ(0, pthread_create(&t, &a, gmtime_no_stack_overflow_14313703_fn, NULL)); + ASSERT_EQ(0, pthread_join(t, nullptr)); } TEST(time, mktime_empty_TZ) { |