diff options
author | Elliott Hughes <enh@google.com> | 2014-11-12 21:03:26 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-11-12 21:03:26 -0800 |
commit | 68d98d832b7935ed5be23836c481a14f00b19ef1 (patch) | |
tree | 8055b8a2ba805a99544318feca3d7d894fe93955 /tests/pthread_test.cpp | |
parent | 92a585c91a83e63949431c617de936742b080150 (diff) |
Assume glibc >= 2.15.
This catches one trivial difference between us and glibc --- the error
returned by pthread_setname_np for an invalid pthread_t.
Change-Id: If4c21e22107c6488333d11184f8005f8669096c2
Diffstat (limited to 'tests/pthread_test.cpp')
-rw-r--r-- | tests/pthread_test.cpp | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp index 379e49519..b5e12a548 100644 --- a/tests/pthread_test.cpp +++ b/tests/pthread_test.cpp @@ -359,50 +359,26 @@ TEST(pthread, pthread_sigmask) { ASSERT_EQ(0, pthread_sigmask(SIG_SETMASK, &original_set, NULL)); } -#if defined(__BIONIC__) -#define HAVE_PTHREAD_SETNAME_NP -#elif defined(__GLIBC__) -#if __GLIBC_PREREQ(2, 12) -#define HAVE_PTHREAD_SETNAME_NP -#endif -#endif - TEST(pthread, pthread_setname_np__too_long) { -#if defined(HAVE_PTHREAD_SETNAME_NP) ASSERT_EQ(ERANGE, pthread_setname_np(pthread_self(), "this name is far too long for linux")); -#else - GTEST_LOG_(INFO) << "This test does nothing.\n"; -#endif } TEST(pthread, pthread_setname_np__self) { -#if defined(HAVE_PTHREAD_SETNAME_NP) ASSERT_EQ(0, pthread_setname_np(pthread_self(), "short 1")); -#else - GTEST_LOG_(INFO) << "This test does nothing.\n"; -#endif } TEST(pthread, pthread_setname_np__other) { -#if defined(HAVE_PTHREAD_SETNAME_NP) pthread_t t1; ASSERT_EQ(0, pthread_create(&t1, NULL, SleepFn, reinterpret_cast<void*>(5))); ASSERT_EQ(0, pthread_setname_np(t1, "short 2")); -#else - GTEST_LOG_(INFO) << "This test does nothing.\n"; -#endif } TEST(pthread, pthread_setname_np__no_such_thread) { -#if defined(HAVE_PTHREAD_SETNAME_NP) pthread_t dead_thread; MakeDeadThread(dead_thread); // Call pthread_setname_np after thread has already exited. - ASSERT_EQ(ESRCH, pthread_setname_np(dead_thread, "short 3")); -#else - GTEST_LOG_(INFO) << "This test does nothing.\n"; -#endif + ASSERT_EQ(ENOENT, pthread_setname_np(dead_thread, "short 3")); } TEST(pthread, pthread_kill__0) { |