X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Ftest.cc;h=66e638dd5f5fb94321b6ae7dc7b68b3ad4f3d745;hb=a4a7d9ef34f2f083b0ba9e32e933ea5c64d2352d;hp=8ca103a6bdedb9800c97ef94f3f14509ac5253ee;hpb=7ea73fdcfa96aac86546b80b6e6c2edbdd524199;p=dcpomatic.git 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 #include #include +#include #include #include #include @@ -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 igno void -make_and_verify_dcp (shared_ptr film, vector ignore) +#ifdef DCPOMATIC_LINUX +make_and_verify_dcp(shared_ptr film, vector ignore, bool dcp_inspect) +#else +make_and_verify_dcp(shared_ptr film, vector 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 }