[asan] Fix test compilation on Android API <= 17
authorShoaib Meenai <smeenai@fb.com>
Tue, 28 Jan 2020 01:25:38 +0000 (17:25 -0800)
committerShoaib Meenai <smeenai@fb.com>
Tue, 28 Jan 2020 22:36:19 +0000 (14:36 -0800)
mlockall and munlockall were introduced in Android API 17, so avoid
referencing them on prior versions.

Differential Revision: https://reviews.llvm.org/D73515

compiler-rt/lib/asan/tests/asan_test.cpp

index 47bba08..eb3ded3 100644 (file)
@@ -1157,9 +1157,13 @@ TEST(AddressSanitizer, DISABLED_StressStackReuseAndExceptionsTest) {
 
 #if !defined(_WIN32)
 TEST(AddressSanitizer, MlockTest) {
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 17
   EXPECT_EQ(0, mlockall(MCL_CURRENT));
+#endif
   EXPECT_EQ(0, mlock((void*)0x12345, 0x5678));
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 17
   EXPECT_EQ(0, munlockall());
+#endif
   EXPECT_EQ(0, munlock((void*)0x987, 0x654));
 }
 #endif