summaryrefslogtreecommitdiff
path: root/lib/scudo/standalone/tests/primary_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scudo/standalone/tests/primary_test.cpp')
-rw-r--r--lib/scudo/standalone/tests/primary_test.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/scudo/standalone/tests/primary_test.cpp b/lib/scudo/standalone/tests/primary_test.cpp
index a6cfc6bdb..7da7b25ca 100644
--- a/lib/scudo/standalone/tests/primary_test.cpp
+++ b/lib/scudo/standalone/tests/primary_test.cpp
@@ -46,7 +46,9 @@ template <typename Primary> static void testPrimary() {
}
Cache.destroy(nullptr);
Allocator->releaseToOS();
- Allocator->printStats();
+ scudo::ScopedString Str(1024);
+ Allocator->getStats(&Str);
+ Str.output();
}
TEST(ScudoPrimaryTest, BasicPrimary) {
@@ -86,7 +88,9 @@ TEST(ScudoPrimaryTest, Primary64OOM) {
}
Cache.destroy(nullptr);
Allocator.releaseToOS();
- Allocator.printStats();
+ scudo::ScopedString Str(1024);
+ Allocator.getStats(&Str);
+ Str.output();
EXPECT_EQ(AllocationFailed, true);
Allocator.unmapTestOnly();
}
@@ -125,7 +129,9 @@ template <typename Primary> static void testIteratePrimary() {
}
Cache.destroy(nullptr);
Allocator->releaseToOS();
- Allocator->printStats();
+ scudo::ScopedString Str(1024);
+ Allocator->getStats(&Str);
+ Str.output();
}
TEST(ScudoPrimaryTest, PrimaryIterate) {
@@ -180,7 +186,9 @@ template <typename Primary> static void testPrimaryThreaded() {
for (auto &T : Threads)
T.join();
Allocator->releaseToOS();
- Allocator->printStats();
+ scudo::ScopedString Str(1024);
+ Allocator->getStats(&Str);
+ Str.output();
}
TEST(ScudoPrimaryTest, PrimaryThreaded) {
@@ -203,8 +211,7 @@ template <typename Primary> static void testReleaseToOS() {
Cache.init(nullptr, Allocator.get());
const scudo::uptr Size = scudo::getPageSizeCached() * 2;
EXPECT_TRUE(Primary::canAllocate(Size));
- const scudo::uptr ClassId =
- Primary::SizeClassMap::getClassIdBySize(Size);
+ const scudo::uptr ClassId = Primary::SizeClassMap::getClassIdBySize(Size);
void *P = Cache.allocate(ClassId);
EXPECT_NE(P, nullptr);
Cache.deallocate(ClassId, P);