From d7d879c988d484cb1a5fd65831001f656605c34e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 26 Feb 2014 15:59:34 +0000 Subject: [PATCH] Add test for MXF-wrapped subtitles. --- run/tests | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/run/tests b/run/tests index 97512b59..1a028b67 100755 --- a/run/tests +++ b/run/tests @@ -7,16 +7,19 @@ # if anything is different. private=test/private +work=build/test + +export LD_LIBRARY_PATH=build/src:build/asdcplib/src # Run the unit tests in test/ if [ "$1" == "--debug" ]; then shift - LD_LIBRARY_PATH=build/src:build/asdcplib/src gdb --args build/test/tests + gdb --args $work/tests elif [ "$1" == "--valgrind" ]; then shift - LD_LIBRARY_PATH=build/src:build/asdcplib/src valgrind --tool="memcheck" build/test/tests + valgrind --tool="memcheck" $work/tests else - LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests $* + $work/tests $* fi if [ ! -e "test/private/info.log" ]; then @@ -24,24 +27,24 @@ if [ ! -e "test/private/info.log" ]; then fi # Check the first DCP written by the unit tests -diff -ur test/ref/DCP/foo build/test/DCP/foo +diff -ur test/ref/DCP/foo $work/DCP/foo if [ "$?" != "0" ]; then echo "FAIL: files differ" exit 1 fi # Check the second DCP written by the unit tests -diff -ur test/ref/DCP/bar build/test/DCP/bar +diff -ur test/ref/DCP/bar $work/DCP/bar if [ "$?" != "0" ]; then echo "FAIL: files differ" exit 1 fi -# Run dcpinfo on all the DCPs in private/metadata, writing build/test/info.log -rm -f build/test/info.log +# Run dcpinfo on all the DCPs in private/metadata, writing $work/info.log +rm -f $work/info.log for d in `find $private/metadata -mindepth 1 -maxdepth 1 -type d | sort`; do if [ `basename $d` != ".git" ]; then - LD_LIBRARY_PATH=build/src:build/asdcplib/src build/tools/dcpinfo -s $d >> build/test/info.log + build/tools/dcpinfo -s $d >> $work/info.log if [ "$?" != "0" ]; then echo "FAIL: dcpinfo failed for $d" exit 1 @@ -50,36 +53,40 @@ for d in `find $private/metadata -mindepth 1 -maxdepth 1 -type d | sort`; do done # Check info.log is what it should be -diff -q build/test/info.log $private/info.log +diff -q $work/info.log $private/info.log if [ "$?" != "0" ]; then echo "FAIL: dcpinfo output incorrect" exit 1 fi # Copy test/private into build/ then re-write the subtitles of every DCP using -# build/test/rewrite_subs. This tests round-trip of subtitle reading/writing. -rm -f build/test/info2.log -rm -rf build/test/private -cp -r $private build/test -for d in `find build/test/private/metadata -mindepth 1 -maxdepth 1 -type d | sort`; do +# $work/rewrite_subs. This tests round-trip of subtitle reading/writing. +rm -f $work/info2.log +rm -rf $work/private +cp -r $private $work +for d in `find $work/private/metadata -mindepth 1 -maxdepth 1 -type d | sort`; do if [ `basename $d` != ".git" ]; then - LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/rewrite_subs $d - LD_LIBRARY_PATH=build/src:build/asdcplib/src build/tools/dcpinfo -s $d >> build/test/info2.log + $work/rewrite_subs $d + build/tools/dcpinfo -s $d >> $work/info2.log fi done # Fudge the output -sed -i "s/DCP: build\/test/DCP: test/g" build/test/info2.log +sed -i "s/DCP: build\/test/DCP: test/g" $work/info2.log # And check it -diff -q build/test/info2.log $private/info.log +diff -q $work/info2.log $private/info.log if [ "$?" != "0" ]; then echo "FAIL: dcpinfo output from rewrite incorrect" exit 1 fi +# Dump the subs of JourneyToJah... (which has MXF-wrapped subtitles) +# and check that they are right +build/tools/dcpinfo -s $private/JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV >> $work/jah.log + # Check a MXF written by the unit tests -diff build/test/baz/video1.mxf build/test/baz/video2.mxf +diff $work/baz/video1.mxf $work/baz/video2.mxf if [ "$?" != "0" ]; then echo "FAIL: MXFs from recovery incorrect" exit 1 -- 2.30.2