diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-06-11 19:21:16 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-06-11 19:21:16 +0200 |
| commit | 4584924f8d6d803d58cbd64c36f6f82ca20ff0d0 (patch) | |
| tree | 8b0bd1ab7926ed5bb7bd4520a5dcd977c001e164 | |
| parent | a8d652b787b986ec5552816ec24367d98243f6fa (diff) | |
Run verification tests with a space in the XSD path to trigger an old bug.
| -rw-r--r-- | test/test.cc | 9 | ||||
| -rw-r--r-- | test/test.h | 2 | ||||
| -rw-r--r-- | test/verify_test.cc | 37 |
3 files changed, 30 insertions, 18 deletions
diff --git a/test/test.cc b/test/test.cc index c90a38ac..3933e430 100644 --- a/test/test.cc +++ b/test/test.cc @@ -45,6 +45,7 @@ using std::min; using std::list; boost::filesystem::path private_test; +boost::filesystem::path xsd_test = "build/test/xsd with spaces"; struct TestConfig { @@ -54,6 +55,14 @@ struct TestConfig if (boost::unit_test::framework::master_test_suite().argc >= 2) { private_test = boost::unit_test::framework::master_test_suite().argv[1]; } + + using namespace boost::filesystem; + boost::system::error_code ec; + remove_all (xsd_test, ec); + boost::filesystem::create_directory (xsd_test); + for (directory_iterator i = directory_iterator("xsd"); i != directory_iterator(); ++i) { + copy_file (*i, xsd_test / i->path().filename()); + } } }; diff --git a/test/test.h b/test/test.h index 21df1ab5..69ed85be 100644 --- a/test/test.h +++ b/test/test.h @@ -24,6 +24,8 @@ namespace xmlpp { } extern boost::filesystem::path private_test; +extern boost::filesystem::path xsd_test; + extern void check_xml (xmlpp::Element* ref, xmlpp::Element* test, std::list<std::string> ignore); extern void check_xml (std::string ref, std::string test, std::list<std::string> ignore); extern void check_file (boost::filesystem::path ref, boost::filesystem::path check); diff --git a/test/verify_test.cc b/test/verify_test.cc index 4d577a5a..1b506586 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -45,6 +45,7 @@ #include "smpte_subtitle_asset.h" #include "reel_subtitle_asset.h" #include "compose.hpp" +#include "test.h" #include <boost/test/unit_test.hpp> #include <boost/foreach.hpp> #include <boost/algorithm/string.hpp> @@ -135,7 +136,7 @@ BOOST_AUTO_TEST_CASE (verify_test1) { stages.clear (); vector<boost::filesystem::path> directories = setup (1, next_verify_test_number); - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); boost::filesystem::path const cpl_file = dcp::String::compose("build/test/verify_test%1/cpl_81fb54df-e1bf-4647-8788-ea7ba154375b.xml", next_verify_test_number); boost::filesystem::path const pkl_file = dcp::String::compose("build/test/verify_test1/pkl_ae8a9818-872a-4f86-8493-11dfdea03e09.xml", next_verify_test_number); @@ -200,7 +201,7 @@ BOOST_AUTO_TEST_CASE (verify_test2) BOOST_REQUIRE (fwrite (&x, sizeof(x), 1, mod) == 1); fclose (mod); - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 2); BOOST_CHECK_EQUAL (notes.front().type(), dcp::VerificationNote::VERIFY_ERROR); @@ -219,7 +220,7 @@ BOOST_AUTO_TEST_CASE (verify_test3) e.replace ("<Hash>", "<Hash>x"); } - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); dump_notes (notes); @@ -255,7 +256,7 @@ BOOST_AUTO_TEST_CASE (verify_test4) e.replace ("<ContentKind>", "<ContentKind>x"); } - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 1); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::GENERAL_READ); @@ -293,7 +294,7 @@ void check_after_replace (int n, boost::function<boost::filesystem::path (int)> e.replace (from, to); } - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); dump_notes (notes); @@ -311,7 +312,7 @@ void check_after_replace (int n, boost::function<boost::filesystem::path (int)> e.replace (from, to); } - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); dump_notes (notes); @@ -337,7 +338,7 @@ void check_after_replace ( e.replace (from, to); } - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); dump_notes (notes); @@ -367,7 +368,7 @@ BOOST_AUTO_TEST_CASE (verify_test6) vector<boost::filesystem::path> directories = setup (1, next_verify_test_number++); boost::filesystem::remove ("build/test/verify_test6/video.mxf"); - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 1); BOOST_CHECK_EQUAL (notes.front().type(), dcp::VerificationNote::VERIFY_ERROR); @@ -450,7 +451,7 @@ BOOST_AUTO_TEST_CASE (verify_test13) { stages.clear (); vector<boost::filesystem::path> directories = setup (3, next_verify_test_number); - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); boost::filesystem::path const cpl_file = dcp::String::compose("build/test/verify_test%1/cpl_cbfd2bc0-21cf-4a8f-95d8-9cddcbe51296.xml", next_verify_test_number); boost::filesystem::path const pkl_file = dcp::String::compose("build/test/verify_test%1/pkl_d87a950c-bd6f-41f6-90cc-56ccd673e131.xml", next_verify_test_number); @@ -501,7 +502,7 @@ BOOST_AUTO_TEST_CASE (verify_test13) BOOST_AUTO_TEST_CASE (verify_test14) { vector<boost::filesystem::path> directories = setup (8, next_verify_test_number); - list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (directories, &stage, &progress, xsd_test); dump_notes (notes); @@ -576,7 +577,7 @@ BOOST_AUTO_TEST_CASE (verify_test15) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 1); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::PICTURE_FRAME_TOO_LARGE); } @@ -603,7 +604,7 @@ BOOST_AUTO_TEST_CASE (verify_test16) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 1); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::PICTURE_FRAME_NEARLY_TOO_LARGE); } @@ -623,7 +624,7 @@ BOOST_AUTO_TEST_CASE (verify_test17) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 0); } @@ -647,7 +648,7 @@ BOOST_AUTO_TEST_CASE (verify_test18) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); BOOST_REQUIRE_EQUAL (notes.size(), 0); } @@ -676,7 +677,7 @@ BOOST_AUTO_TEST_CASE (verify_test19) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); dump_notes(notes); BOOST_REQUIRE_EQUAL (notes.size(), 2); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::XML_VALIDATION_ERROR); @@ -703,7 +704,7 @@ BOOST_AUTO_TEST_CASE (verify_test20) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); dump_notes (notes); BOOST_REQUIRE_EQUAL (notes.size(), 0); } @@ -728,7 +729,7 @@ BOOST_AUTO_TEST_CASE (verify_test21) vector<boost::filesystem::path> dirs; dirs.push_back (dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); dump_notes (notes); BOOST_REQUIRE_EQUAL (notes.size(), 2); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::XML_VALIDATION_ERROR); @@ -765,7 +766,7 @@ BOOST_AUTO_TEST_CASE (verify_test22) vector<boost::filesystem::path> dirs; dirs.push_back (vf_dir); - list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, "xsd"); + list<dcp::VerificationNote> notes = dcp::verify (dirs, &stage, &progress, xsd_test); dump_notes (notes); BOOST_REQUIRE_EQUAL (notes.size(), 1); BOOST_CHECK_EQUAL (notes.front().code(), dcp::VerificationNote::EXTERNAL_ASSET); |
