summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-01-11 16:24:38 +0100
committerCarl Hetherington <cth@carlh.net>2024-01-15 10:26:06 +0100
commit27513a18c7bb63a9142d40b866a026d1bcc17134 (patch)
tree0a3c3bd68cd57554e89d278c2603fc4d16619c59
parent7ea73fdcfa96aac86546b80b6e6c2edbdd524199 (diff)
Inspect all DCPs made during tests with dcp_inspect.
-rwxr-xr-xrun/tests4
-rw-r--r--test/atmos_test.cc2
-rw-r--r--test/cpl_hash_test.cc2
-rw-r--r--test/dcp_decoder_test.cc2
-rw-r--r--test/dcp_digest_file_test.cc2
-rw-r--r--test/j2k_bandwidth_test.cc4
-rw-r--r--test/map_cli_test.cc5
-rw-r--r--test/no_use_video_test.cc2
-rw-r--r--test/reels_test.cc11
-rw-r--r--test/silence_padding_test.cc2
-rw-r--r--test/test.cc38
-rw-r--r--test/test.h2
-rw-r--r--test/vf_test.cc16
13 files changed, 70 insertions, 22 deletions
diff --git a/run/tests b/run/tests
index 512a497a6..7f8126fa3 100755
--- a/run/tests
+++ b/run/tests
@@ -19,6 +19,10 @@ if [ "$(uname)" == "Linux" ]; then
if [ ! -f build/test/dcpomatic2_openssl ]; then
ln -s ../../../openssl/apps/openssl build/test/dcpomatic2_openssl
fi
+ export DCPOMATIC_TEST_TOOLS_PATH=/opt/asdcplib/bin
+ if [ -f /src/backports/dcp_inspect ]; then
+ export DCPOMATIC_DCP_INSPECT=/src/backports/dcp_inspect
+ fi
fi
if [ "$(uname)" == "Darwin" ]; then
diff --git a/test/atmos_test.cc b/test/atmos_test.cc
index 170736825..9fdddc979 100644
--- a/test/atmos_test.cc
+++ b/test/atmos_test.cc
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(atmos_replace_test)
auto vf = new_test_film2("atmos_merge_test_vf", { ov_content, atmos_1.front() });
ov_content->set_reference_video(true);
atmos_1.front()->set_position(vf, dcpomatic::DCPTime());
- make_and_verify_dcp(vf, { dcp::VerificationNote::Code::MISSING_CPL_METADATA, dcp::VerificationNote::Code::EXTERNAL_ASSET });
+ make_and_verify_dcp(vf, { dcp::VerificationNote::Code::MISSING_CPL_METADATA, dcp::VerificationNote::Code::EXTERNAL_ASSET }, false);
// atmos_1.mxf should contain all ones for its data, and it should have replaced atmos_0 in this DCP
check(vf, 1);
}
diff --git a/test/cpl_hash_test.cc b/test/cpl_hash_test.cc
index 39c36561b..3b430a6bd 100644
--- a/test/cpl_hash_test.cc
+++ b/test/cpl_hash_test.cc
@@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test)
);
ov_content->set_reference_video (true);
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
/* Check for Hash tags in the VF DCP */
int hashes = 0;
diff --git a/test/dcp_decoder_test.cc b/test/dcp_decoder_test.cc
index a37b60ee8..d0052f4a1 100644
--- a/test/dcp_decoder_test.cc
+++ b/test/dcp_decoder_test.cc
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE (check_reuse_old_data_test)
auto ov_content = make_shared<DCPContent>(ov->dir(ov->dcp_name(false)));
auto vf = new_test_film2 ("check_reuse_old_data_vf", {ov_content, content_factory("test/data/L.wav")[0]});
ov_content->set_reference_video (true);
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
auto encrypted = new_test_film2 ("check_reuse_old_data_decrypted");
encrypted->examine_and_add_content (content_factory("test/data/flat_red.png")[0]);
diff --git a/test/dcp_digest_file_test.cc b/test/dcp_digest_file_test.cc
index d67c734c1..f22aa6d67 100644
--- a/test/dcp_digest_file_test.cc
+++ b/test/dcp_digest_file_test.cc
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE (dcp_digest_file_test2)
ov_dcp->set_reference_audio (true);
auto vf = new_test_film2 ("dcp_digest_file_test2_vf", { ov_dcp });
vf->set_encrypted (true);
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
auto vf_key_check = get_key_from_digest ("build/test/dcp_digest_file_test2_vf/" + vf->dcp_name() + ".dcpdig");
BOOST_REQUIRE (static_cast<bool>(vf_key_check));
diff --git a/test/j2k_bandwidth_test.cc b/test/j2k_bandwidth_test.cc
index 04e30d651..03163d8ea 100644
--- a/test/j2k_bandwidth_test.cc
+++ b/test/j2k_bandwidth_test.cc
@@ -60,7 +60,9 @@ check (int target_bits_per_second)
dcp::VerificationNote::Code::NEARLY_INVALID_PICTURE_FRAME_SIZE_IN_BYTES,
dcp::VerificationNote::Code::INVALID_PICTURE_FRAME_SIZE_IN_BYTES,
dcp::VerificationNote::Code::INVALID_JPEG2000_TILE_PART_SIZE,
- });
+ },
+ target_bits_per_second <= 250000000
+ );
boost::filesystem::directory_iterator i (boost::filesystem::path("build") / "test" / name / "video");
boost::filesystem::path test = *i++;
diff --git a/test/map_cli_test.cc b/test/map_cli_test.cc
index 5a774b6a4..ca75ed520 100644
--- a/test/map_cli_test.cc
+++ b/test/map_cli_test.cc
@@ -254,12 +254,11 @@ test_map_ov_vf_copy(vector<string> extra_args = {})
make_and_verify_dcp(ov_film);
auto const ov_dir = ov_film->dir(ov_film->dcp_name());
-
auto vf_ov = make_shared<DCPContent>(ov_dir);
auto vf_sound = content_factory("test/data/sine_440.wav").front();
auto vf_film = new_test_film2(name + "_vf", { vf_ov, vf_sound });
vf_ov->set_reference_video(true);
- make_and_verify_dcp(vf_film, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf_film, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
auto const vf_dir = vf_film->dir(vf_film->dcp_name());
@@ -315,7 +314,7 @@ BOOST_AUTO_TEST_CASE(map_ov_vf_copy_multiple_reference)
vf_ov2->set_position(vf_film, vf_ov1->end(vf_film));
vf_ov1->set_reference_video(true);
vf_ov2->set_reference_video(true);
- make_and_verify_dcp(vf_film, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf_film, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
auto const vf_dir = vf_film->dir(vf_film->dcp_name());
diff --git a/test/no_use_video_test.cc b/test/no_use_video_test.cc
index b2e019581..d9e2c7c00 100644
--- a/test/no_use_video_test.cc
+++ b/test/no_use_video_test.cc
@@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE (no_use_video_test3)
A->set_reference_audio (true);
B->set_reference_video (true);
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
dcp::DCP ov_a_check (ov_a->dir(ov_a->dcp_name()));
ov_a_check.read ();
diff --git a/test/reels_test.cc b/test/reels_test.cc
index 2a87ef6b6..fe209a4fe 100644
--- a/test/reels_test.cc
+++ b/test/reels_test.cc
@@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE (reels_test2)
c->set_reference_video (true);
c->set_reference_audio (true);
- make_and_verify_dcp (film2, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(film2, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
}
@@ -306,12 +306,14 @@ BOOST_AUTO_TEST_CASE (reels_test6)
film->set_reel_type (ReelType::BY_LENGTH);
/* This is just over 2.5s at 100Mbit/s; should correspond to 60 frames */
film->set_reel_length (31253154);
+ /* dcp_inspect gives error about reel <1s in length */
make_and_verify_dcp (
film,
{
dcp::VerificationNote::Code::INVALID_INTRINSIC_DURATION,
dcp::VerificationNote::Code::INVALID_DURATION,
- });
+ },
+ false);
}
@@ -403,7 +405,8 @@ BOOST_AUTO_TEST_CASE (reels_test10)
dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION,
- });
+ },
+ false);
}
@@ -628,7 +631,7 @@ BOOST_AUTO_TEST_CASE (repeated_dcp_into_reels)
original_dcp[i]->set_reference_audio(true);
}
- make_and_verify_dcp(film2, { dcp::VerificationNote::Code::EXTERNAL_ASSET });
+ make_and_verify_dcp(film2, { dcp::VerificationNote::Code::EXTERNAL_ASSET }, false);
dcp::DCP check1(film1->dir(film1->dcp_name()));
check1.read();
diff --git a/test/silence_padding_test.cc b/test/silence_padding_test.cc
index 59614c6c0..a4a5dacc6 100644
--- a/test/silence_padding_test.cc
+++ b/test/silence_padding_test.cc
@@ -66,7 +66,7 @@ test_silence_padding(int channels, dcp::Standard standard)
if (standard == dcp::Standard::INTEROP) {
codes.push_back(dcp::VerificationNote::Code::INVALID_STANDARD);
}
- make_and_verify_dcp(film, codes);
+ make_and_verify_dcp(film, codes, channels == 2 || channels == 6 || channels >= 8);
boost::filesystem::path path = "build/test";
path /= film_name;
diff --git a/test/test.cc b/test/test.cc
index 8ca103a6b..66e638dd5 100644
--- a/test/test.cc
+++ b/test/test.cc
@@ -52,6 +52,7 @@
#include <dcp/openjpeg_image.h>
#include <dcp/reel.h>
#include <dcp/reel_picture_asset.h>
+#include <dcp/scope_guard.h>
#include <dcp/warnings.h>
#include <asdcp/AS_DCP.h>
#include <png.h>
@@ -81,6 +82,7 @@ using std::min;
using std::shared_ptr;
using std::string;
using std::vector;
+using boost::optional;
using boost::scoped_array;
using std::dynamic_pointer_cast;
#if BOOST_VERSION >= 106100
@@ -961,12 +963,46 @@ verify_dcp(boost::filesystem::path dir, vector<dcp::VerificationNote::Code> igno
void
-make_and_verify_dcp (shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore)
+#ifdef DCPOMATIC_LINUX
+make_and_verify_dcp(shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore, bool dcp_inspect)
+#else
+make_and_verify_dcp(shared_ptr<Film> film, vector<dcp::VerificationNote::Code> ignore, bool)
+#endif
{
film->write_metadata ();
make_dcp (film, TranscodeJob::ChangedBehaviour::IGNORE);
BOOST_REQUIRE (!wait_for_jobs());
verify_dcp({film->dir(film->dcp_name())}, ignore);
+
+#ifdef DCPOMATIC_LINUX
+ auto test_tools_path_env = getenv("DCPOMATIC_TEST_TOOLS_PATH");
+ string test_tools_path;
+ if (test_tools_path_env) {
+ test_tools_path = test_tools_path_env;
+ }
+
+ auto old_path_env = getenv("PATH");
+ string old_path;
+ if (old_path_env) {
+ old_path = old_path_env;
+ }
+
+ dcp::ScopeGuard sg = [old_path]() { setenv("PATH", old_path.c_str(), 1); };
+ string new_path = old_path;
+ if (!new_path.empty()) {
+ new_path += ":";
+ }
+ new_path += test_tools_path;
+ setenv("PATH", new_path.c_str(), 1);
+
+ auto dcp_inspect_env = getenv("DCPOMATIC_DCP_INSPECT");
+ if (dcp_inspect && dcp_inspect_env) {
+ boost::filesystem::path dcp_inspect(dcp_inspect_env);
+ auto cmd = String::compose("%1 %2 > %3 2>&1", dcp_inspect, film->dir(film->dcp_name()), film->file("dcp_inspect.log"));
+ auto result = system(cmd.c_str());
+ BOOST_CHECK_EQUAL(WEXITSTATUS(result), 0);
+ }
+#endif
}
diff --git a/test/test.h b/test/test.h
index c586b1ac0..1bcb43ea2 100644
--- a/test/test.h
+++ b/test/test.h
@@ -76,7 +76,7 @@ void check_one_frame (boost::filesystem::path dcp, int64_t index, boost::filesys
extern boost::filesystem::path subtitle_file (std::shared_ptr<Film> film);
extern void make_random_file (boost::filesystem::path path, size_t size);
extern void verify_dcp(boost::filesystem::path dir, std::vector<dcp::VerificationNote::Code> ignore);
-extern void make_and_verify_dcp (std::shared_ptr<Film> film, std::vector<dcp::VerificationNote::Code> ignore = {});
+extern void make_and_verify_dcp(std::shared_ptr<Film> film, std::vector<dcp::VerificationNote::Code> ignore = {}, bool dcp_inspect = true);
extern void check_int_close (int a, int b, int d);
extern void check_int_close (std::pair<int, int>, std::pair<int, int>, int d);
extern boost::filesystem::path find_file (boost::filesystem::path dir, std::string filename_part);
diff --git a/test/vf_test.cc b/test/vf_test.cc
index 2311e3537..eb93dab0e 100644
--- a/test/vf_test.cc
+++ b/test/vf_test.cc
@@ -142,7 +142,9 @@ BOOST_AUTO_TEST_CASE (vf_test2)
dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
- });
+ },
+ false
+ );
dcp::DCP ov_c (ov->dir(ov->dcp_name()));
ov_c.read ();
@@ -197,7 +199,7 @@ BOOST_AUTO_TEST_CASE (vf_test3)
BOOST_REQUIRE (!wait_for_jobs());
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
dcp::DCP vf_c (vf->dir(vf->dcp_name()));
vf_c.read ();
@@ -246,7 +248,7 @@ BOOST_AUTO_TEST_CASE (vf_test4)
BOOST_REQUIRE (!wait_for_jobs());
more_video->set_position (vf, DCPTime());
vf->write_metadata ();
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
dcp::DCP ov_c (ov->dir(ov->dcp_name()));
ov_c.read ();
@@ -299,7 +301,7 @@ BOOST_AUTO_TEST_CASE (vf_test5)
dcp->set_reference_video (true);
dcp->set_reference_audio (true);
dcp->set_trim_end (ContentTime::from_seconds(15));
- make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+ make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
/* Check that the selected reel assets are right */
auto a = get_referenced_reel_assets(vf, vf->playlist());
@@ -351,7 +353,9 @@ BOOST_AUTO_TEST_CASE (vf_test6)
dcp::VerificationNote::Code::EXTERNAL_ASSET,
dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
- });
+ },
+ false
+ );
}
@@ -405,7 +409,7 @@ BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp)
vf_dcp->set_reference_audio(true);
vf_dcp->set_trim_start(vf, ContentTime::from_seconds(10));
vf_dcp->set_position(vf, DCPTime::from_seconds(10));
- make_and_verify_dcp (vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET });
+ make_and_verify_dcp(vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET }, false);
}