ATLAS Offline Software
Loading...
Searching...
No Matches
RCU::UnitTestDir Class Reference

#include <UnitTestDir.h>

Collaboration diagram for RCU::UnitTestDir:

Public Member Functions

void testInvariant () const
 effects: test the invariant of this object guarantee: no-fail
 UnitTestDir (const std::string &package, const std::string &name)
 effects: standard constructor guarantee: strong failures: out of memory failures: directory creation errors
 ~UnitTestDir ()
 effects: standard destructor guarantee: no-fail
const std::string & path () const
 description: the path to the directory guarantee: no-fail
bool cleanup () const
 description: whether we clean up on completion guarantee: no-fail
void cleanup (bool val_cleanup)

Private Member Functions

 UnitTestDir (const UnitTestDir &)
 rationale: I'm making these private to avoid copying
UnitTestDiroperator= (const UnitTestDir &)

Private Attributes

std::string m_path
 description: members directly corresponding to accessors
bool m_cleanup

Detailed Description

Definition at line 26 of file UnitTestDir.h.

Constructor & Destructor Documentation

◆ UnitTestDir() [1/2]

RCU::UnitTestDir::UnitTestDir ( const std::string & package,
const std::string & name )

effects: standard constructor guarantee: strong failures: out of memory failures: directory creation errors

Definition at line 36 of file UnitTestDir.cxx.

38 : m_cleanup (getenv ("ROOTCORE_AUTO_UT") != 0)
39 {
40 TString output = "/tmp";
41 {
42 const char *tmpdir = getenv ("TMPDIR");
43 if (tmpdir)
44 output = tmpdir;
45 };
46 output += ("/ut-" + package + "-" + name + ".$$").c_str();
47 gSystem->ExpandPathName (output);
48 m_path = output.Data ();
49
50 if (gSystem->MakeDirectory (output.Data()) != 0)
51 RCU_THROW_MSG (("could not create output directory " + output).Data());
52 }
@ Data
Definition BaseObject.h:11
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:58
std::string getenv(const std::string &variableName)
get an environment variable
output
Definition merge.py:16

◆ UnitTestDir() [2/2]

RCU::UnitTestDir::UnitTestDir ( const UnitTestDir & )
private

rationale: I'm making these private to avoid copying

◆ ~UnitTestDir()

RCU::UnitTestDir::~UnitTestDir ( )

effects: standard destructor guarantee: no-fail

Definition at line 56 of file UnitTestDir.cxx.

58 {
60
61 if (m_cleanup)
62 gSystem->Exec (("rm -rf " + m_path).c_str());
63 else
64 RCU_PRINT_MSG ("unit test data located at " + m_path);
65 }
#define RCU_DESTROY_INVARIANT(x)
Definition Assert.h:235
#define RCU_PRINT_MSG(message)
Definition PrintMsg.h:49
std::string m_path
description: members directly corresponding to accessors
Definition UnitTestDir.h:78

Member Function Documentation

◆ cleanup() [1/2]

bool RCU::UnitTestDir::cleanup ( ) const

description: whether we clean up on completion guarantee: no-fail

Definition at line 78 of file UnitTestDir.cxx.

80 {
81 RCU_READ_INVARIANT (this);
82 return m_cleanup;
83 }
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229

◆ cleanup() [2/2]

void RCU::UnitTestDir::cleanup ( bool val_cleanup)

Definition at line 87 of file UnitTestDir.cxx.

89 {
91 m_cleanup = val_cleanup;
92 }
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:231

◆ operator=()

UnitTestDir & RCU::UnitTestDir::operator= ( const UnitTestDir & )
private

◆ path()

const std::string & RCU::UnitTestDir::path ( ) const

description: the path to the directory guarantee: no-fail

Definition at line 69 of file UnitTestDir.cxx.

71 {
72 RCU_READ_INVARIANT (this);
73 return m_path;
74 }

◆ testInvariant()

void RCU::UnitTestDir::testInvariant ( ) const

effects: test the invariant of this object guarantee: no-fail

Definition at line 28 of file UnitTestDir.cxx.

30 {
31 //RCU_INVARIANT (this != 0);
32 }

Member Data Documentation

◆ m_cleanup

bool RCU::UnitTestDir::m_cleanup
private

Definition at line 80 of file UnitTestDir.h.

◆ m_path

std::string RCU::UnitTestDir::m_path
private

description: members directly corresponding to accessors

Definition at line 78 of file UnitTestDir.h.


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