ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 More...
 
 UnitTestDir (const std::string &package, const std::string &name)
 effects: standard constructor guarantee: strong failures: out of memory failures: directory creation errors More...
 
 ~UnitTestDir ()
 effects: standard destructor guarantee: no-fail More...
 
const std::string & path () const
 description: the path to the directory guarantee: no-fail More...
 
bool cleanup () const
 description: whether we clean up on completion guarantee: no-fail More...
 
void cleanup (bool val_cleanup)
 

Private Member Functions

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

Private Attributes

std::string m_path
 description: members directly corresponding to accessors More...
 
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  }

◆ 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  {
59  RCU_DESTROY_INVARIANT (this);
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  }

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  }

◆ cleanup() [2/2]

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

Definition at line 87 of file UnitTestDir.cxx.

89  {
90  RCU_CHANGE_INVARIANT (this);
91  m_cleanup = val_cleanup;
92  }

◆ 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:
Data
@ Data
Definition: BaseObject.h:11
RCU::UnitTestDir::m_path
std::string m_path
description: members directly corresponding to accessors
Definition: UnitTestDir.h:78
beamspotman.tmpdir
string tmpdir
Definition: beamspotman.py:412
merge.output
output
Definition: merge.py:17
RCU_PRINT_MSG
#define RCU_PRINT_MSG(message)
Definition: PrintMsg.h:49
RCU::UnitTestDir::m_cleanup
bool m_cleanup
Definition: UnitTestDir.h:80
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
RCU_DESTROY_INVARIANT
#define RCU_DESTROY_INVARIANT(x)
Definition: Assert.h:235
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition: Assert.h:231
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition: PrintMsg.h:58
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229