gem5  v21.1.0.2
Namespaces | Functions | Variables
trace.test.cc File Reference
#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

 gem5
 Reference material can be found at the JEDEC website: UFS standard http://www.jedec.org/standards-documents/results/jesd220 UFS HCI specification http://www.jedec.org/standards-documents/results/jesd223.
 
 gem5::debug
 

Functions

std::string getString (std::ostream &os)
 
std::string getString (Trace::Logger *logger)
 
 TEST (TraceTest, LogSimpleMessage)
 Test creating a simple log message. More...
 
 TEST (TraceTest, LogMessageName)
 Test creating a simple log message with a name. More...
 
 TEST (TraceTest, LogMessageMaxTick)
 Test that when the tick is set to MaxTick it is not printed. More...
 
 TEST (TraceTest, LogMessageFlagDisabled)
 Test that by default the flag is not printed. More...
 
 TEST (TraceTest, LogMessageTickDisabledAndEnableDisable)
 Test creating a simple log message without tick information and that enabling and disabling format flags work. More...
 
 TEST (TraceTest, LogMessageFlagEnabled)
 Test creating a full log message to verify expected order of appearance. More...
 
 TEST (TraceTest, LogMessageIgnoreOne)
 Test that log messages are not displayed for ignored objects (single). More...
 
 TEST (TraceTest, LogMessageIgnoreMultiple)
 Test that log messages are not displayed for ignored objects (multiple). More...
 
 TEST (TraceTest, DumpIgnored)
 Test that dumping for an ignored name does not log anything. More...
 
 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. More...
 
 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. More...
 
 TEST (TraceTest, DISABLED_GetNullLogger)
 Test that when no logger exists a logger is created redirecting to cerr. More...
 
 TEST (TraceTest, SetGetLogger)
 Test that the logger is set properly. More...
 
 TEST (TraceTest, Output)
 Test that output() gets the ostream of the current debug logger. More...
 
 TEST (TraceTest, DprintfFlagIgnore)
 Test dprintf_flag with ignored name. More...
 
 TEST (TraceTest, DprintfFlagZeroArgs)
 Test dprintf_flag with zero args. More...
 
 TEST (TraceTest, DprintfFlagOneArg)
 Test dprintf_flag with one arg. More...
 
 TEST (TraceTest, DprintfFlagMultipleArgs)
 Test dprintf_flag with multiple args. More...
 
 TEST (TraceTest, DprintfFlagEnabled)
 Test dprintf_flag with flag. More...
 
 TEST (TraceTest, DprintfIgnore)
 Test dprintf with ignored name. More...
 
 TEST (TraceTest, DprintfEnabled)
 Test that dprintf does not have a flag. More...
 
 TEST (TraceTest, DprintfWrapper)
 Test that dprintf is just a flagless wrapper for dprintf_flag. More...
 
 TEST (TraceTest, MacroDDUMP)
 Test DDUMP with tracing on. More...
 
 TEST (TraceTest, MacroDPRINTF)
 Test DPRINTF with tracing on. More...
 
 TEST (TraceTest, MacroDPRINTFS)
 Test DPRINTFS with tracing on. More...
 
 TEST (TraceTest, MacroDPRINTFR)
 Test DPRINTFR with tracing on. More...
 
 TEST (TraceTest, MacroDPRINTFN)
 Test DPRINTFN with tracing on. More...
 
 TEST (TraceTest, MacroDPRINTFNR)
 Test DPRINTFNR with tracing on. More...
 
 TEST (TraceTest, MacroDPRINTF_UNCONDITIONAL)
 Test DPRINTF_UNCONDITIONAL with tracing on. More...
 
 TEST (TraceTest, GlobalName)
 Test that there is a global name() to fall through when a locally scoped name() is not defined. More...
 

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. More...
 

Function Documentation

◆ getString() [1/2]

std::string getString ( std::ostream &  os)
Returns
The ostream as a std::string.

Definition at line 63 of file trace.test.cc.

References gem5::X86ISA::os.

Referenced by getString(), and TEST().

◆ getString() [2/2]

std::string getString ( Trace::Logger logger)
Returns
The logger's ostream as a std::string.

Definition at line 73 of file trace.test.cc.

References gem5::Trace::Logger::getOstream(), and getString().

◆ TEST() [1/30]

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 305 of file trace.test.cc.

References gem5::Trace::getDebugLogger(), gem5::gtestLogOutput, and gem5::Trace::Logger::logMessage().

◆ TEST() [2/30]

TEST ( TraceTest  ,
DprintfEnabled   
)

Test that dprintf does not have a flag.

Definition at line 411 of file trace.test.cc.

References gem5::debug::changeFlag(), gem5::Trace::disable(), gem5::Trace::Logger::dprintf(), gem5::Trace::enable(), getString(), and ss.

◆ TEST() [3/30]

TEST ( TraceTest  ,
DprintfFlagEnabled   
)

◆ TEST() [4/30]

TEST ( TraceTest  ,
DprintfFlagIgnore   
)

Test dprintf_flag with ignored name.

Definition at line 338 of file trace.test.cc.

References gem5::Trace::Logger::dprintf_flag(), getString(), gem5::Trace::Logger::setIgnore(), and ss.

◆ TEST() [5/30]

TEST ( TraceTest  ,
DprintfFlagMultipleArgs   
)

Test dprintf_flag with multiple args.

Definition at line 370 of file trace.test.cc.

References gem5::Trace::Logger::dprintf_flag(), getString(), and ss.

◆ TEST() [6/30]

TEST ( TraceTest  ,
DprintfFlagOneArg   
)

Test dprintf_flag with one arg.

Definition at line 360 of file trace.test.cc.

References gem5::Trace::Logger::dprintf_flag(), getString(), and ss.

◆ TEST() [7/30]

TEST ( TraceTest  ,
DprintfFlagZeroArgs   
)

Test dprintf_flag with zero args.

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

References gem5::Trace::Logger::dprintf_flag(), getString(), and ss.

◆ TEST() [8/30]

TEST ( TraceTest  ,
DprintfIgnore   
)

Test dprintf with ignored name.

Definition at line 399 of file trace.test.cc.

References gem5::Trace::Logger::dprintf(), getString(), gem5::Trace::Logger::setIgnore(), and ss.

◆ TEST() [9/30]

TEST ( TraceTest  ,
DprintfWrapper   
)

Test that dprintf is just a flagless wrapper for dprintf_flag.

Definition at line 425 of file trace.test.cc.

References gem5::Trace::Logger::dprintf(), gem5::Trace::Logger::dprintf_flag(), getString(), and ss.

◆ TEST() [10/30]

TEST ( TraceTest  ,
DumpIgnored   
)

Test that dumping for an ignored name does not log anything.

Definition at line 225 of file trace.test.cc.

References gem5::Trace::Logger::dump(), getString(), gem5::Trace::Logger::setIgnore(), and ss.

◆ TEST() [11/30]

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 282 of file trace.test.cc.

References gem5::Trace::Logger::dump(), getString(), and ss.

◆ TEST() [12/30]

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 244 of file trace.test.cc.

References gem5::debug::changeFlag(), gem5::Trace::disable(), gem5::Trace::Logger::dump(), gem5::Trace::enable(), getString(), and ss.

◆ TEST() [13/30]

TEST ( TraceTest  ,
GlobalName   
)

Test that there is a global name() to fall through when a locally scoped name() is not defined.

Definition at line 591 of file trace.test.cc.

References gem5::debug::changeFlag(), gem5::Trace::disable(), DPRINTF, gem5::Trace::enable(), getString(), gem5::Trace::output(), and gem5::debug::TraceTestDebugFlag.

◆ TEST() [14/30]

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 ss.

◆ TEST() [15/30]

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 ss.

◆ TEST() [16/30]

TEST ( TraceTest  ,
LogMessageIgnoreMultiple   
)

Test that log messages are not displayed for ignored objects (multiple).

Definition at line 194 of file trace.test.cc.

References gem5::Trace::Logger::addIgnore(), getString(), gem5::Trace::OstreamLogger::logMessage(), gem5::Trace::Logger::setIgnore(), and ss.

◆ TEST() [17/30]

TEST ( TraceTest  ,
LogMessageIgnoreOne   
)

Test that log messages are not displayed for ignored objects (single).

Definition at line 170 of file trace.test.cc.

References getString(), gem5::Trace::OstreamLogger::logMessage(), gem5::Trace::Logger::setIgnore(), and ss.

◆ TEST() [18/30]

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 ss.

◆ TEST() [19/30]

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 ss.

◆ TEST() [20/30]

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 ss.

◆ TEST() [21/30]

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 ss.

◆ TEST() [22/30]

TEST ( TraceTest  ,
MacroDDUMP   
)

◆ TEST() [23/30]

TEST ( TraceTest  ,
MacroDPRINTF   
)

◆ TEST() [24/30]

TEST ( TraceTest  ,
MacroDPRINTF_UNCONDITIONAL   
)

◆ TEST() [25/30]

TEST ( TraceTest  ,
MacroDPRINTFN   
)

Test DPRINTFN with tracing on.

Definition at line 537 of file trace.test.cc.

References DPRINTFN, getString(), name(), and gem5::Trace::output().

◆ TEST() [26/30]

TEST ( TraceTest  ,
MacroDPRINTFNR   
)

Test DPRINTFNR with tracing on.

Definition at line 549 of file trace.test.cc.

References DPRINTFNR, getString(), and gem5::Trace::output().

◆ TEST() [27/30]

TEST ( TraceTest  ,
MacroDPRINTFR   
)

◆ TEST() [28/30]

TEST ( TraceTest  ,
MacroDPRINTFS   
)

◆ TEST() [29/30]

TEST ( TraceTest  ,
Output   
)

Test that output() gets the ostream of the current debug logger.

Definition at line 331 of file trace.test.cc.

References gem5::Trace::getDebugLogger(), getString(), and gem5::Trace::output().

◆ TEST() [30/30]

TEST ( TraceTest  ,
SetGetLogger   
)

Test that the logger is set properly.

Definition at line 316 of file trace.test.cc.

References gem5::Trace::getDebugLogger(), getString(), gem5::Trace::OstreamLogger::logMessage(), main_logger, and gem5::Trace::setDebugLogger().

Variable Documentation

◆ main_logger

Trace::OstreamLogger main_logger(ss)

Referenced by TEST().

◆ ss

std::stringstream ss

Definition at line 45 of file trace.test.cc.

Referenced by gem5::ruby::PendingWriteInst::ackWriteCompletion(), gem5::TesterThread::checkDeadlock(), gem5::ruby::UncoalescedTable::checkDeadlock(), sc_gem5::TlmToGem5Bridge< BITWIDTH >::checkTransaction(), gem5::ruby::GPUCoalescer::coalescePacket(), gem5::o3::LSQUnit::completeDataAccess(), gem5::ruby::GPUCoalescer::completeHitCallback(), gem5::X86ISA::X86FaultBase::describe(), gem5::X86ISA::PageFault::describe(), gem5::RegisterFile::dump(), gem5::ExecStage::dumpDispList(), gem5::ProtocolTester::dumpErrorLog(), gem5::dumpSimcall(), TrieTestData::dumpTrie(), sc_core::sc_in_rv< W >::end_of_elaboration(), sc_core::sc_inout_rv< W >::end_of_elaboration(), gem5::EmulationPageTable::externalize(), sc_gem5::Port::finalize(), sc_core::sc_event_finder_t< sc_core::sc_signal_inout_if< bool > >::find_event(), gem5::PowerISA::MiscOp::generateDisassembly(), gem5::PowerISA::CondLogicOp::generateDisassembly(), gem5::PowerISA::PowerStaticInst::generateDisassembly(), gem5::PowerISA::MemDispOp::generateDisassembly(), gem5::PowerISA::CondMoveOp::generateDisassembly(), gem5::PowerISA::BranchOp::generateDisassembly(), gem5::PowerISA::MemDispShiftOp::generateDisassembly(), gem5::PowerISA::IntOp::generateDisassembly(), gem5::SparcISA::SparcStaticInst::generateDisassembly(), gem5::PowerISA::MemIndexOp::generateDisassembly(), gem5::X86ISA::X86MicroopBase::generateDisassembly(), gem5::X86ISA::X86StaticInst::generateDisassembly(), gem5::PowerISA::IntImmOp::generateDisassembly(), gem5::PowerISA::FloatOp::generateDisassembly(), gem5::PowerISA::BranchDispCondOp::generateDisassembly(), gem5::MiscRegImmOp64::generateDisassembly(), gem5::MiscRegRegImmOp64::generateDisassembly(), gem5::PowerISA::BranchRegCondOp::generateDisassembly(), gem5::RegMiscRegImmOp64::generateDisassembly(), gem5::RegNone::generateDisassembly(), gem5::PowerISA::IntArithOp::generateDisassembly(), gem5::PowerISA::IntImmArithOp::generateDisassembly(), gem5::PowerISA::IntDispArithOp::generateDisassembly(), gem5::PowerISA::IntCompOp::generateDisassembly(), gem5::PowerISA::IntImmCompOp::generateDisassembly(), gem5::PowerISA::IntImmCompLogicOp::generateDisassembly(), gem5::PowerISA::IntLogicOp::generateDisassembly(), gem5::PowerISA::IntImmLogicOp::generateDisassembly(), gem5::PowerISA::IntShiftOp::generateDisassembly(), gem5::PowerISA::IntConcatShiftOp::generateDisassembly(), gem5::PowerISA::IntRotateOp::generateDisassembly(), gem5::PowerISA::IntConcatRotateOp::generateDisassembly(), gem5::PowerISA::IntTrapOp::generateDisassembly(), gem5::PowerISA::IntImmTrapOp::generateDisassembly(), gem5::BaseKvmCPU::getAndFormatOneReg(), gem5::ruby::GPUCoalescer::getDynInst(), gem5::LdsState::getDynInstr(), gem5::Logger::print(), gem5::TesterThread::printAllOutstandingReqs(), gem5::TesterThread::printOutstandingReqs(), gem5::ruby::UncoalescedTable::printRequestTable(), gem5::ruby::GPUCoalescer::printRequestTable(), gem5::ruby::garnet::NetworkInterface::OutputPort::printVnets(), gem5::ruby::garnet::NetworkInterface::InputPort::printVnets(), gem5::LdsState::process(), gem5::ProtocolTester::ProtocolTester(), gem5::ruby::RubyPort::MemResponsePort::recvTimingReq(), sc_core::sc_port_base::report_error(), gem5::ScheduleStage::reserveResources(), sc_core::sc_spawn_options::set_stack_size(), sc_gem5::TraceFile::set_time_unit(), gem5::ThermalDomain::setSubSystem(), sc_core::sc_vector_base::size(), TEST(), TEST_F(), sc_core::sc_time::to_string(), sc_core::sc_time_tuple::to_string(), gem5::TesterThread::validateAtomicResp(), gem5::TesterThread::validateLoadResp(), and gem5::ruby::GPUCoalescer::wakeup().

◆ tickHandler

GTestTickHandler tickHandler

Definition at line 49 of file trace.test.cc.


Generated on Tue Sep 21 2021 12:26:26 for gem5 by doxygen 1.8.17