gem5  v22.0.0.2
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
gem5::SerializationFixture Class Reference

Fixture class that handles temporary directory creation. More...

#include <serialization_fixture.hh>

Inheritance diagram for gem5::SerializationFixture:
CheckpointInFixture SerializableFixture

Public Member Functions

std::string getDirName () const
 Get the name of the directory we have created on SetUp. More...
 
std::string getCptPath () const
 Get the path to the checkpoint file. More...
 
void simulateSerialization (std::string contents) const
 Create a cpt file with the contents specified by the string. More...
 
void SetUp () override
 
void TearDown () override
 

Static Public Member Functions

static std::string generateTempDirName ()
 Generate a temporary directory name. More...
 

Private Attributes

std::string dirName
 The name of the temporary directory. More...
 

Static Private Attributes

static unsigned dirNumber = 0
 Temporary directory names are generated based on this number, which is updated every time the generator function is called. More...
 

Detailed Description

Fixture class that handles temporary directory creation.

These temporary directories are used by the tests in this file, in order to avoid that a failed test will not remove its directory, causing future runs to fail. This has been tailored for checkpoints, so it expects that the directory may contain a cpt file on removal.

Todo:
Ideally the checkpoints should not be necessarily using files, and stringstreams would be used instead to avoid overhead in the tests.

Definition at line 52 of file serialization_fixture.hh.

Member Function Documentation

◆ generateTempDirName()

static std::string gem5::SerializationFixture::generateTempDirName ( )
inlinestatic

Generate a temporary directory name.

Definition at line 69 of file serialization_fixture.hh.

References dirNumber, and sc_dt::to_string().

Referenced by SetUp(), and TEST().

◆ getCptPath()

std::string gem5::SerializationFixture::getCptPath ( ) const
inline

Get the path to the checkpoint file.

Definition at line 79 of file serialization_fixture.hh.

References gem5::CheckpointIn::baseFilename, and getDirName().

Referenced by simulateSerialization(), and TearDown().

◆ getDirName()

std::string gem5::SerializationFixture::getDirName ( ) const
inline

Get the name of the directory we have created on SetUp.

Definition at line 75 of file serialization_fixture.hh.

References dirName.

Referenced by getCptPath().

◆ SetUp()

void gem5::SerializationFixture::SetUp ( )
inlineoverride

◆ simulateSerialization()

void gem5::SerializationFixture::simulateSerialization ( std::string  contents) const
inline

Create a cpt file with the contents specified by the string.

This function should be used when testing unserialization, since it simulates a previous serialization.

Definition at line 90 of file serialization_fixture.hh.

References gem5::X86ISA::contents, and getCptPath().

◆ TearDown()

void gem5::SerializationFixture::TearDown ( )
inlineoverride

Definition at line 107 of file serialization_fixture.hh.

References dirName, getCptPath(), and M5_VAR_USED.

Referenced by SerializableFixture::TearDown().

Member Data Documentation

◆ dirName

std::string gem5::SerializationFixture::dirName
private

The name of the temporary directory.

Definition at line 62 of file serialization_fixture.hh.

Referenced by getDirName(), SetUp(), and TearDown().

◆ dirNumber

unsigned gem5::SerializationFixture::dirNumber = 0
staticprivate

Temporary directory names are generated based on this number, which is updated every time the generator function is called.

Definition at line 59 of file serialization_fixture.hh.

Referenced by generateTempDirName().


The documentation for this class was generated from the following file:

Generated on Thu Jul 28 2022 13:33:12 for gem5 by doxygen 1.8.17