Add pthread_getaffinity_np()/pthread_setaffinity_np().

Bug: http://b/18536425
Change-Id: I033fe25044367db0a01db027e6234d29eb2e8b95
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 7223784..1421365 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -3137,3 +3137,23 @@
   GTEST_SKIP() << "bionic-only test";
 #endif
 }
+
+TEST(pthread, pthread_getaffinity_np_failure) {
+  // Trivial test of the errno-preserving/returning behavior.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
+  errno = 0;
+  ASSERT_EQ(EINVAL, pthread_getaffinity_np(pthread_self(), 0, nullptr));
+  ASSERT_ERRNO(0);
+#pragma clang diagnostic pop
+}
+
+TEST(pthread, pthread_setaffinity_np_failure) {
+  // Trivial test of the errno-preserving/returning behavior.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
+  errno = 0;
+  ASSERT_EQ(EINVAL, pthread_setaffinity_np(pthread_self(), 0, nullptr));
+  ASSERT_ERRNO(0);
+#pragma clang diagnostic pop
+}