Skip to content

Commit

Permalink
[scudo] Add TEST_SKIP macro to skip the current test (llvm#96192)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-d authored Jun 21, 2024
1 parent 9e6ea38 commit 513644b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions compiler-rt/lib/scudo/standalone/tests/memtag_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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());
Expand Down
5 changes: 5 additions & 0 deletions compiler-rt/lib/scudo/standalone/tests/scudo_unit_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/tests/strings_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/scudo/standalone/tests/vector_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 513644b

Please sign in to comment.