diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-07-20 00:51:23 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-07-20 10:18:17 +0200 |
| commit | 4bdaccb5ede7d9a1066e0a0665fcfce9b1e3241e (patch) | |
| tree | e8473bb1a1b4736e88a973dc25bcfa369c3ad000 /test | |
| parent | 6d101863c87b34af5c3992168182e80445e56ec7 (diff) | |
Allow multiple DCPs to be written to a disk (#1756).
Diffstat (limited to 'test')
| -rw-r--r-- | test/disk_writer_test.cc | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/test/disk_writer_test.cc b/test/disk_writer_test.cc index dae991e58..553adcae7 100644 --- a/test/disk_writer_test.cc +++ b/test/disk_writer_test.cc @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE (disk_writer_test1) /* Some arbitrary file size here */ make_random_file (dcp / "foo", 1024 * 1024 * 32 - 6128); - dcpomatic::write (dcp, disk.string(), partition.string(), nullptr); + dcpomatic::write ({dcp}, disk.string(), partition.string(), nullptr); BOOST_CHECK_EQUAL (system("/sbin/e2fsck -fn build/test/disk_writer_test1.partition"), 0); @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE (disk_writer_test2) make_empty_file(partition, 31043571712LL); auto const dcp = TestPaths::private_data() / "xm"; - dcpomatic::write(dcp, disk.string(), partition.string(), nullptr); + dcpomatic::write({dcp}, disk.string(), partition.string(), nullptr); BOOST_CHECK_EQUAL(system("/sbin/e2fsck -fn build/test/disk_writer_test2.partition"), 0); @@ -183,6 +183,53 @@ BOOST_AUTO_TEST_CASE (disk_writer_test2) } + +BOOST_AUTO_TEST_CASE (disk_writer_test3) +{ + using namespace boost::filesystem; + using namespace boost::process; + + remove_all("build/test/disk_writer_test3.disk"); + remove_all("build/test/disk_writer_test3.partition"); + remove_all("build/test/disk_writer_test3"); + + Cleanup cl; + + path const disk = "build/test/disk_writer_test3.disk"; + path const partition = "build/test/disk_writer_test3.partition"; + + cl.add(disk); + cl.add(partition); + + /* Using empty files here still triggers the bug and is much quicker than using random data */ + make_empty_file(disk, 31043616768LL); + make_empty_file(partition, 31043571712LL); + + vector<boost::filesystem::path> const dcps = { + TestPaths::private_data() / "xm", + TestPaths::private_data() / "JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV" + }; + dcpomatic::write(dcps, disk.string(), partition.string(), nullptr); + + BOOST_CHECK_EQUAL(system("/sbin/e2fsck -fn build/test/disk_writer_test3.partition"), 0); + + path const check = "build/test/disk_writer_test3"; + create_directory(check); + cl.add(check); + + for (auto dcp: dcps) { + for (auto original: directory_iterator(dcp)) { + auto path_in_copy = dcp.filename() / 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; |
