Add pthread_setschedprio.
Bug: http://b/26204555
Test: ran tests
Change-Id: Ic34062b9b6036a1ce2642a069514bab48a893338
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index f342577..85978bd 100755
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -566,6 +566,18 @@
EXPECT_EQ(ESRCH, pthread_setschedparam(null_thread, policy, ¶m));
}
+TEST_F(pthread_DeathTest, pthread_setschedprio__no_such_thread) {
+ pthread_t dead_thread;
+ MakeDeadThread(dead_thread);
+
+ EXPECT_DEATH(pthread_setschedprio(dead_thread, 123), "invalid pthread_t");
+}
+
+TEST_F(pthread_DeathTest, pthread_setschedprio__null_thread) {
+ pthread_t null_thread = 0;
+ EXPECT_EQ(ESRCH, pthread_setschedprio(null_thread, 123));
+}
+
TEST_F(pthread_DeathTest, pthread_join__no_such_thread) {
pthread_t dead_thread;
MakeDeadThread(dead_thread);
@@ -2147,3 +2159,12 @@
ASSERT_EQ(0, munmap(pages[i], kPageSize));
}
}
+
+TEST(pthread, pthread_setschedparam) {
+ sched_param p = { .sched_priority = INT_MIN };
+ ASSERT_EQ(EINVAL, pthread_setschedparam(pthread_self(), INT_MIN, &p));
+}
+
+TEST(pthread, pthread_setschedprio) {
+ ASSERT_EQ(EINVAL, pthread_setschedprio(pthread_self(), INT_MIN));
+}