From 8f8ffead78f16269f22b5b0354395d0a583873fa Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 13 Feb 2018 10:47:22 +0000 Subject: [PATCH] Add some tolerance when checking audio references. --- test/ffmpeg_encoder_test.cc | 7 ++----- test/test.cc | 8 +++++--- test/test.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index df64a2c48..c847619d9 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2017 Carl Hetherington + Copyright (C) 2017-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -221,8 +221,5 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_basic_test_mixdown) FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_basic_test_mixdown.mp4", FFmpegEncoder::FORMAT_H264, true); encoder.go (); - /* Skip the first video packet when checking as it contains x264 options which can vary between machines - (e.g. number of threads used for encoding). - */ - check_ffmpeg ("build/test/ffmpeg_encoder_basic_test_mixdown.mp4", "test/data/ffmpeg_encoder_basic_test_mixdown.mp4"); + check_ffmpeg ("build/test/ffmpeg_encoder_basic_test_mixdown.mp4", "test/data/ffmpeg_encoder_basic_test_mixdown.mp4", 1); } diff --git a/test/test.cc b/test/test.cc index 551f64dbd..f829a86f6 100644 --- a/test/test.cc +++ b/test/test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -34,6 +34,8 @@ #include "lib/ratio.h" #include "lib/dcp_content_type.h" #include "lib/log_entry.h" +#include "lib/compose.hpp" +#include "test.h" #include #include #include @@ -436,9 +438,9 @@ write_image (shared_ptr image, boost::filesystem::path file, string } void -check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check) +check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check, int audio_tolerance) { - int const r = system (string("ffcmp " + ref.string() + " " + check.string()).c_str()); + int const r = system (String::compose("ffcmp -t %1 %2 %3", audio_tolerance, ref.string(), check.string()).c_str()); BOOST_REQUIRE_EQUAL (WEXITSTATUS(r), 0); } diff --git a/test/test.h b/test/test.h index ff5a2a34e..78fa26b43 100644 --- a/test/test.h +++ b/test/test.h @@ -35,7 +35,7 @@ extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check); extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list); extern void check_file (boost::filesystem::path, boost::filesystem::path); -extern void check_ffmpeg (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); extern boost::filesystem::path test_film_dir (std::string); extern void write_image (boost::shared_ptr image, boost::filesystem::path file, std::string format); -- 2.30.2