Skip to content

Commit 7508b0b

Browse files
authored
Use a different filename in different instances of the test (QC-188) (#185)
1 parent 90959dc commit 7508b0b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Framework/test/testMonitorObject.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
#define BOOST_TEST_DYN_LINK
2121
#include <boost/test/unit_test.hpp>
2222
#include <cassert>
23+
#include <chrono>
2324
#include <TH1F.h>
2425
#include <TFile.h>
26+
#include <TSystem.h>
2527

2628
using namespace std;
2729

@@ -89,12 +91,14 @@ BOOST_AUTO_TEST_CASE(mo_save)
8991
cout << "check numbers : " << obj.getChecks().size() << endl;
9092
CheckDefinition c = obj.getCheck("name2");
9193
cout << "check2 libraryName : " << c.libraryName << endl;
92-
TFile file("/tmp/test.root", "RECREATE");
94+
std::chrono::nanoseconds ns = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch());
95+
std::string filename = string("/tmp/test") + std::to_string(ns.count()) + ".root";
96+
TFile file(filename.data(), "RECREATE");
9397
obj.Write(obj.getName().data());
9498
file.Close();
9599

96100
cout << "***" << endl;
97-
TFile file2("/tmp/test.root");
101+
TFile file2(filename.data());
98102
o2::quality_control::core::MonitorObject* mo = dynamic_cast<o2::quality_control::core::MonitorObject*>(file2.Get(objectName.data()));
99103
BOOST_CHECK_NE(mo, nullptr);
100104
cout << "mo : " << mo << endl;
@@ -109,6 +113,7 @@ BOOST_AUTO_TEST_CASE(mo_save)
109113
CheckDefinition c2 = mo->getCheck("name2");
110114
cout << "check2 libraryName : " << c2.libraryName << endl;
111115
BOOST_CHECK_EQUAL(c2.libraryName, libName2);
116+
gSystem->Unlink(filename.data());
112117
}
113118

114119
} // namespace o2::quality_control::core

0 commit comments

Comments
 (0)