Trivial "can we get the cpu affinity mask?" tests.
Given that we're executing, it's a safe bet that our affinity mask includes at least one cpu...
Change-Id: I2a714c84458771e4ad2e1dc7a60ce7c0c81c55ab
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 1421365..4c59bd4 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -3148,6 +3148,13 @@
#pragma clang diagnostic pop
}
+TEST(pthread, pthread_getaffinity) {
+ cpu_set_t set;
+ CPU_ZERO(&set);
+ ASSERT_EQ(0, pthread_getaffinity_np(pthread_self(), sizeof(set), &set));
+ ASSERT_GT(CPU_COUNT(&set), 0);
+}
+
TEST(pthread, pthread_setaffinity_np_failure) {
// Trivial test of the errno-preserving/returning behavior.
#pragma clang diagnostic push