projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reduce the disk space needed when running tests.
[dcpomatic.git]
/
test
/
test.cc
diff --git
a/test/test.cc
b/test/test.cc
index 6c811221d9a3de55d7ef03017cf602f9d0e7739c..292b4e1d9436b60365c6ad5e604a512f52cc108e 100644
(file)
--- a/
test/test.cc
+++ b/
test/test.cc
@@
-176,12
+176,15
@@
new_test_film (string name)
}
shared_ptr<Film>
}
shared_ptr<Film>
-new_test_film2 (string name)
+new_test_film2 (string name
, Cleanup* cleanup
)
{
auto p = test_film_dir (name);
if (boost::filesystem::exists (p)) {
boost::filesystem::remove_all (p);
}
{
auto p = test_film_dir (name);
if (boost::filesystem::exists (p)) {
boost::filesystem::remove_all (p);
}
+ if (cleanup) {
+ cleanup->add (p);
+ }
auto film = make_shared<Film>(p);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
auto film = make_shared<Film>(p);
film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
@@
-811,3
+814,19
@@
operator<< (std::ostream&s, VideoFrameType f)
return s;
}
return s;
}
+
+void
+Cleanup::add (boost::filesystem::path path)
+{
+ _paths.push_back (path);
+}
+
+
+void
+Cleanup::run ()
+{
+ boost::system::error_code ec;
+ for (auto i: _paths) {
+ boost::filesystem::remove_all (i, ec);
+ }
+}