summaryrefslogtreecommitdiffstats
path: root/tests/pthread_test.cpp
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2013-08-15 14:51:16 -0700
committerElliott Hughes <enh@google.com>2013-08-15 15:34:22 -0700
commit9b06cc3c1b2c4e2b08582f3fc9393a05aa589766 (patch)
tree230f8e9cadd5dbd6a854b9e7c63f9707a4f84400 /tests/pthread_test.cpp
parentcf0529946a0ffd07e94785102965656768e455e1 (diff)
downloadbionic-9b06cc3c1b2c4e2b08582f3fc9393a05aa589766.zip
bionic-9b06cc3c1b2c4e2b08582f3fc9393a05aa589766.tar.gz
bionic-9b06cc3c1b2c4e2b08582f3fc9393a05aa589766.tar.bz2
Fix pthread_getcpuclockid.
clock_gettime was returning EINVAL for the values produced by pthread_getcpuclockid. Bug: 10346183 Change-Id: Iabe643d7d46110bb311a0367aa0fc737f653208e
Diffstat (limited to 'tests/pthread_test.cpp')
-rw-r--r--tests/pthread_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index c7dbdc7..d4d38f5 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -278,6 +278,16 @@ TEST(pthread, pthread_detach__no_such_thread) {
ASSERT_EQ(ESRCH, pthread_detach(dead_thread));
}
+TEST(pthread, pthread_getcpuclockid__clock_gettime) {
+ pthread_t t;
+ ASSERT_EQ(0, pthread_create(&t, NULL, SleepFn, reinterpret_cast<void*>(5)));
+
+ clockid_t c;
+ ASSERT_EQ(0, pthread_getcpuclockid(t, &c));
+ timespec ts;
+ ASSERT_EQ(0, clock_gettime(c, &ts));
+}
+
TEST(pthread, pthread_getcpuclockid__no_such_thread) {
pthread_t dead_thread;
MakeDeadThread(dead_thread);