Trivial pthread_setaffinity_np()/sched_setaffinity() test.
Change-Id: I56cf56941e226d6ce10e8082ce944b549d4bb85d
diff --git a/tests/sched_test.cpp b/tests/sched_test.cpp
index 8e65057..448fae9 100644
--- a/tests/sched_test.cpp
+++ b/tests/sched_test.cpp
@@ -328,3 +328,12 @@
ASSERT_ERRNO(EINVAL);
#pragma clang diagnostic pop
}
+
+TEST(pthread, sched_setaffinity) {
+ cpu_set_t set;
+ CPU_ZERO(&set);
+ ASSERT_EQ(0, sched_getaffinity(getpid(), 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, sched_setaffinity(getpid(), sizeof(set), &set));
+}