summaryrefslogtreecommitdiff
path: root/run-tests.sh
blob: 7ed965cfdff79e46ea265bbd4f82ff5dffb0f7e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash

#
# Runs our test suite, which builds a DCP.
# The output is compared against the one
# in test/ref/DCP, and an error is given
# if anything is different.
#

if [ "$1" == "--debug" ]; then
  shift
  LD_LIBRARY_PATH=build/src:build/asdcplib/src gdb --args build/test/tests
elif [ "$1" == "--valgrind" ]; then
  shift
  LD_LIBRARY_PATH=build/src:build/asdcplib/src valgrind --tool="memcheck" build/test/tests
else
  LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests
fi
diff -ur test/ref/DCP build/test/foo
if [ "$?" != "0" ]; then
  echo "FAIL: files differ"
  exit 1
fi

rm -f build/test/info.log

if [ ! -e "../libdcp-test" ]; then
  echo "Test corpus not found"
  exit 1
fi

for d in `find ../libdcp-test -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
    if [ "$?" != "0" ]; then
      echo "FAIL: dcpinfo failed for $d"
      exit 1
    fi
  fi
done

diff -q build/test/info.log ../libdcp-test/info.log
if [ "$?" != "0" ]; then
  echo "FAIL: dcpinfo output incorrect"
  exit 1
fi

rm -f build/test/info2.log
rm -rf build/test/libdcp-test

cp -r ../libdcp-test build/test
for d in `find build/test/libdcp-test -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
  fi
done

sed -i "s/DCP: build\/test/DCP: \.\./g" build/test/info2.log

diff -q build/test/info2.log ../libdcp-test/info.log
if [ "$?" != "0" ]; then
  echo "FAIL: dcpinfo output from rewrite incorrect"
  exit 1
fi

diff build/test/baz/video1.mxf build/test/baz/video2.mxf
if [ "$?" != "0" ]; then
  echo "FAIL: MXFs from recovery incorrect"
  exit 1
fi
    
echo "PASS"