Skip to content

Commit

Permalink
Fix logging_unittest for cobalt.
Browse files Browse the repository at this point in the history
Change-Id: I8c3254bcdf01b271b1ed1e346af3246b79f488db
  • Loading branch information
aee-google committed Jan 19, 2024
1 parent 9286642 commit e00213d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3236,7 +3236,7 @@ test("base_unittests") {
"json/values_util_unittest.cc",
"lazy_instance_unittest.cc",

# "logging_unittest.cc",
"logging_unittest.cc",
"memory/aligned_memory_unittest.cc",

# "memory/discardable_memory_backing_field_trial_unittest.cc",
Expand Down
6 changes: 4 additions & 2 deletions base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
#include "base/debug/crash_logging.h"
#endif // !BUILDFLAG(IS_NACL)

#if defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL)
#if (defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL)) || \
(defined(STARBOARD) && defined(ADDRESS_SANITIZER))
#include "base/debug/leak_annotations.h"
#endif // defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL)

Expand Down Expand Up @@ -1380,7 +1381,8 @@ void ScopedVmoduleSwitches::InitWithSwitches(
// Make sure we are only initialized once.
CHECK(!scoped_vlog_info_);
{
#if defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL)
#if (defined(LEAK_SANITIZER) && !BUILDFLAG(IS_NACL)) || \
(defined(STARBOARD) && defined(ADDRESS_SANITIZER))
// See comments on |g_vlog_info|.
ScopedLeakSanitizerDisabler lsan_disabler;
#endif // defined(LEAK_SANITIZER)
Expand Down
8 changes: 6 additions & 2 deletions base/logging_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ TEST_F(LoggingTest, LogToStdErrFlag) {
// Check that messages with severity ERROR or higher are always logged to
// stderr if no log-destinations are set, other than LOG_TO_FILE.
// This test is currently only POSIX-compatible.
#if BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#if (BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)) && \
!defined(USE_HACKY_COBALT_CHANGES)
namespace {
void TestForLogToStderr(int log_destinations,
bool* did_log_info,
Expand Down Expand Up @@ -309,7 +310,8 @@ TEST_F(LoggingTest, AlwaysLogErrorsToStderr) {
EXPECT_TRUE(did_log_info);
EXPECT_TRUE(did_log_error);
}
#endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#endif // (BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)) &&
// !defined(USE_HACKY_COBALT_CHANGES)

#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(LoggingTest, InitWithFileDescriptor) {
Expand Down Expand Up @@ -643,6 +645,7 @@ void SpawnChildAndCrash(int death_location, uintptr_t* child_crash_addr) {
ASSERT_EQ(static_cast<int>(sizeof(uintptr_t)), res);
}

#if !defined(USE_HACKY_COBALT_CHANGES)
TEST_F(LoggingTest, CheckCausesDistinctBreakpoints) {
uintptr_t child_crash_addr_1 = 0;
uintptr_t child_crash_addr_2 = 0;
Expand All @@ -659,6 +662,7 @@ TEST_F(LoggingTest, CheckCausesDistinctBreakpoints) {
ASSERT_NE(child_crash_addr_1, child_crash_addr_3);
ASSERT_NE(child_crash_addr_2, child_crash_addr_3);
}
#endif // !defined(USE_HACKY_COBALT_CHANGES)
#endif // BUILDFLAG(IS_POSIX)

TEST_F(LoggingTest, DebugLoggingReleaseBehavior) {
Expand Down

0 comments on commit e00213d

Please sign in to comment.