diff options
author | Yabin Cui <yabinc@google.com> | 2015-02-03 10:32:00 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2015-02-03 12:20:46 -0800 |
commit | 140f3678f0f21eeda5916e9b8de87b93fd660a61 (patch) | |
tree | 4115c771e910e8969cb093fa124df987259bad3c /tests/pthread_test.cpp | |
parent | 86fc96f73311f43980df770f4ff8022f1e9b296a (diff) | |
download | bionic-140f3678f0f21eeda5916e9b8de87b93fd660a61.zip bionic-140f3678f0f21eeda5916e9b8de87b93fd660a61.tar.gz bionic-140f3678f0f21eeda5916e9b8de87b93fd660a61.tar.bz2 |
Add test about pthread_mutex_t owner tid limit.
Bug: 19216648
Change-Id: I7b12955bdcad31c13bf8ec2740ff88ba15223ec0
Diffstat (limited to 'tests/pthread_test.cpp')
-rw-r--r-- | tests/pthread_test.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp index cb32079..5dc60ee 100644 --- a/tests/pthread_test.cpp +++ b/tests/pthread_test.cpp @@ -27,6 +27,7 @@ #include <malloc.h> #include <pthread.h> #include <signal.h> +#include <stdio.h> #include <sys/mman.h> #include <sys/syscall.h> #include <time.h> @@ -1092,3 +1093,14 @@ TEST(pthread, pthread_mutex_lock_RECURSIVE) { ASSERT_EQ(EPERM, pthread_mutex_unlock(&lock)); ASSERT_EQ(0, pthread_mutex_destroy(&lock)); } + +TEST(pthread, pthread_mutex_owner_tid_limit) { + FILE* fp = fopen("/proc/sys/kernel/pid_max", "r"); + ASSERT_TRUE(fp != NULL); + long pid_max; + ASSERT_EQ(1, fscanf(fp, "%ld", &pid_max)); + fclose(fp); + // Current pthread_mutex uses 16 bits to represent owner tid. + // Change the implementation if we need to support higher value than 65535. + ASSERT_LE(pid_max, 65536); +} |