-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[scudo] Only print stats when the test fails. #168000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cferris1000
wants to merge
2
commits into
llvm:main
Choose a base branch
from
cferris1000:quiet_tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+39
−23
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When running the tests on other platforms, printing the stats on all of the passing tests makes it hard to see failure output. Therefore, this change only prints the stats if the test actually fails.
Member
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Christopher Ferris (cferris1000) ChangesWhen running the tests on other platforms, printing the stats on all of the passing tests makes it hard to see failure output. Therefore, this change only prints the stats if the test actually fails. Full diff: https://github.com/llvm/llvm-project/pull/168000.diff 4 Files Affected:
diff --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index 4837ac96b9b26..1d4208b6a2aa0 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -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) \
diff --git a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
index 1f5df28fd7771..3a087c497b1a9 100644
--- a/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/primary_test.cpp
@@ -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 {
@@ -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();
}
@@ -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) {
@@ -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
diff --git a/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp b/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp
index 54d42edc374e5..e3e983be54574 100644
--- a/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/quarantine_test.cpp
@@ -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 {
@@ -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);
diff --git a/compiler-rt/lib/scudo/standalone/tests/size_class_map_test.cpp b/compiler-rt/lib/scudo/standalone/tests/size_class_map_test.cpp
index 05b5835ff0bb6..73b2823e4c9d1 100644
--- a/compiler-rt/lib/scudo/standalone/tests/size_class_map_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/size_class_map_test.cpp
@@ -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) {
|
🐧 Linux x64 Test Results
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running the tests on other platforms, printing the stats on all of the passing tests makes it hard to see failure output. Therefore, this change only prints the stats if the test actually fails.