0

Revert "Remove runtime vlogging from android-official"

This reverts commit fdcb27d8ac.

Reason for revert: This is causing a failure for `LoggingTest.ScopedVmoduleSwitche` test on android-arm-tests
builder, an example: https://ci.chromium.org/ui/p/chrome/builders/ci/android-arm-tests/30923/overview

Original change's description:
> Remove runtime vlogging from android-official
>
> This saves ~135k on the android-size bots. Some parts of the code do
> compile-time enable ENABLED_VLOG_LEVEL in BUILD.gn to collect data in
> the wild but paying for runtime vlogging universally for the few times
> it's potentially used seems expensive.
>
> Linux seems to save ~460k, so it may be worth pursuing all platforms
> as a follow-up, but Android as a platform seems least controversial to
> remove runtime-vlogging on. It is also where size improvements are most
> important.
>
> Bug: 404291877
> Cq-Include-Trybots: luci.chromium.try:android-official
> Change-Id: I01b77e67847ebb32f0ea2a2d7abd5b30843be06e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6344673
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Peter Kasting <pkasting@chromium.org>
> Commit-Queue: Peter Boström <pbos@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1433971}

Bug: 404291877
Cq-Include-Trybots: luci.chromium.try:android-official
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I5ab2a45317475d1a6e36e07ab199d774912fd5c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6367098
Commit-Queue: Sayed Elabady <elabadysayed@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1434097}
This commit is contained in:
Sayed Elabady
2025-03-18 06:35:53 -07:00
committed by Chromium LUCI CQ
parent 65846c77ef
commit 63a9522e28
3 changed files with 4 additions and 23 deletions

@ -316,18 +316,7 @@ BASE_EXPORT int GetVlogLevelHelper(const char* file_start, size_t N);
// Gets the current vlog level for the given file (usually taken from __FILE__).
template <size_t N>
int GetVlogLevel(const char (&file)[N]) {
// Disable runtime VLOG()s in official Android builds. This saves ~135k on the
// android-binary-size bot in crrev.com/c/6344673. Parts of the code can, and
// do, override ENABLED_VLOG_LEVEL to collect logs in the wild. The rest is
// dead-code stripped.
//
// TODO(crbug.com/404291877): Figure out if we want to deploy this on all
// platforms. Local chrome.stripped on Linux seems to shave off ~460k.
#if defined(OFFICIAL_BUILD) && BUILDFLAG(IS_ANDROID)
return -1;
#else
return GetVlogLevelHelper(file, N);
#endif // defined(OFFICIAL_BUILD) && BUILDFLAG(IS_ANDROID)
}
// Sets the common items you want to be prepended to each log message.

@ -123,6 +123,8 @@ TEST_F(LoggingTest, BasicLogging) {
EXPECT_TRUE(LOG_IS_ON(INFO));
EXPECT_EQ(DCHECK_IS_ON(), DLOG_IS_ON(INFO));
EXPECT_TRUE(VLOG_IS_ON(0));
LOG(INFO) << mock_log_source.Log();
LOG_IF(INFO, true) << mock_log_source.Log();
PLOG(INFO) << mock_log_source.Log();
@ -889,6 +891,8 @@ TEST_F(LoggingTest, String16) {
// Tests that we don't VLOG from logging_unittest except when in the scope
// of the ScopedVmoduleSwitches.
TEST_F(LoggingTest, ScopedVmoduleSwitches) {
EXPECT_TRUE(VLOG_IS_ON(0));
// To avoid unreachable-code warnings when VLOG is disabled at compile-time.
int expected_logs = 0;
if (VLOG_IS_ON(0)) {

@ -809,10 +809,6 @@ TEST_P(StatisticsRecorderTest, GlobalCallbackCalled) {
}
TEST_P(StatisticsRecorderTest, LogOnShutdownNotInitialized) {
// Some builds don't have runtime vlogging. See base/logging.h.
if (!VLOG_IS_ON(0)) {
GTEST_SKIP();
}
ResetVLogInitialized();
logging::SetMinLogLevel(logging::LOGGING_WARNING);
InitializeStatisticsRecorder();
@ -823,10 +819,6 @@ TEST_P(StatisticsRecorderTest, LogOnShutdownNotInitialized) {
}
TEST_P(StatisticsRecorderTest, LogOnShutdownInitializedExplicitly) {
// Some builds don't have runtime vlogging. See base/logging.h.
if (!VLOG_IS_ON(0)) {
GTEST_SKIP();
}
ResetVLogInitialized();
logging::SetMinLogLevel(logging::LOGGING_WARNING);
InitializeStatisticsRecorder();
@ -839,10 +831,6 @@ TEST_P(StatisticsRecorderTest, LogOnShutdownInitializedExplicitly) {
}
TEST_P(StatisticsRecorderTest, LogOnShutdownInitialized) {
// Some builds don't have runtime vlogging. See base/logging.h.
if (!VLOG_IS_ON(0)) {
GTEST_SKIP();
}
ResetVLogInitialized();
logging::SetMinLogLevel(logging::LOGGING_VERBOSE);
InitializeStatisticsRecorder();