Inspect most DCPs made during tests with dcp_inspect (#76).
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Jan 2024 15:24:38 +0000 (16:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Jan 2024 11:44:42 +0000 (12:44 +0100)
13 files changed:
run/tests
test/atmos_test.cc
test/cpl_hash_test.cc
test/dcp_decoder_test.cc
test/dcp_digest_file_test.cc
test/j2k_bandwidth_test.cc
test/map_cli_test.cc
test/no_use_video_test.cc
test/reels_test.cc
test/silence_padding_test.cc
test/test.cc
test/test.h
test/vf_test.cc

index 512a497a6f3a64f9abf47a3e098e234cf76dd3d6..7f8126fa306cf954c97c4d0e2b1b177ecfa40f62 100755 (executable)
--- 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
index 17073682520a945705f136a3244fad2f74a13c5d..9fdddc979306c79bb451437abe0bcf5490547ad0 100644 (file)
@@ -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);
 }
index 39c36561b5d97cb59835a2ad69a3abfe992ba9ab..3b430a6bd149e26ff794a3632ca20fe6a2bf96c4 100644 (file)
@@ -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;
index a37b60ee8d00d73bce8c4e8ae9cb89c187f53493..d0052f4a1bff518d6bfad7e6141c4c2cce280fe3 100644 (file)
@@ -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]);
index d67c734c126c3fc97d1b7cbc66b8376d10df4bb2..f22aa6d67cc97d869826d85d945b08dbc6b3cc01 100644 (file)
@@ -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));
index 04e30d651511c8473b6303199c9b73190b164c9c..03163d8ea7cbb487eecc5fbff1ae9dc1ced55a30 100644 (file)
@@ -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++;
index 5a774b6a44ccb26f046473e4953237b05df31584..ca75ed5207681a7720fa601b3162f391b5543141 100644 (file)
@@ -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());
 
index b2e01958166474e46ae8c175dde0a49f80e3aadb..d9e2c7c0052f0c1195f5e82c483c456ac7e61674 100644 (file)
@@ -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 ();
index 2a87ef6b64bec37cb62be23228f47646104f4536..fe209a4fe93318b7a59bccf77adc43c60db3df8a 100644 (file)
@@ -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();
index 59614c6c0f0b39e7cc7e68d5eb19aa81a119df99..a4a5dacc645e94187519a39b212b77781cb4daf6 100644 (file)
@@ -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;
index 8ca103a6bdedb9800c97ef94f3f14509ac5253ee..66e638dd5f5fb94321b6ae7dc7b68b3ad4f3d745 100644 (file)
@@ -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
 }
 
 
index c586b1ac00363886e5429b9c437315f4b3bdd854..1bcb43ea24b6e1f2deed494e7c8569bee9b6fdea 100644 (file)
@@ -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);
index 2311e353733ad55553c794102d984f3e9554a503..eb93dab0e8fad5f40e6a86e9c39842e9b982dc4d 100644 (file)
@@ -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);
 }