Trivial pthread_setaffinity_np()/sched_setaffinity() test.
Change-Id: I56cf56941e226d6ce10e8082ce944b549d4bb85d
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 4c59bd4..5ce7d4d 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -3164,3 +3164,12 @@
ASSERT_ERRNO(0);
#pragma clang diagnostic pop
}
+
+TEST(pthread, pthread_setaffinity) {
+ cpu_set_t set;
+ CPU_ZERO(&set);
+ ASSERT_EQ(0, pthread_getaffinity_np(pthread_self(), sizeof(set), &set));
+ // It's hard to make any more general claim than this,
+ // but it ought to be safe to ask for the same affinity you already have.
+ ASSERT_EQ(0, pthread_setaffinity_np(pthread_self(), sizeof(set), &set));
+}