Try to fix text-file-checking test on Windows.
authorCarl Hetherington <cth@carlh.net>
Sat, 27 Feb 2021 20:16:59 +0000 (21:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 27 Feb 2021 20:17:39 +0000 (21:17 +0100)
test/config_test.cc
test/test.cc
test/test.h

index 0c5c86a4a77d4c41fbcb609c96bd91f72423ec13..d22e635c826a93713b0fb067158f11217a992370 100644 (file)
@@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE (config_write_utf8_test)
        Config::drop ();
        Config::instance()->write();
 
-       check_file ("test/data/utf8_config.xml", "build/test/config.xml");
+       check_file ("test/data/utf8_config.xml", "build/test/config.xml", false);
 
        /* This test has called Config::set_defaults(), so take us back
           to the config that we want for our tests.
index 1e84d5162199e17b708221d84bb2445c43fab9c1..27393386bd1ebdcdb266cbf0bb2580b943bec14d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
 */
 
+
+
 /** @file  test/test.cc
  *  @brief Overall test stuff and useful methods for tests.
  */
 
+
 #include "lib/compose.hpp"
 #include "lib/config.h"
 #include "lib/cross.h"
@@ -61,6 +64,7 @@ extern "C" {
 #include <list>
 #include <vector>
 
+
 using std::abs;
 using std::cerr;
 using std::cout;
@@ -123,6 +127,7 @@ setup_test_config ()
        Config::instance()->set_decryption_chain (decryption);
 }
 
+
 class TestSignalManager : public SignalManager
 {
 public:
@@ -156,8 +161,10 @@ struct TestConfig
        }
 };
 
+
 BOOST_GLOBAL_FIXTURE (TestConfig);
 
+
 boost::filesystem::path
 test_film_dir (string name)
 {
@@ -168,6 +175,7 @@ test_film_dir (string name)
        return p;
 }
 
+
 shared_ptr<Film>
 new_test_film (string name)
 {
@@ -181,6 +189,7 @@ new_test_film (string name)
        return film;
 }
 
+
 shared_ptr<Film>
 new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* cleanup)
 {
@@ -205,6 +214,7 @@ new_test_film2 (string name, vector<shared_ptr<Content>> content, Cleanup* clean
        return film;
 }
 
+
 void
 check_wav_file (boost::filesystem::path ref, boost::filesystem::path check)
 {
@@ -248,6 +258,7 @@ check_wav_file (boost::filesystem::path ref, boost::filesystem::path check)
        }
 }
 
+
 void
 check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check)
 {
@@ -434,13 +445,13 @@ check_image (boost::filesystem::path ref, boost::filesystem::path check, double
 
 
 void
-check_file (boost::filesystem::path ref, boost::filesystem::path check)
+check_file (boost::filesystem::path ref, boost::filesystem::path check, bool binary_mode)
 {
        auto N = boost::filesystem::file_size (ref);
        BOOST_CHECK_EQUAL (N, boost::filesystem::file_size (check));
-       auto ref_file = fopen_boost (ref, "rb");
+       auto ref_file = fopen_boost (ref, binary_mode ? "rb" : "r");
        BOOST_CHECK (ref_file);
-       auto check_file = fopen_boost (check, "rb");
+       auto check_file = fopen_boost (check, binary_mode ? "rb" : "r");
        BOOST_CHECK (check_file);
 
        int const buffer_size = 65536;
@@ -471,6 +482,7 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
        fclose (check_file);
 }
 
+
 static void
 note (dcp::NoteType t, string n)
 {
index a4b6bedd1a503aedf1a5ec024125b13aa2c01d22..9d2262657781734de94e5d0d8d72340ec36b75fc 100644 (file)
@@ -61,12 +61,12 @@ extern std::shared_ptr<Film> new_test_film (std::string);
 extern std::shared_ptr<Film> new_test_film2 (std::string, std::vector<std::shared_ptr<Content>> content = {}, Cleanup* cleanup = nullptr);
 extern void check_dcp (boost::filesystem::path, boost::filesystem::path);
 extern void check_dcp (boost::filesystem::path, std::shared_ptr<const Film>);
-extern void check_file (boost::filesystem::path ref, boost::filesystem::path check);
+extern void check_file (boost::filesystem::path ref, boost::filesystem::path check, bool binary_mode = true);
+extern void check_text_file (boost::filesystem::path ref, boost::filesystem::path check);
 extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path check);
 extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check);
 extern bool mxf_atmos_files_same (boost::filesystem::path ref, boost::filesystem::path check, bool verbose = false);
 extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>);
-extern void check_file (boost::filesystem::path, boost::filesystem::path);
 extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance);
 extern void check_image (boost::filesystem::path, boost::filesystem::path, double threshold = 4);
 extern boost::filesystem::path test_film_dir (std::string);