[clangd] Express ASAN interactions of tests more clearly. NFC
authorSam McCall <sam.mccall@gmail.com>
Thu, 19 Nov 2020 19:14:40 +0000 (20:14 +0100)
committerSam McCall <sam.mccall@gmail.com>
Thu, 19 Nov 2020 19:14:51 +0000 (20:14 +0100)
clang-tools-extra/clangd/unittests/SerializationTests.cpp

index c4995cd..f866635 100644 (file)
@@ -305,7 +305,9 @@ TEST(SerializationTest, CmdlTest) {
   }
 }
 
-#if LLVM_ON_UNIX // rlimit is part of POSIX
+// rlimit is part of POSIX.
+// ASan uses a lot of address space, so we can't apply strict limits.
+#if LLVM_ON_UNIX && !LLVM_ADDRESS_SANITIZER_BUILD
 class ScopedMemoryLimit {
   struct rlimit OriginalLimit;
   bool Succeeded = false;
@@ -333,7 +335,6 @@ public:
 };
 #endif
 
-#ifndef LLVM_ADDRESS_SANITIZER_BUILD
 // Test that our deserialization detects invalid array sizes without allocating.
 // If this detection fails, the test should allocate a huge array and crash.
 TEST(SerializationTest, NoCrashOnBadArraySize) {
@@ -424,7 +425,6 @@ TEST(SerializationTest, NoCrashOnBadStringTableSize) {
   EXPECT_THAT(llvm::toString(CorruptParsed.takeError()),
               testing::HasSubstr("bytes is implausible"));
 }
-#endif
 
 } // namespace
 } // namespace clangd