From 7183198c4db92a634245ff91ccd49f4bed875b73 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 21 Jul 2012 03:46:49 +0100 Subject: [PATCH] Remove long tests in favour of full test corpus. --- run/short-tests | 11 --- run/tests | 11 +++ test/film/log | 3 - test/film/metadata | 18 ----- test/long.cc | 156 ------------------------------------- test/{short.cc => test.cc} | 0 test/wscript | 14 +--- 7 files changed, 14 insertions(+), 199 deletions(-) delete mode 100755 run/short-tests create mode 100755 run/tests delete mode 100644 test/film/log delete mode 100644 test/film/metadata delete mode 100644 test/long.cc rename test/{short.cc => test.cc} (100%) diff --git a/run/short-tests b/run/short-tests deleted file mode 100755 index 4f2567029..000000000 --- a/run/short-tests +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -export LD_LIBRARY_PATH=build/src/lib:$LD_LIBRARY_PATH -if [ "$1" == "--debug" ]; then - gdb --args build/test/short-unit-tests -elif [ "$1" == "--valgrind" ]; then - valgrind --tool="memcheck" --leak-check=full build/test/short-unit-tests -else - build/test/short-unit-tests -fi - diff --git a/run/tests b/run/tests new file mode 100755 index 000000000..e1686a55c --- /dev/null +++ b/run/tests @@ -0,0 +1,11 @@ +#!/bin/bash + +export LD_LIBRARY_PATH=build/src/lib:$LD_LIBRARY_PATH +if [ "$1" == "--debug" ]; then + gdb --args build/test/unit-tests +elif [ "$1" == "--valgrind" ]; then + valgrind --tool="memcheck" --leak-check=full build/test/unit-tests +else + build/test/unit-tests +fi + diff --git a/test/film/log b/test/film/log deleted file mode 100644 index c88741037..000000000 --- a/test/film/log +++ /dev/null @@ -1,3 +0,0 @@ -Fri Feb 17 18:54:32 2012: Starting to make a DCP on shankly -Fri Feb 17 18:54:32 2012: Transcode job starting -Fri Feb 17 18:54:37 2012: Transcode job completed successfully diff --git a/test/film/metadata b/test/film/metadata deleted file mode 100644 index 6c5afd6c9..000000000 --- a/test/film/metadata +++ /dev/null @@ -1,18 +0,0 @@ -name -content -dcp_long_name -guess_dcp_long_name 0 -frames_per_second 0 -left_crop 0 -right_crop 0 -top_crop 0 -bottom_crop 0 -scaler bicubic -dcp_frames 0 -dcp_ab 0 -width 0 -height 0 -length 0 -audio_channels 0 -audio_sample_rate 0 -audio_sample_format Unknown diff --git a/test/long.cc b/test/long.cc deleted file mode 100644 index 6be1ef2ff..000000000 --- a/test/long.cc +++ /dev/null @@ -1,156 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include -#include -#include -#include -#include "format.h" -#include "film.h" -#include "filter.h" -#include "job_manager.h" -#include "util.h" -#include "exceptions.h" -#define BOOST_TEST_DYN_LINK -#define BOOST_TEST_MODULE dvdomatic_test -#include - -using namespace std; -using namespace boost; - -bool -compare (string ref, string test, list exclude) -{ - ifstream r (ref.c_str ()); - ifstream t (test.c_str ()); - - while (r.good ()) { - string rl; - getline (r, rl); - string tl; - getline (t, tl); - - bool ex = false; - for (list::iterator i = exclude.begin(); i != exclude.end(); ++i) { - if (rl.find (*i) != string::npos && tl.find (*i) != string::npos) { - ex = true; - } - } - - if (!ex && rl != tl) { - cerr << "Fail:\n" << rl << "\n" << tl << "\n"; - return true; - } - } - - return false; -} - - -BOOST_AUTO_TEST_CASE (make_dcp_test) -{ - dvdomatic_setup (); - - string const dcp_name = "FOO-BAR-BAZ"; - - string const ref_film = "test/film"; - string const ref_dcp = ref_film + "/" + dcp_name; - string const ref_pkl = ref_dcp + "/bdb4ae0a-0d09-4554-8557-0b4260f4c359_pkl.xml"; - string const ref_cpl = ref_dcp + "/08dd6e45-83b5-41dc-9179-d7c59f597a12_cpl.xml"; - string const test_film = "build/test/film"; - string const test_dcp = test_film + "/" + dcp_name; - - if (boost::filesystem::exists (test_film)) { - boost::filesystem::remove_all (test_film); - } - - Film f (test_film, false); - f.write_metadata (); - boost::filesystem::copy_file ("test/zombie.mpeg", "build/test/film/zombie.mpeg"); - f.set_content ("zombie.mpeg"); - f.set_dcp_content_type (DCPContentType::from_pretty_name ("Test")); - - BOOST_CHECK_EQUAL (f.audio_channels(), 2); - BOOST_CHECK_EQUAL (f.audio_sample_rate(), 48000); - BOOST_CHECK_EQUAL (audio_sample_format_to_string (f.audio_sample_format()), "S16"); - - f.set_format (Format::from_nickname ("Flat")); - - f.make_dcp (true, 5); - - while (JobManager::instance()->work_to_do ()) { - sleep (1); - } - - { - stringstream s; - s << "diff -ur test/film/j2c " << test_film << "/j2c"; - int const r = ::system (s.str().c_str ()); - BOOST_CHECK_EQUAL (r, 0); - } - - { - stringstream s; - s << "diff -ur test/film/wavs " << test_film << "/wavs"; - int const r = ::system (s.str().c_str ()); - BOOST_CHECK_EQUAL (r, 0); - } - - { - stringstream s; - s << "diff -u test/film/metadata " << test_film << "/metadata"; - int const r = ::system (s.str().c_str ()); - BOOST_CHECK_EQUAL (r, 0); - } - - /* Find the test pkl and cpl */ - string test_pkl; - string test_cpl; - - for (filesystem::directory_iterator i = filesystem::directory_iterator (test_dcp); i != filesystem::directory_iterator(); ++i) { -#if BOOST_FILESYSTEM_VERSION == 3 - string const t = filesystem::path(*i).generic_string (); -#else - string const t = i->string (); -#endif - if (algorithm::ends_with (t, "cpl.xml")) { - test_cpl = t; - } else if (algorithm::ends_with (t, "pkl.xml")) { - test_pkl = t; - } - } - - { - list exclude; - exclude.push_back ("urn:uuid"); - exclude.push_back ("urn:uri"); - exclude.push_back (""); - exclude.push_back (""); - exclude.push_back (""); - BOOST_CHECK_EQUAL (compare (ref_cpl, test_cpl, exclude), false); - } - - { - list exclude; - exclude.push_back ("urn:uuid"); - exclude.push_back (""); - exclude.push_back (""); - BOOST_CHECK_EQUAL (compare (ref_pkl, test_pkl, exclude), false); - } -} diff --git a/test/short.cc b/test/test.cc similarity index 100% rename from test/short.cc rename to test/test.cc diff --git a/test/wscript b/test/wscript index 2869cd52c..cd9abb6f6 100644 --- a/test/wscript +++ b/test/wscript @@ -7,17 +7,9 @@ def configure(conf): def build(bld): obj = bld(features = 'cxx cxxprogram') - obj.name = 'short-unit-tests' + obj.name = 'unit-tests' obj.uselib = 'BOOST_TEST' obj.use = 'libdvdomatic' - obj.source = 'short.cc' - obj.target = 'short-unit-tests' - obj.install_path = '' - - obj = bld(features = 'cxx cxxprogram') - obj.name = 'long-unit-tests' - obj.uselib = 'BOOST_TEST' - obj.use = 'libdvdomatic' - obj.source = 'long.cc' - obj.target = 'long-unit-tests' + obj.source = 'test.cc' + obj.target = 'unit-tests' obj.install_path = '' -- 2.30.2