gem5 v24.0.0.0
Loading...
Searching...
No Matches
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.
 
std::string getCptPath () const
 Get the path to the checkpoint file.
 
void simulateSerialization (std::string contents) const
 Create a cpt file with the contents specified by the string.
 
void SetUp () override
 
void TearDown () override
 

Static Public Member Functions

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

Private Attributes

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

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.
 

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.

Referenced by SetUp(), and TEST().

◆ getCptPath()

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

◆ 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(), and SerializableFixture::SetUp().

◆ 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, and getCptPath().

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 Tue Jun 18 2024 16:24:14 for gem5 by doxygen 1.11.0