summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-03-15 00:41:20 +0100
committerCarl Hetherington <cth@carlh.net>2024-05-11 21:00:37 +0200
commitd2c665cba983c625933817e0bf05e298f80f0119 (patch)
treec631beb6a9f56b76df71285559a042809d47851e /test
parent59195cd423442f1c2b6c1d97162c1f5ecfe1f609 (diff)
Stop using video directory and hard-linking (#2756).
Instead store details of a previously-created asset in the film's metadata and then look there for potential video files to re-use.
Diffstat (limited to 'test')
-rw-r--r--test/j2k_encode_threading_test.cc4
-rw-r--r--test/j2k_encoder_test.cc2
-rw-r--r--test/j2k_video_bit_rate_test.cc5
-rw-r--r--test/map_cli_test.cc3
-rw-r--r--test/recover_test.cc32
-rw-r--r--test/reel_writer_test.cc2
-rw-r--r--test/video_mxf_content_test.cc2
-rw-r--r--test/writer_test.cc6
8 files changed, 29 insertions, 27 deletions
diff --git a/test/j2k_encode_threading_test.cc b/test/j2k_encode_threading_test.cc
index ee219fbe0..f63f7c829 100644
--- a/test/j2k_encode_threading_test.cc
+++ b/test/j2k_encode_threading_test.cc
@@ -44,7 +44,7 @@ using std::list;
BOOST_AUTO_TEST_CASE(local_threads_created_and_destroyed)
{
auto film = new_test_film2("local_threads_created_and_destroyed", {});
- Writer writer(film, {});
+ Writer writer(film, {}, "foo");
J2KEncoder encoder(film, writer);
encoder.remake_threads(32, 0, {});
@@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(local_threads_created_and_destroyed)
BOOST_AUTO_TEST_CASE(remote_threads_created_and_destroyed)
{
auto film = new_test_film2("remote_threads_created_and_destroyed", {});
- Writer writer(film, {});
+ Writer writer(film, {}, "foo");
J2KEncoder encoder(film, writer);
list<EncodeServerDescription> servers = {
diff --git a/test/j2k_encoder_test.cc b/test/j2k_encoder_test.cc
index 39e3f9135..e231dce88 100644
--- a/test/j2k_encoder_test.cc
+++ b/test/j2k_encoder_test.cc
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(j2k_encoder_deadlock_test)
auto film = new_test_film2("j2k_encoder_deadlock_test");
/* Don't call ::start() on this Writer, so it can never write anything */
- Writer writer(film, {});
+ Writer writer(film, {}, {});
writer.set_encoder_threads(4);
/* We want to test the case where the writer queue fills, and this can't happen unless there
diff --git a/test/j2k_video_bit_rate_test.cc b/test/j2k_video_bit_rate_test.cc
index b8388ca4c..8cb16387b 100644
--- a/test/j2k_video_bit_rate_test.cc
+++ b/test/j2k_video_bit_rate_test.cc
@@ -65,10 +65,7 @@ check (int target_bits_per_second)
target_bits_per_second <= 250000000
);
- boost::filesystem::directory_iterator i (boost::filesystem::path("build") / "test" / name / "video");
- boost::filesystem::path test = *i++;
- BOOST_REQUIRE (i == boost::filesystem::directory_iterator());
-
+ auto test = find_file(film->dir(film->dcp_name()), "j2c_");
double actual_bits_per_second = boost::filesystem::file_size(test) * 8.0 / duration;
/* Check that we're within 85% to 115% of target on average */
diff --git a/test/map_cli_test.cc b/test/map_cli_test.cc
index 0600de31e..6b94be6fe 100644
--- a/test/map_cli_test.cc
+++ b/test/map_cli_test.cc
@@ -207,8 +207,7 @@ BOOST_AUTO_TEST_CASE(map_simple_dcp_copy_with_hardlinks)
verify_dcp(out, {});
- /* The video file will have 3 links because DoM also makes a link into the video directory */
- BOOST_CHECK_EQUAL(boost::filesystem::hard_link_count(find_prefix(out, "j2c_")), 3U);
+ BOOST_CHECK_EQUAL(boost::filesystem::hard_link_count(find_prefix(out, "j2c_")), 2U);
BOOST_CHECK_EQUAL(boost::filesystem::hard_link_count(find_prefix(out, "pcm_")), 2U);
}
diff --git a/test/recover_test.cc b/test/recover_test.cc
index 696a2c36a..30090b4a3 100644
--- a/test/recover_test.cc
+++ b/test/recover_test.cc
@@ -76,13 +76,16 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE
});
- boost::filesystem::path const video = "build/test/recover_test_2d/video/185_2K_4650f318cea570763a0c6411c8c098ce_24_100000000_P_S_L21_0_1200000.mxf";
+ auto video = [film]() {
+ return find_file(boost::filesystem::path("build/test/recover_test_2d") / film->dcp_name(false), "j2c_");
+ };
+
boost::filesystem::copy_file (
- video,
+ video(),
"build/test/recover_test_2d/original.mxf"
);
- boost::filesystem::resize_file (video, 2 * 1024 * 1024);
+ boost::filesystem::resize_file(video(), 2 * 1024 * 1024);
make_and_verify_dcp(
film,
@@ -96,7 +99,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d)
);
auto A = make_shared<dcp::MonoJ2KPictureAsset>("build/test/recover_test_2d/original.mxf");
- auto B = make_shared<dcp::MonoJ2KPictureAsset>(video);
+ auto B = make_shared<dcp::MonoJ2KPictureAsset>(video());
dcp::EqualityOptions eq;
BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
@@ -120,14 +123,16 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t
make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
- boost::filesystem::path const video = "build/test/recover_test_3d/video/185_2K_60a75a531ca9546bdd513163117e2214_24_100000000_P_S_L21_3D_0_96000.mxf";
+ auto video = [film]() {
+ return find_file(boost::filesystem::path("build/test/recover_test_3d") / film->dcp_name(false), "j2c_");
+ };
boost::filesystem::copy_file (
- video,
+ video(),
"build/test/recover_test_3d/original.mxf"
);
- boost::filesystem::resize_file (video, 2 * 1024 * 1024);
+ boost::filesystem::resize_file(video(), 2 * 1024 * 1024);
make_and_verify_dcp(
film,
@@ -140,7 +145,7 @@ BOOST_AUTO_TEST_CASE (recover_test_3d, * boost::unit_test::depends_on("recover_t
);
auto A = make_shared<dcp::StereoJ2KPictureAsset>("build/test/recover_test_3d/original.mxf");
- auto B = make_shared<dcp::StereoJ2KPictureAsset>(video);
+ auto B = make_shared<dcp::StereoJ2KPictureAsset>(video());
dcp::EqualityOptions eq;
BOOST_CHECK (A->equals (B, eq, boost::bind (&note, _1, _2)));
@@ -164,15 +169,16 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
make_and_verify_dcp (film, { dcp::VerificationNote::Code::MISSING_FFEC_IN_FEATURE, dcp::VerificationNote::Code::MISSING_FFMC_IN_FEATURE });
- boost::filesystem::path const video =
- "build/test/recover_test_2d_encrypted/video/185_2K_4650f318cea570763a0c6411c8c098ce_24_100000000_Eeafcb91c9f5472edf01f3a2404c57258_S_L21_0_1200000.mxf";
+ auto video = [film]() {
+ return find_file(boost::filesystem::path("build/test/recover_test_2d_encrypted") / film->dcp_name(false), "j2c_");
+ };
boost::filesystem::copy_file (
- video,
+ video(),
"build/test/recover_test_2d_encrypted/original.mxf"
);
- boost::filesystem::resize_file (video, 2 * 1024 * 1024);
+ boost::filesystem::resize_file(video(), 2 * 1024 * 1024);
make_and_verify_dcp(
film,
@@ -186,7 +192,7 @@ BOOST_AUTO_TEST_CASE (recover_test_2d_encrypted, * boost::unit_test::depends_on(
auto A = make_shared<dcp::MonoJ2KPictureAsset>("build/test/recover_test_2d_encrypted/original.mxf");
A->set_key (film->key ());
- auto B = make_shared<dcp::MonoJ2KPictureAsset>(video);
+ auto B = make_shared<dcp::MonoJ2KPictureAsset>(video());
B->set_key (film->key ());
dcp::EqualityOptions eq;
diff --git a/test/reel_writer_test.cc b/test/reel_writer_test.cc
index f81e8e333..9a756bd46 100644
--- a/test/reel_writer_test.cc
+++ b/test/reel_writer_test.cc
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE (write_frame_info_test)
{
auto film = new_test_film2 ("write_frame_info_test");
dcpomatic::DCPTimePeriod const period (dcpomatic::DCPTime(0), dcpomatic::DCPTime(96000));
- ReelWriter writer (film, period, shared_ptr<Job>(), 0, 1, false);
+ ReelWriter writer(film, period, shared_ptr<Job>(), 0, 1, false, "foo");
/* Write the first one */
diff --git a/test/video_mxf_content_test.cc b/test/video_mxf_content_test.cc
index 3497772a2..77891b0c2 100644
--- a/test/video_mxf_content_test.cc
+++ b/test/video_mxf_content_test.cc
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE (video_mxf_content_test)
});
auto ref = make_shared<dcp::MonoJ2KPictureAsset>(ref_mxf);
- auto comp_mxf = find_file("build/test/video_mxf_content_test/video", ".mxf");
+ auto comp_mxf = find_file(film->file(film->dcp_name()), "j2c_");
auto comp = make_shared<dcp::MonoJ2KPictureAsset>(comp_mxf);
dcp::EqualityOptions op;
BOOST_CHECK (ref->equals (comp, op, note));
diff --git a/test/writer_test.cc b/test/writer_test.cc
index 2d4da570f..b98e553ed 100644
--- a/test/writer_test.cc
+++ b/test/writer_test.cc
@@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE (test_write_odd_amount_of_silence)
auto content = content_factory("test/data/flat_red.png");
auto film = new_test_film2 ("test_write_odd_amount_of_silence", content);
content[0]->video->set_length(24);
- auto writer = make_shared<Writer>(film, shared_ptr<Job>());
+ auto writer = make_shared<Writer>(film, shared_ptr<Job>(), "foo");
auto audio = make_shared<AudioBuffers>(6, 48000);
audio->make_silent ();
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (interrupt_writer)
auto video_ptr = make_shared<dcp::ArrayData>(video.data(), video.size());
auto audio = make_shared<AudioBuffers>(6, 48000 / 24);
- auto writer = make_shared<Writer>(film, shared_ptr<Job>());
+ auto writer = make_shared<Writer>(film, shared_ptr<Job>(), film->dir(film->dcp_name()));
writer->start ();
for (int i = 0; i < frames; ++i) {
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE (interrupt_writer)
/* Start digest calculations then abort them; there should be no crash or error */
boost::thread thread([film, writer]() {
- writer->finish(film->dir(film->dcp_name()));
+ writer->finish();
});
dcpomatic_sleep_seconds (1);