summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-18 16:15:59 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-18 16:15:59 +0200
commitc06c71f4273d2c81677f35ac7d6de90402940121 (patch)
tree1cad56fbb00b280b05dcc515101cdb077c8a7066
parentb408200932985f8939eece2e6468e429c72f656e (diff)
Add a test doing a more substantial copy.
-rw-r--r--test/disk_writer_test.cc42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/disk_writer_test.cc b/test/disk_writer_test.cc
index 32cd76bc3..f22d27b9a 100644
--- a/test/disk_writer_test.cc
+++ b/test/disk_writer_test.cc
@@ -42,7 +42,7 @@ using std::vector;
static
void
-create_empty (boost::filesystem::path file, int size)
+create_empty (boost::filesystem::path file, off_t size)
{
auto fd = open (file.string().c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
BOOST_REQUIRE (fd != -1);
@@ -139,6 +139,46 @@ BOOST_AUTO_TEST_CASE (disk_writer_test1)
}
+BOOST_AUTO_TEST_CASE (disk_writer_test2)
+{
+ using namespace boost::filesystem;
+ using namespace boost::process;
+
+ remove_all("build/test/disk_writer_test2.disk");
+ remove_all("build/test/disk_writer_test2.partition");
+ remove_all("build/test/disk_writer_test2");
+
+ Cleanup cl;
+
+ path const disk = "build/test/disk_writer_test2.disk";
+ path const partition = "build/test/disk_writer_test2.partition";
+
+ cl.add(disk);
+ cl.add(partition);
+
+ create_empty(disk, 4LL * 1024LL * 1024LL * 1024LL);
+ create_empty(partition, 4LL * 1024LL * 1024LL * 1024LL);
+
+ auto const dcp = TestPaths::private_data() / "xm";
+ dcpomatic::write(dcp, disk.string(), partition.string(), 0);
+
+ BOOST_CHECK_EQUAL(system("/sbin/e2fsck -fn build/test/disk_writer_test2.partition"), 0);
+
+ path const check = "build/test/disk_writer_test2";
+ create_directory(check);
+ cl.add(check);
+
+ for (auto original: directory_iterator(dcp)) {
+ auto path_in_copy = path("xm") / original.path().filename();
+ auto path_in_check = check / original.path().filename();
+ system("e2cp " + partition.string() + ":" + path_in_copy.string() + " " + path_in_check.string());
+ check_file(original.path(), path_in_check);
+ }
+
+ cl.run();
+}
+
+
BOOST_AUTO_TEST_CASE (osx_drive_identification_test)
{
vector<OSXDisk> disks;