ATLAS Offline Software
Loading...
Searching...
No Matches
UnitTestDir.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7//
8// includes
9//
10
12
13#include <cstdlib>
14#include <TSystem.h>
15#include <TString.h>
18
19//
20// method implementations
21//
22
23namespace RCU
24{
25 void UnitTestDir ::
26 testInvariant () const
27 {
28 //RCU_INVARIANT (this != 0);
29 }
30
31
32
33 UnitTestDir ::
34 UnitTestDir (const std::string& package, const std::string& name)
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 }
50
51
52
53 UnitTestDir ::
54 ~UnitTestDir ()
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 }
63
64
65
66 const std::string& UnitTestDir ::
67 path () const
68 {
69 RCU_READ_INVARIANT (this);
70 return m_path;
71 }
72
73
74
75 bool UnitTestDir ::
76 cleanup () const
77 {
78 RCU_READ_INVARIANT (this);
79 return m_cleanup;
80 }
81
82
83
84 void UnitTestDir ::
85 cleanup (bool val_cleanup)
86 {
88 m_cleanup = val_cleanup;
89 }
90}
#define RCU_DESTROY_INVARIANT(x)
Definition Assert.h:230
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:226
#define RCU_READ_INVARIANT(x)
Definition Assert.h:224
@ Data
Definition BaseObject.h:11
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:53
#define RCU_PRINT_MSG(message)
Definition PrintMsg.h:44
std::string m_path
description: members directly corresponding to accessors
Definition UnitTestDir.h:73
This module defines a variety of assert style macros.
Definition Assert.cxx:23