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 21 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 33 of file UnitTestDir.cxx.

35 : m_cleanup (getenv ("ROOTCORE_AUTO_UT") != 0)
36 {
37 TString output = "/tmp";
38 {
39 const char *tmpdir = getenv ("TMPDIR");
40 if (tmpdir)
41 output = tmpdir;
42 };
43 output += ("/ut-" + package + "-" + name + ".$$").c_str();
44 gSystem->ExpandPathName (output);
45 m_path = output.Data ();
46
47 if (gSystem->MakeDirectory (output.Data()) != 0)
48 RCU_THROW_MSG (("could not create output directory " + output).Data());
49 }
@ Data
Definition BaseObject.h:11
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:53
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 53 of file UnitTestDir.cxx.

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

Member Function Documentation

◆ cleanup() [1/2]

bool RCU::UnitTestDir::cleanup ( ) const

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

Definition at line 75 of file UnitTestDir.cxx.

77 {
78 RCU_READ_INVARIANT (this);
79 return m_cleanup;
80 }
#define RCU_READ_INVARIANT(x)
Definition Assert.h:224

◆ cleanup() [2/2]

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

Definition at line 84 of file UnitTestDir.cxx.

86 {
88 m_cleanup = val_cleanup;
89 }
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:226

◆ 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 66 of file UnitTestDir.cxx.

68 {
69 RCU_READ_INVARIANT (this);
70 return m_path;
71 }

◆ testInvariant()

void RCU::UnitTestDir::testInvariant ( ) const

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

Definition at line 25 of file UnitTestDir.cxx.

27 {
28 //RCU_INVARIANT (this != 0);
29 }

Member Data Documentation

◆ m_cleanup

bool RCU::UnitTestDir::m_cleanup
private

Definition at line 75 of file UnitTestDir.h.

◆ m_path

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

description: members directly corresponding to accessors

Definition at line 73 of file UnitTestDir.h.


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