5 # Private test data; this is stuff that is non-distributable
6 private=../libdcp-test-private
10 dcpinfo=build/tools/dcpinfo
11 dcpverify=build/tools/dcpverify
13 export LD_LIBRARY_PATH=build/src:$LD_LIBRARY_PATH
14 export LIBDCP_SHARE_PREFIX=.
16 # Make sure we have the required tools
17 for c in xmlsec1 xmldiff xmllint; do
18 hash $c 2>/dev/null || { echo >&2 "$c required but not found; aborting"; exit 1; }
23 # Run the unit tests in test/
24 if [ "$1" == "--debug" ]; then
26 gdb --args $work/tests $private $*
27 elif [ "$1" == "--valgrind" ]; then
29 valgrind --tool="memcheck" $work/tests $private $*
30 elif [ "$1" == "--callgrind" ]; then
32 valgrind --tool="callgrind" $work/tests $private $*
34 $work/tests $* -- $private
35 if [ "$?" != "0" ]; then
36 echo "FAIL: unit tests"
41 if [ "$*" != "" ]; then
42 echo "Skipping post-test checks as not all unit tests were run."
46 echo "--- Other tests"
48 # Check a MXF written by the unit tests
49 diff $work/baz/video1.mxf $work/baz/video2.mxf
50 if [ "$?" != "0" ]; then
51 echo "FAIL: MXFs from recovery incorrect"
55 # Check the DCP written by dcp_test1
56 diff -ur test/ref/DCP/dcp_test1 $work/DCP/dcp_test1
57 if [ "$?" != "0" ]; then
58 echo "FAIL: files differ"
62 # Check the DCP written by dcp_test2
63 diff -ur test/ref/DCP/dcp_test2 $work/DCP/dcp_test2
64 if [ "$?" != "0" ]; then
65 echo "FAIL: files differ"
69 # Check the DCP written by dcp_test5
70 diff -ur test/ref/DCP/dcp_test5 $work/DCP/dcp_test5
71 if [ "$?" != "0" ]; then
72 echo "FAIL: files differ"
76 # Check the DCP written by dcp_test7
77 diff -ur test/ref/DCP/dcp_test7 $work/DCP/dcp_test7
78 if [ "$?" != "0" ]; then
79 echo "FAIL: files differ"
83 # Check the DCP written by encryption_test
84 diff -ur test/ref/DCP/encryption_test $work/DCP/encryption_test
85 if [ "$?" != "0" ]; then
86 echo "FAIL: files differ"
90 # Everything beyond this point needs $private to exist
91 if [ ! -e "$private/info.log" ]; then
93 echo "Private data not found: some tests will not run."
97 # Run dcpinfo on all the DCPs in private/metadata, writing $work/info.log
98 # This writes details of the CPLs and all subtitle details, so it checks
99 # if the code is reading subtitle files correctly.
101 for d in `find $private/metadata -mindepth 1 -maxdepth 1 -type d | sort -f -d`; do
102 if [ `basename $d` != ".git" ]; then
103 $dcpinfo --ignore-missing-assets -s $d >> $work/info.log
104 if [ "$?" != "0" ]; then
105 echo "FAIL: dcpinfo failed for $d"
111 # Run dcpverify on all the DCPs in private/metadata
112 for d in `find $private/metadata -mindepth 1 -maxdepth 1 -type d | sort -f -d`; do
113 if [ `basename $d` != ".git" ]; then
114 $dcpverify --ignore-missing-assets -q $d
115 if [ "$?" != "0" ]; then
116 echo "FAIL: dcpverify failed for $d"
122 # Check info.log is what it should be
123 diff -q $work/info.log $private/info.log
124 if [ "$?" != "0" ]; then
125 echo "FAIL: dcpinfo output incorrect"
129 # Copy $private/metadata into build/metadata then re-write the subtitles
130 # of every DCP using $work/rewrite_subs. This tests round-trip of
131 # subtitle reading/writing.
132 rm -f $work/info2.log
135 cp -r $private/metadata $work/private/
136 for d in `find $work/private/metadata -mindepth 1 -maxdepth 1 -type d | sort -f -d`; do
137 if [ `basename $d` != ".git" ]; then
138 $work/rewrite_subs $d
139 $dcpinfo --ignore-missing-assets -s $d >> $work/info2.log
144 sed -i "s/DCP: build\/test/DCP: test/g" $work/info2.log
147 diff -q $work/info2.log $private/info2.log
148 if [ "$?" != "0" ]; then
149 echo "FAIL: dcpinfo output from rewrite incorrect"
153 # Dump the subs of JourneyToJah... (which has MXF-wrapped SMPTE subtitles)
154 # and check that they are right
155 $dcpinfo -s $private/data/JourneyToJah_TLR-1_F_EN-DE-FR_CH_51_2K_LOK_20140225_DGL_SMPTE_OV >> $work/jah.log
157 # Parse some problematic subs and check that we get it right
158 run/test/subs_in_out $private/TunaBoat_Icelandic_Reel1_V1_8sec.xml > $work/tuna.xml
159 diff -q $private/TunaBoat_Icelandic_Reel1_V1_8sec.parsed.xml $work/tuna.xml
160 if [ "$?" != "0" ]; then
161 echo "FAIL: output of parse check 1 invalid"