summaryrefslogtreecommitdiff
path: root/test/test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-02-02 16:36:31 +0100
committerCarl Hetherington <cth@carlh.net>2021-02-02 16:36:31 +0100
commit369821c41e62d4cce506cd4206f9db0d91b4f643 (patch)
tree2c990929b56ef47d99495a8aa22a23f626420885 /test/test.cc
parentb539d468acc3ca73cc58a4434002e511a4995f7d (diff)
Reduce the disk space needed when running tests.v2.15.124
Diffstat (limited to 'test/test.cc')
-rw-r--r--test/test.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test.cc b/test/test.cc
index 6c811221d..292b4e1d9 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -176,12 +176,15 @@ new_test_film (string name)
}
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);
}
+ if (cleanup) {
+ cleanup->add (p);
+ }
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;
}
+
+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);
+ }
+}