gem5 v25.0.0.1
Loading...
Searching...
No Matches
logging.test.cc File Reference
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "base/gtest/logging.hh"
#include "base/logging.hh"

Go to the source code of this file.

Classes

class  LoggingFixture
 Temporarily redirects cerr to gtestLogOutput. More...

Functions

 TEST_F (LoggingFixture, BasicPrint)
 Test the most basic print.
 TEST_F (LoggingFixture, VariadicCharPrint)
 Test the variadic-arg print for chars.
 TEST_F (LoggingFixture, VariadicStringPrint)
 Test the variadic-arg print for strings.
 TEST_F (LoggingFixture, VariadicCharMissingPrint)
 Test the variadic-arg print for chars with arguments missing.
 TEST_F (LoggingFixture, VariadicStringMissingPrint)
 Test the variadic-arg print for strings with arguments missing.
 TEST_F (LoggingFixture, DisabledPrint)
 Test that no message is shown when printing with a disabled logger.
 TEST_F (LoggingFixture, PrintWithExtraLogs)
 Test print with extra logs.
 TEST_F (LoggingFixture, WarnLoggerPrint)
 Test printing with the warn logger, enabled and disabled.
 TEST_F (LoggingFixture, InfoLoggerPrint)
 Test printing with the info logger, enabled and disabled.
 TEST_F (LoggingFixture, HackLoggerPrint)
 Test printing with the hack logger, enabled and disabled.
 TEST_F (LoggingFixture, FatalLoggerPrint)
 Test printing with the fatal logger, enabled and disabled.
 TEST_F (LoggingFixture, PanicLoggerPrint)
 Test printing with the panic logger, which cannot be disabled.
 TEST_F (LoggingFixture, BaseMessage)
 Test macro base_message.
 TEST_F (LoggingFixture, BaseMessageOnce)
 Test that base_message_once only prints the message once in a loop.
 TEST_F (LoggingFixture, Warn)
 Test macro warn.
 TEST_F (LoggingFixture, Inform)
 Test macro inform.
 TEST_F (LoggingFixture, Hack)
 Test macro hack.
 TEST_F (LoggingFixture, WarnOnce)
 Test that warn_once only prints the message once in a loop.
 TEST_F (LoggingFixture, InformOnce)
 Test that inform_once only prints the message once in a loop.
 TEST_F (LoggingFixture, HackOnce)
 Test that hack_once only prints the message once in a loop.
 TEST_F (LoggingFixture, WarnIf)
 Test that warn_if only prints the message when the condition is true.
 TEST_F (LoggingFixture, WarnIfOnce)
 Test that warn_if_once only prints the message once in a loop.
 TEST (LoggingDeathTest, EmptyPrefix)
 Test that a logger cannot be created with an empty prefix.
 TEST (LoggingDeathTest, ExitHelper)
 Test that the test logger's exit helper will end execution gracefully.
 TEST (LoggingDeathTest, WarnLoggerExitHelper)
 Test that the warn logger's exit helper will end execution gracefully.
 TEST (LoggingDeathTest, InfoLoggerExitHelper)
 Test that the info logger's exit helper will end execution gracefully.
 TEST (LoggingDeathTest, HackLoggerExitHelper)
 Test that the hack logger's exit helper will end execution gracefully.
 TEST (LoggingDeathTest, FatalLoggerExitHelper)
 Test that the fatal logger's exit helper will end execution with error.
 TEST (LoggingDeathTest, PanicLoggerExitHelper)
 Test that the panic logger's exit helper will end execution with error.
 TEST (LoggingDeathTest, ExitMessage)
 Test that exit_message prints a message and exits.
 TEST (LoggingDeathTest, Panic)
 Test macro panic.
 TEST (LoggingDeathTest, Fatal)
 Test macro fatal.
 TEST (LoggingDeathTest, PanicIf)
 Test that panic_if only prints the message when the condition is true.
 TEST (LoggingDeathTest, FatalIf)
 Test that fatal_if only prints the message when the condition is true.
 TEST (LoggingDeathTest, gem5Assert)
 Test macro gem5_assert.

Function Documentation

◆ TEST() [1/13]

TEST ( LoggingDeathTest ,
EmptyPrefix  )

Test that a logger cannot be created with an empty prefix.

Definition at line 485 of file logging.test.cc.

◆ TEST() [2/13]

TEST ( LoggingDeathTest ,
ExitHelper  )

Test that the test logger's exit helper will end execution gracefully.

Definition at line 495 of file logging.test.cc.

◆ TEST() [3/13]

TEST ( LoggingDeathTest ,
ExitMessage  )

Test that exit_message prints a message and exits.

Definition at line 531 of file logging.test.cc.

References exit_message.

◆ TEST() [4/13]

TEST ( LoggingDeathTest ,
Fatal  )

Test macro fatal.

Definition at line 545 of file logging.test.cc.

References fatal.

◆ TEST() [5/13]

TEST ( LoggingDeathTest ,
FatalIf  )

Test that fatal_if only prints the message when the condition is true.

Definition at line 560 of file logging.test.cc.

References fatal_if.

◆ TEST() [6/13]

TEST ( LoggingDeathTest ,
FatalLoggerExitHelper  )

Test that the fatal logger's exit helper will end execution with error.

Definition at line 519 of file logging.test.cc.

References gem5::Logger::getFatal().

◆ TEST() [7/13]

TEST ( LoggingDeathTest ,
gem5Assert  )

Test macro gem5_assert.

Definition at line 568 of file logging.test.cc.

References gem5_assert.

◆ TEST() [8/13]

TEST ( LoggingDeathTest ,
HackLoggerExitHelper  )

Test that the hack logger's exit helper will end execution gracefully.

Definition at line 513 of file logging.test.cc.

References gem5::Logger::getHack().

◆ TEST() [9/13]

TEST ( LoggingDeathTest ,
InfoLoggerExitHelper  )

Test that the info logger's exit helper will end execution gracefully.

Definition at line 507 of file logging.test.cc.

References gem5::Logger::getInfo().

◆ TEST() [10/13]

TEST ( LoggingDeathTest ,
Panic  )

Test macro panic.

Definition at line 538 of file logging.test.cc.

References panic.

◆ TEST() [11/13]

TEST ( LoggingDeathTest ,
PanicIf  )

Test that panic_if only prints the message when the condition is true.

Definition at line 552 of file logging.test.cc.

References panic_if.

◆ TEST() [12/13]

TEST ( LoggingDeathTest ,
PanicLoggerExitHelper  )

Test that the panic logger's exit helper will end execution with error.

Definition at line 525 of file logging.test.cc.

References gem5::Logger::getPanic().

◆ TEST() [13/13]

TEST ( LoggingDeathTest ,
WarnLoggerExitHelper  )

Test that the warn logger's exit helper will end execution gracefully.

Definition at line 501 of file logging.test.cc.

References gem5::Logger::getWarn().

◆ TEST_F() [1/22]

TEST_F ( LoggingFixture ,
BaseMessage  )

Test macro base_message.

Definition at line 271 of file logging.test.cc.

References base_message, and gem5::gtestLogOutput.

◆ TEST_F() [2/22]

TEST_F ( LoggingFixture ,
BaseMessageOnce  )

Test that base_message_once only prints the message once in a loop.

Definition at line 302 of file logging.test.cc.

References base_message_once, gem5::gtestLogOutput, and gem5::ArmISA::i.

◆ TEST_F() [3/22]

TEST_F ( LoggingFixture ,
BasicPrint  )

Test the most basic print.

Definition at line 50 of file logging.test.cc.

References gem5::gtestLogOutput, and gem5::Logger::print().

◆ TEST_F() [4/22]

TEST_F ( LoggingFixture ,
DisabledPrint  )

Test that no message is shown when printing with a disabled logger.

Definition at line 143 of file logging.test.cc.

References gem5::statistics::enabled(), gem5::gtestLogOutput, and gem5::Logger::Logger().

◆ TEST_F() [5/22]

TEST_F ( LoggingFixture ,
FatalLoggerPrint  )

Test printing with the fatal logger, enabled and disabled.

Definition at line 236 of file logging.test.cc.

References gem5::Logger::FATAL, gem5::Logger::getFatal(), gem5::gtestLogOutput, gem5::Logger::NUM_LOG_LEVELS, gem5::Logger::PANIC, gem5::Logger::print(), and gem5::Logger::setLevel().

◆ TEST_F() [6/22]

TEST_F ( LoggingFixture ,
Hack  )

Test macro hack.

Definition at line 381 of file logging.test.cc.

References gem5::gtestLogOutput, and hack.

◆ TEST_F() [7/22]

TEST_F ( LoggingFixture ,
HackLoggerPrint  )

Test printing with the hack logger, enabled and disabled.

Definition at line 218 of file logging.test.cc.

References gem5::Logger::getHack(), gem5::gtestLogOutput, gem5::Logger::HACK, gem5::Logger::NUM_LOG_LEVELS, gem5::Logger::PANIC, gem5::Logger::print(), and gem5::Logger::setLevel().

◆ TEST_F() [8/22]

TEST_F ( LoggingFixture ,
HackOnce  )

Test that hack_once only prints the message once in a loop.

Definition at line 442 of file logging.test.cc.

References gem5::gtestLogOutput, hack_once, and gem5::ArmISA::i.

◆ TEST_F() [9/22]

TEST_F ( LoggingFixture ,
InfoLoggerPrint  )

Test printing with the info logger, enabled and disabled.

Definition at line 200 of file logging.test.cc.

References gem5::Logger::getInfo(), gem5::gtestLogOutput, gem5::Logger::INFO, gem5::Logger::NUM_LOG_LEVELS, gem5::Logger::PANIC, gem5::Logger::print(), and gem5::Logger::setLevel().

◆ TEST_F() [10/22]

TEST_F ( LoggingFixture ,
Inform  )

Test macro inform.

Definition at line 350 of file logging.test.cc.

References gem5::gtestLogOutput, and inform.

◆ TEST_F() [11/22]

TEST_F ( LoggingFixture ,
InformOnce  )

Test that inform_once only prints the message once in a loop.

Definition at line 427 of file logging.test.cc.

References gem5::gtestLogOutput, gem5::ArmISA::i, and inform_once.

◆ TEST_F() [12/22]

TEST_F ( LoggingFixture ,
PanicLoggerPrint  )

Test printing with the panic logger, which cannot be disabled.

Definition at line 257 of file logging.test.cc.

References gem5::Logger::getPanic(), gem5::gtestLogOutput, gem5::Logger::NUM_LOG_LEVELS, gem5::Logger::PANIC, gem5::Logger::print(), and gem5::Logger::setLevel().

◆ TEST_F() [13/22]

TEST_F ( LoggingFixture ,
PrintWithExtraLogs  )

Test print with extra logs.

Definition at line 161 of file logging.test.cc.

References gem5::gtestLogOutput, gem5::Logger::print(), and gem5::Logger::registerExtraLog().

◆ TEST_F() [14/22]

TEST_F ( LoggingFixture ,
VariadicCharMissingPrint  )

Test the variadic-arg print for chars with arguments missing.

Definition at line 111 of file logging.test.cc.

References gem5::gtestLogOutput, and gem5::Logger::print().

◆ TEST_F() [15/22]

TEST_F ( LoggingFixture ,
VariadicCharPrint  )

Test the variadic-arg print for chars.

Definition at line 78 of file logging.test.cc.

References gem5::gtestLogOutput, and gem5::Logger::print().

◆ TEST_F() [16/22]

TEST_F ( LoggingFixture ,
VariadicStringMissingPrint  )

Test the variadic-arg print for strings with arguments missing.

Definition at line 127 of file logging.test.cc.

References gem5::gtestLogOutput, and gem5::Logger::print().

◆ TEST_F() [17/22]

TEST_F ( LoggingFixture ,
VariadicStringPrint  )

Test the variadic-arg print for strings.

Definition at line 95 of file logging.test.cc.

References gem5::gtestLogOutput, and gem5::Logger::print().

◆ TEST_F() [18/22]

TEST_F ( LoggingFixture ,
Warn  )

Test macro warn.

Definition at line 319 of file logging.test.cc.

References gem5::gtestLogOutput, and warn.

◆ TEST_F() [19/22]

TEST_F ( LoggingFixture ,
WarnIf  )

Test that warn_if only prints the message when the condition is true.

Definition at line 457 of file logging.test.cc.

References gem5::gtestLogOutput, and warn_if.

◆ TEST_F() [20/22]

TEST_F ( LoggingFixture ,
WarnIfOnce  )

Test that warn_if_once only prints the message once in a loop.

Definition at line 470 of file logging.test.cc.

References gem5::gtestLogOutput, gem5::ArmISA::i, and warn_if_once.

◆ TEST_F() [21/22]

TEST_F ( LoggingFixture ,
WarnLoggerPrint  )

Test printing with the warn logger, enabled and disabled.

Definition at line 182 of file logging.test.cc.

References gem5::Logger::getWarn(), gem5::gtestLogOutput, gem5::Logger::NUM_LOG_LEVELS, gem5::Logger::PANIC, gem5::Logger::print(), gem5::Logger::setLevel(), and gem5::Logger::WARN.

◆ TEST_F() [22/22]

TEST_F ( LoggingFixture ,
WarnOnce  )

Test that warn_once only prints the message once in a loop.

Definition at line 412 of file logging.test.cc.

References gem5::gtestLogOutput, gem5::ArmISA::i, and warn_once.


Generated on Sat Oct 18 2025 08:06:47 for gem5 by doxygen 1.14.0