Comment tweaks.
[libdcp.git] / run-tests.sh
1 #!/bin/bash
2
3 #
4 # Runs our test suite, which builds a DCP.
5 # The output is compared against the one
6 # in test/ref/DCP, and an error is given
7 # if anything is different.
8 #
9
10 if [ "$1" == "--debug" ]; then
11   shift
12   LD_LIBRARY_PATH=build/src:build/asdcplib/src gdb --args build/test/tests
13 else
14   LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/tests
15 fi
16 diff -ur test/ref/DCP build/test/foo
17 if [ "$?" != "0" ]; then
18   echo "FAIL: files differ"
19   exit 1
20 fi
21
22 rm -f build/test/info.log
23
24 if [ ! -e "../libdcp-test" ]; then
25   echo "Test corpus not found"
26   exit 1
27 fi
28
29 for d in `find ../libdcp-test -mindepth 1 -maxdepth 1 -type d`; do
30   if [ `basename $d` != ".git" ]; then
31     LD_LIBRARY_PATH=build/src:build/asdcplib/src build/tools/dcpinfo -s $d >> build/test/info.log
32     if [ "$?" != "0" ]; then
33       echo "FAIL: dcpinfo failed for $d"
34       exit 1
35     fi
36   fi
37 done
38
39 diff -q build/test/info.log ../libdcp-test/info.log
40 if [ "$?" != "0" ]; then
41   echo "FAIL: dcpinfo output incorrect"
42   exit 1
43 fi
44
45 rm -f build/test/info2.log
46 rm -rf build/test/libdcp-test
47
48 cp -r ../libdcp-test build/test
49 for d in `find build/test/libdcp-test -mindepth 1 -maxdepth 1 -type d`; do
50   if [ `basename $d` != ".git" ]; then
51     LD_LIBRARY_PATH=build/src:build/asdcplib/src build/test/rewrite_subs $d
52     LD_LIBRARY_PATH=build/src:build/asdcplib/src build/tools/dcpinfo -s $d >> build/test/info2.log
53   fi
54 done
55
56 sed -i "s/DCP: build\/test/DCP: \.\./g" build/test/info2.log
57
58 diff -q build/test/info2.log ../libdcp-test/info.log
59 if [ "$?" != "0" ]; then
60   echo "FAIL: dcpinfo output from rewrite incorrect"
61   exit 1
62 fi
63     
64 echo "PASS"