[compiler-rt] 513644b - [scudo] Add TEST_SKIP macro to skip the current test (#96192)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 12:45:58 PDT 2024


Author: Fabio D'Urso
Date: 2024-06-21T21:45:53+02:00
New Revision: 513644b5a3cb9ce3440731796b52ccab7c18278e

URL: https://github.com/llvm/llvm-project/commit/513644b5a3cb9ce3440731796b52ccab7c18278e
DIFF: https://github.com/llvm/llvm-project/commit/513644b5a3cb9ce3440731796b52ccab7c18278e.diff

LOG: [scudo] Add TEST_SKIP macro to skip the current test (#96192)

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
    compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
    compiler-rt/lib/scudo/standalone/tests/strings_test.cpp
    compiler-rt/lib/scudo/standalone/tests/vector_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp b/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
index 37a18858e67c2..0613847f1e203 100644
--- a/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
@@ -19,10 +19,10 @@ namespace scudo {
 
 TEST(MemtagBasicDeathTest, Unsupported) {
   if (archSupportsMemoryTagging())
-    GTEST_SKIP();
+    TEST_SKIP("Memory tagging is not supported");
   // Skip when running with HWASan.
   if (&__hwasan_init != 0)
-    GTEST_SKIP();
+    TEST_SKIP("Incompatible with HWASan");
 
   EXPECT_DEATH(archMemoryTagGranuleSize(), "not supported");
   EXPECT_DEATH(untagPointer((uptr)0), "not supported");
@@ -48,7 +48,7 @@ class MemtagTest : public Test {
 protected:
   void SetUp() override {
     if (!archSupportsMemoryTagging() || !systemDetectsMemoryTagFaultsTestOnly())
-      GTEST_SKIP() << "Memory tagging is not supported";
+      TEST_SKIP("Memory tagging is not supported");
 
     BufferSize = getPageSizeCached();
     ASSERT_FALSE(MemMap.isAllocated());

diff  --git a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
index 4283416435ba0..f8b658c937889 100644
--- a/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
+++ b/compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
@@ -11,9 +11,14 @@
 #if SCUDO_FUCHSIA
 #include <zxtest/zxtest.h>
 using Test = ::zxtest::Test;
+#define TEST_SKIP(message) ZXTEST_SKIP(message)
 #else
 #include "gtest/gtest.h"
 using Test = ::testing::Test;
+#define TEST_SKIP(message)                                                     \
+  do {                                                                         \
+    GTEST_SKIP() << message;                                                   \
+  } while (0)
 #endif
 
 // If EXPECT_DEATH isn't defined, make it a no-op.

diff  --git a/compiler-rt/lib/scudo/standalone/tests/strings_test.cpp b/compiler-rt/lib/scudo/standalone/tests/strings_test.cpp
index abb81803f65ee..2c0916d789202 100644
--- a/compiler-rt/lib/scudo/standalone/tests/strings_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/strings_test.cpp
@@ -147,7 +147,7 @@ TEST(ScudoStringsTest, CapacityIncreaseFails) {
                  MAP_ALLOWNOMEM)) {
     MemMap.unmap(MemMap.getBase(), MemMap.getCapacity());
     setrlimit(RLIMIT_AS, &Limit);
-    GTEST_SKIP() << "Limiting address space does not prevent mmap.";
+    TEST_SKIP("Limiting address space does not prevent mmap.");
   }
 
   // Test requires that the default length is at least 6 characters.

diff  --git a/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp b/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp
index b612676b7bd79..1547824c11763 100644
--- a/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/vector_test.cpp
@@ -64,7 +64,7 @@ TEST(ScudoVectorTest, ReallocateFails) {
                  MAP_ALLOWNOMEM)) {
     MemMap.unmap(MemMap.getBase(), MemMap.getCapacity());
     setrlimit(RLIMIT_AS, &Limit);
-    GTEST_SKIP() << "Limiting address space does not prevent mmap.";
+    TEST_SKIP("Limiting address space does not prevent mmap.");
   }
 
   V.resize(capacity);


        


More information about the llvm-commits mailing list