From 6197d975b8e098b443e0028265cc31e118bbfcb6 Mon Sep 17 00:00:00 2001 From: Aleksei Khoroshilov <5928869+goodov@users.noreply.github.com> Date: Thu, 23 Oct 2025 17:56:16 +0700 Subject: [PATCH] Ban `base::debug::DumpWithoutCrashing` to prevent test hangs (#31981) Prevent DumpWithoutCrashing direct use. --- PRESUBMIT.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index aa415d21d61..18c57227f45 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -271,6 +271,7 @@ def CheckNewThemeFilesForUpstreamOverride(input_api, output_api): ] return [] + def CheckNewSourceFileWithoutGnChangeOnUpload(input_api, output_api): """Checks newly added source files have corresponding GN changes.""" files_to_skip = input_api.DEFAULT_FILES_TO_SKIP + (r"chromium_src/.*", ) @@ -417,6 +418,16 @@ _BANNED_CPP_FUNCTIONS += ( explanation=('Please use `absl::StrAppendFormat` rather.', ), treat_as_error=False, ), + BanRule( + 'base::debug::DumpWithoutCrashing', + explanation=( + 'Please use `DUMP_WILL_BE_NOTREACHED()` instead.', + 'This prevents dumps and NOTREACHED in tests for the following reasons:', + ' * Dumps can hang tests.', + ' * NOTREACHED is a test failure unless it is an EXPECT_DEATH test.', + ), + treat_as_error=True, + ), )