Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,10 @@ void ScudoCombinedTest<Config>::BasicTest(scudo::uptr SizeLog) {
}
}

Allocator->printStats();
Allocator->printFragmentationInfo();
if (TEST_HAS_FAILURE) {
Allocator->printStats();
Allocator->printFragmentationInfo();
}
}

#define SCUDO_MAKE_BASIC_TEST(SizeLog) \
Expand Down
36 changes: 22 additions & 14 deletions compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,11 @@ SCUDO_TYPED_TEST(ScudoPrimaryTest, BasicPrimary) {
}
SizeClassAllocator.destroy(nullptr);
Allocator->releaseToOS(scudo::ReleaseToOS::Force);
scudo::ScopedString Str;
Allocator->getStats(&Str);
Str.output();
if (TEST_HAS_FAILURE) {
scudo::ScopedString Str;
Allocator->getStats(&Str);
Str.output();
}
}

struct SmallRegionsConfig {
Expand Down Expand Up @@ -289,10 +291,12 @@ TEST(ScudoPrimaryTest, Primary64OOM) {

SizeClassAllocator.destroy(nullptr);
Allocator.releaseToOS(scudo::ReleaseToOS::Force);
scudo::ScopedString Str;
Allocator.getStats(&Str);
Str.output();
EXPECT_EQ(AllocationFailed, true);
if (TEST_HAS_FAILURE) {
scudo::ScopedString Str;
Allocator.getStats(&Str);
Str.output();
}
Allocator.unmapTestOnly();
}

Expand Down Expand Up @@ -328,9 +332,11 @@ SCUDO_TYPED_TEST(ScudoPrimaryTest, PrimaryIterate) {
}
SizeClassAllocator.destroy(nullptr);
Allocator->releaseToOS(scudo::ReleaseToOS::Force);
scudo::ScopedString Str;
Allocator->getStats(&Str);
Str.output();
if (TEST_HAS_FAILURE) {
scudo::ScopedString Str;
Allocator->getStats(&Str);
Str.output();
}
}

SCUDO_TYPED_TEST(ScudoPrimaryTest, PrimaryThreaded) {
Expand Down Expand Up @@ -385,11 +391,13 @@ SCUDO_TYPED_TEST(ScudoPrimaryTest, PrimaryThreaded) {
for (auto &T : Threads)
T.join();
Allocator->releaseToOS(scudo::ReleaseToOS::Force);
scudo::ScopedString Str;
Allocator->getStats(&Str);
Allocator->getFragmentationInfo(&Str);
Allocator->getMemoryGroupFragmentationInfo(&Str);
Str.output();
if (TEST_HAS_FAILURE) {
scudo::ScopedString Str;
Allocator->getStats(&Str);
Allocator->getFragmentationInfo(&Str);
Allocator->getMemoryGroupFragmentationInfo(&Str);
Str.output();
}
}

// Through a simple allocation that spans two pages, verify that releaseToOS
Expand Down
16 changes: 10 additions & 6 deletions compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,11 @@ TEST(ScudoQuarantineTest, GlobalQuarantine) {
Quarantine.drainAndRecycle(&Cache, Cb);
EXPECT_EQ(Cache.getSize(), 0UL);

scudo::ScopedString Str;
Quarantine.getStats(&Str);
Str.output();
if (TEST_HAS_FAILURE) {
scudo::ScopedString Str;
Quarantine.getStats(&Str);
Str.output();
}
}

struct PopulateQuarantineThread {
Expand Down Expand Up @@ -248,9 +250,11 @@ TEST(ScudoQuarantineTest, ThreadedGlobalQuarantine) {
for (scudo::uptr I = 0; I < NumberOfThreads; I++)
pthread_join(T[I].Thread, 0);

scudo::ScopedString Str;
Quarantine.getStats(&Str);
Str.output();
if (TEST_HAS_FAILURE) {
scudo::ScopedString Str;
Quarantine.getStats(&Str);
Str.output();
}

for (scudo::uptr I = 0; I < NumberOfThreads; I++)
Quarantine.drainAndRecycle(&T[I].Cache, Cb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@

template <class SizeClassMap> void testSizeClassMap() {
typedef SizeClassMap SCMap;
scudo::printMap<SCMap>();
scudo::validateMap<SCMap>();
if (TEST_HAS_FAILURE) {
scudo::printMap<SCMap>();
}
}

TEST(ScudoSizeClassMapTest, DefaultSizeClassMap) {
Expand Down