aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2015-06-09 18:46:15 -0700
committerChristopher Ferris <cferris@google.com>2015-06-09 18:46:15 -0700
commit511cfd9dc8cb41bca4920687c7d816ee916ee8e5 (patch)
tree802f0fa957f99a38068981600a7fc81f68f04950 /tests
parent26e663d4796e74fc40a62b3d2a438b726bbb056e (diff)
downloadandroid_bionic-511cfd9dc8cb41bca4920687c7d816ee916ee8e5.tar.gz
android_bionic-511cfd9dc8cb41bca4920687c7d816ee916ee8e5.tar.bz2
android_bionic-511cfd9dc8cb41bca4920687c7d816ee916ee8e5.zip
Allow NULL in pthread_mutex_lock/unlock.
The pthread_mutex_lock and pthread_mutex_unlock were allowed to fail silently on L 32 bit devices when passed a NULL. We changed this to a crash on 32 bit devices, but there are still games that make these calls and are not likely to be updated. Therefore, once again allow NULL to be passed in on 32 bit devices. Bug: 19995172 Change-Id: If7e8860075ecd63c0064d80f64e226fad7bd3c26
Diffstat (limited to 'tests')
-rw-r--r--tests/pthread_test.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 201b8a98d..8ae28d81e 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -1537,3 +1537,37 @@ TEST(pthread, pthread_types_allow_four_bytes_alignment) {
GTEST_LOG_(INFO) << "This test tests bionic implementation details.";
#endif
}
+
+TEST(pthread, pthread_mutex_lock_null_32) {
+#if defined(__BIONIC__) && !defined(__LP64__)
+ ASSERT_EQ(EINVAL, pthread_mutex_lock(NULL));
+#else
+ GTEST_LOG_(INFO) << "This test tests bionic implementation details on 32 bit devices.";
+#endif
+}
+
+TEST(pthread, pthread_mutex_unlock_null_32) {
+#if defined(__BIONIC__) && !defined(__LP64__)
+ ASSERT_EQ(EINVAL, pthread_mutex_unlock(NULL));
+#else
+ GTEST_LOG_(INFO) << "This test tests bionic implementation details on 32 bit devices.";
+#endif
+}
+
+TEST_F(pthread_DeathTest, pthread_mutex_lock_null_64) {
+#if defined(__BIONIC__) && defined(__LP64__)
+ pthread_mutex_t* null_value = nullptr;
+ ASSERT_EXIT(pthread_mutex_lock(null_value), testing::KilledBySignal(SIGSEGV), "");
+#else
+ GTEST_LOG_(INFO) << "This test tests bionic implementation details on 64 bit devices.";
+#endif
+}
+
+TEST_F(pthread_DeathTest, pthread_mutex_unlock_null_64) {
+#if defined(__BIONIC__) && defined(__LP64__)
+ pthread_mutex_t* null_value = nullptr;
+ ASSERT_EXIT(pthread_mutex_unlock(null_value), testing::KilledBySignal(SIGSEGV), "");
+#else
+ GTEST_LOG_(INFO) << "This test tests bionic implementation details on 64 bit devices.";
+#endif
+}