gem5 v24.0.0.0
|
#include <gtest/gtest.h>
#include <sstream>
#include <string>
#include "base/gtest/cur_tick_fake.hh"
#include "base/gtest/logging.hh"
#include "base/named.hh"
#include "base/trace.hh"
Go to the source code of this file.
Namespaces | |
namespace | gem5 |
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved. | |
namespace | gem5::debug |
Functions | |
std::string | getString (std::ostream &os) |
std::string | getString (trace::Logger *logger) |
TEST (TraceTest, LogSimpleMessage) | |
Test creating a simple log message. | |
TEST (TraceTest, LogMessageName) | |
Test creating a simple log message with a name. | |
TEST (TraceTest, LogMessageMaxTick) | |
Test that when the tick is set to MaxTick it is not printed. | |
TEST (TraceTest, LogMessageFlagDisabled) | |
Test that by default the flag is not printed. | |
TEST (TraceTest, LogMessageTickDisabledAndEnableDisable) | |
Test creating a simple log message without tick information and that enabling and disabling format flags work. | |
TEST (TraceTest, LogMessageFlagEnabled) | |
Test creating a full log message to verify expected order of appearance. | |
TEST (TraceTest, LogMessageActivateOne) | |
Test that log messages are displayed for activated objects (single). | |
TEST (TraceTest, LogMessageActivateMultiple) | |
Test that log messages are displayed for activated objects (multiple). | |
TEST (TraceTest, LogMessageIgnoreOne) | |
Test that log messages are not displayed for ignored objects (single). | |
TEST (TraceTest, LogMessageIgnoreMultiple) | |
Test that log messages are not displayed for ignored objects (multiple). | |
TEST (TraceTest, LogMessageActivateAndIgnore) | |
Test that log messages are displayed properly within ignore and activate. | |
TEST (TraceTest, DumpIgnored) | |
Test that dumping for an ignored name does not log anything. | |
TEST (TraceTest, DumpSimple) | |
Test that a regular dump will change the message so that it contains both the hex and char representation of every byte. | |
TEST (TraceTest, DumpMultiLine) | |
Test that a regular dump will change the message so that it contains both the hex and char representation of every byte, for a multi-line message. | |
TEST (TraceTest, DISABLED_GetNullLogger) | |
Test that when no logger exists a logger is created redirecting to cerr. | |
TEST (TraceTest, SetGetLogger) | |
Test that the logger is set properly. | |
TEST (TraceTest, Output) | |
Test that output() gets the ostream of the current debug logger. | |
TEST (TraceTest, DprintfFlagIgnore) | |
Test dprintf_flag with ignored name. | |
TEST (TraceTest, DprintfFlagZeroArgs) | |
Test dprintf_flag with zero args. | |
TEST (TraceTest, DprintfFlagOneArg) | |
Test dprintf_flag with one arg. | |
TEST (TraceTest, DprintfFlagMultipleArgs) | |
Test dprintf_flag with multiple args. | |
TEST (TraceTest, DprintfFlagEnabled) | |
Test dprintf_flag with flag. | |
TEST (TraceTest, DprintfIgnore) | |
Test dprintf with ignored name. | |
TEST (TraceTest, DprintfEnabled) | |
Test that dprintf does not have a flag. | |
TEST (TraceTest, DprintfWrapper) | |
Test that dprintf is just a flagless wrapper for dprintf_flag. | |
TEST (TraceTest, MacroDDUMP) | |
Test DDUMP with tracing on. | |
TEST (TraceTest, MacroDPRINTF) | |
Test DPRINTF with tracing on. | |
TEST (TraceTest, MacroDPRINTFS) | |
Test DPRINTFS with tracing on. | |
TEST (TraceTest, MacroDPRINTFR) | |
Test DPRINTFR with tracing on. | |
TEST (TraceTest, MacroDPRINTFN) | |
Test DPRINTFN with tracing on. | |
TEST (TraceTest, MacroDPRINTFNR) | |
Test DPRINTFNR with tracing on. | |
TEST (TraceTest, MacroDPRINTF_UNCONDITIONAL) | |
Test DPRINTF_UNCONDITIONAL with tracing on. | |
TEST (TraceTest, GlobalName) | |
Test that there is a global name() to fall through when a locally scoped name() is not defined. | |
Variables | |
std::stringstream | ss |
trace::OstreamLogger | main_logger (ss) |
GTestTickHandler | tickHandler |
SimpleFlag | gem5::debug::TraceTestDebugFlag ("TraceTestDebugFlag", "Exclusive debug flag for the trace tests") |
Debug flag used for the tests in this file. | |
std::string getString | ( | std::ostream & | os | ) |
Definition at line 63 of file trace.test.cc.
References gem5::X86ISA::os.
Referenced by getString(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
std::string getString | ( | trace::Logger * | logger | ) |
Definition at line 73 of file trace.test.cc.
References gem5::trace::Logger::getOstream(), and getString().
TEST | ( | TraceTest | , |
DISABLED_GetNullLogger | ) |
Test that when no logger exists a logger is created redirecting to cerr.
This is the only test that uses cerr. All other test will use main_logger.
Definition at line 382 of file trace.test.cc.
References gem5::trace::getDebugLogger(), gem5::gtestLogOutput, and gem5::trace::Logger::logMessage().
TEST | ( | TraceTest | , |
DprintfEnabled | ) |
Test that dprintf does not have a flag.
Definition at line 488 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), gem5::trace::Logger::dprintf(), gem5::trace::enable(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfFlagEnabled | ) |
Test dprintf_flag with flag.
Definition at line 458 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), gem5::trace::Logger::dprintf_flag(), gem5::trace::enable(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfFlagIgnore | ) |
Test dprintf_flag with ignored name.
Definition at line 415 of file trace.test.cc.
References gem5::trace::Logger::dprintf_flag(), getString(), gem5::trace::Logger::setIgnore(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfFlagMultipleArgs | ) |
Test dprintf_flag with multiple args.
Definition at line 447 of file trace.test.cc.
References gem5::trace::Logger::dprintf_flag(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfFlagOneArg | ) |
Test dprintf_flag with one arg.
Definition at line 437 of file trace.test.cc.
References gem5::trace::Logger::dprintf_flag(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfFlagZeroArgs | ) |
Test dprintf_flag with zero args.
Definition at line 427 of file trace.test.cc.
References gem5::trace::Logger::dprintf_flag(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfIgnore | ) |
Test dprintf with ignored name.
Definition at line 476 of file trace.test.cc.
References gem5::trace::Logger::dprintf(), getString(), gem5::trace::Logger::setIgnore(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DprintfWrapper | ) |
Test that dprintf is just a flagless wrapper for dprintf_flag.
Definition at line 502 of file trace.test.cc.
References gem5::trace::Logger::dprintf(), gem5::trace::Logger::dprintf_flag(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DumpIgnored | ) |
Test that dumping for an ignored name does not log anything.
Definition at line 302 of file trace.test.cc.
References gem5::trace::Logger::dump(), getString(), gem5::trace::Logger::setIgnore(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DumpMultiLine | ) |
Test that a regular dump will change the message so that it contains both the hex and char representation of every byte, for a multi-line message.
Definition at line 359 of file trace.test.cc.
References gem5::trace::Logger::dump(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
DumpSimple | ) |
Test that a regular dump will change the message so that it contains both the hex and char representation of every byte.
There is a space between every 8 bytes. For each 16-byte line of a message the order of appearance is <byte number> <2 spaces> <8 spaced bytes> <1 space> <8 spaced bytes> <3-spaces missing to fill 16 bytes> <1 space> <16 bytes as chars> <
>
Definition at line 321 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), gem5::trace::Logger::dump(), gem5::trace::enable(), getString(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
GlobalName | ) |
Test that there is a global name() to fall through when a locally scoped name() is not defined.
Definition at line 668 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), DPRINTF, gem5::trace::enable(), getString(), and gem5::trace::output().
TEST | ( | TraceTest | , |
LogMessageActivateAndIgnore | ) |
Test that log messages are displayed properly within ignore and activate.
Definition at line 280 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), gem5::trace::Logger::setActivate(), gem5::trace::Logger::setIgnore(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageActivateMultiple | ) |
Test that log messages are displayed for activated objects (multiple).
Definition at line 194 of file trace.test.cc.
References gem5::trace::Logger::addActivate(), getString(), gem5::trace::OstreamLogger::logMessage(), gem5::trace::Logger::setActivate(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageActivateOne | ) |
Test that log messages are displayed for activated objects (single).
Definition at line 170 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), gem5::trace::Logger::setActivate(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageFlagDisabled | ) |
Test that by default the flag is not printed.
Definition at line 109 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageFlagEnabled | ) |
Test creating a full log message to verify expected order of appearance.
This does not include the backtrace.
Definition at line 151 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), gem5::trace::enable(), getString(), gem5::trace::OstreamLogger::logMessage(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageIgnoreMultiple | ) |
Test that log messages are not displayed for ignored objects (multiple).
Definition at line 249 of file trace.test.cc.
References gem5::trace::Logger::addIgnore(), getString(), gem5::trace::OstreamLogger::logMessage(), gem5::trace::Logger::setIgnore(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageIgnoreOne | ) |
Test that log messages are not displayed for ignored objects (single).
Definition at line 225 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), gem5::trace::Logger::setIgnore(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageMaxTick | ) |
Test that when the tick is set to MaxTick it is not printed.
Definition at line 99 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), gem5::MaxTick, and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageName | ) |
Test creating a simple log message with a name.
Definition at line 89 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogMessageTickDisabledAndEnableDisable | ) |
Test creating a simple log message without tick information and that enabling and disabling format flags work.
Definition at line 122 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), gem5::trace::enable(), getString(), gem5::trace::OstreamLogger::logMessage(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
LogSimpleMessage | ) |
Test creating a simple log message.
Definition at line 79 of file trace.test.cc.
References getString(), gem5::trace::OstreamLogger::logMessage(), and gem5::ArmISA::ss.
TEST | ( | TraceTest | , |
MacroDDUMP | ) |
Test DDUMP with tracing on.
Definition at line 516 of file trace.test.cc.
References gem5::debug::changeFlag(), DDUMP, gem5::trace::disable(), gem5::trace::enable(), getString(), name(), and gem5::trace::output().
TEST | ( | TraceTest | , |
MacroDPRINTF | ) |
Test DPRINTF with tracing on.
Definition at line 542 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), DPRINTF, gem5::trace::enable(), getString(), name(), and gem5::trace::output().
TEST | ( | TraceTest | , |
MacroDPRINTF_UNCONDITIONAL | ) |
Test DPRINTF_UNCONDITIONAL with tracing on.
Definition at line 637 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), DPRINTF_UNCONDITIONAL, gem5::trace::enable(), getString(), name(), and gem5::trace::output().
TEST | ( | TraceTest | , |
MacroDPRINTFN | ) |
Test DPRINTFN with tracing on.
Definition at line 614 of file trace.test.cc.
References DPRINTFN, getString(), name(), and gem5::trace::output().
TEST | ( | TraceTest | , |
MacroDPRINTFNR | ) |
Test DPRINTFNR with tracing on.
Definition at line 626 of file trace.test.cc.
References DPRINTFNR, getString(), and gem5::trace::output().
TEST | ( | TraceTest | , |
MacroDPRINTFR | ) |
Test DPRINTFR with tracing on.
Definition at line 593 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), DPRINTFR, gem5::trace::enable(), getString(), and gem5::trace::output().
TEST | ( | TraceTest | , |
MacroDPRINTFS | ) |
Test DPRINTFS with tracing on.
Definition at line 566 of file trace.test.cc.
References gem5::debug::changeFlag(), gem5::trace::disable(), DPRINTFS, gem5::trace::enable(), getString(), and gem5::trace::output().
TEST | ( | TraceTest | , |
Output | ) |
Test that output() gets the ostream of the current debug logger.
Definition at line 408 of file trace.test.cc.
References gem5::trace::getDebugLogger(), getString(), gem5::trace::Logger::logMessage(), and gem5::trace::output().
TEST | ( | TraceTest | , |
SetGetLogger | ) |
Test that the logger is set properly.
Definition at line 393 of file trace.test.cc.
References gem5::trace::getDebugLogger(), getString(), gem5::trace::OstreamLogger::logMessage(), main_logger, and gem5::trace::setDebugLogger().
trace::OstreamLogger main_logger(ss) | ( | ss | ) |
Referenced by TEST().
std::stringstream ss |
Definition at line 45 of file trace.test.cc.
Referenced by sc_core::sc_vector_base::checkIndex(), sc_core::sc_in_rv< W >::end_of_elaboration(), sc_core::sc_inout_rv< W >::end_of_elaboration(), sc_gem5::Port::finalize(), sc_core::sc_event_finder_t< IF >::find_event(), sc_core::sc_port_base::report_error(), sc_core::sc_vector_base::reportEmpty(), sc_dt::sc_proxy_out_of_bounds(), sc_core::sc_spawn_options::set_stack_size(), sc_gem5::TraceFile::set_time_unit(), sc_core::sc_time::to_string(), sc_core::sc_time_tuple::to_string(), sc_dt::sc_fxtype_params::to_string(), and sc_dt::sc_length_param::to_string().
GTestTickHandler tickHandler |
Definition at line 49 of file trace.test.cc.