Bump libsub for SSA Margin{L,R} support (#2811).
[dcpomatic.git] / run / tests
1 #!/bin/bash
2 #
3 # e.g. --run_tests=foo
4 set -e
5
6 PRIVATE_GIT="881c48805e352dfe150993814757ca974282be18"
7
8 type=""
9 check=0
10 while [[ $# -gt 0 ]]; do
11     case $1 in
12         -e)
13         environment=$2
14         shift
15         shift
16         ;;
17         --debug)
18         type="debug"
19         shift
20         ;;
21         --backtrace)
22         type="backtrace"
23         shift
24         ;;
25         --valgrind)
26         type="valgrind"
27         shift
28         ;;
29         --callgrind)
30         type="callgrind"
31         shift
32         ;;
33         --quiet)
34         type="quiet"
35         shift
36         ;;
37         --drd)
38         type="drd"
39         shift
40         ;;
41         --helgrind)
42         type="helgrind"
43         shift
44         ;;
45         --check)
46         check=1
47         shift
48         ;;
49         *)
50         break
51         ;;
52     esac
53 done
54
55 if [ "$(uname)" == "Linux" ]; then 
56   export LD_LIBRARY_PATH=build/src/lib:../../lib:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
57   rm -f build/test/dcpomatic2_openssl
58   # This must be our patched openssl or tests will fail
59   if [ ! -f build/test/dcpomatic2_openssl ]; then 
60     ln -s ../../../openssl/apps/openssl build/test/dcpomatic2_openssl
61   fi
62   export DCPOMATIC_TEST_TOOLS_PATH=/opt/asdcplib/bin
63   if [ -f /src/backports/dcp_inspect ]; then
64     export DCPOMATIC_DCP_INSPECT=/src/backports/dcp_inspect
65   fi
66   set +e
67   python3 -m clairmeta.cli --help > /dev/null 2>&1
68   if [ "$?" == "0" ]; then
69     export DCPOMATIC_CLAIRMETA=1
70   fi
71   set -e
72 fi
73
74 if [ "$(uname)" == "Darwin" ]; then
75   resources=build/Resources
76   rm -rf $resources
77   mkdir -p $resources
78   cp fonts/*.ttf $resources
79   cp -r ../libdcp/tags $resources
80   cp -r ../libdcp/xsd $resources
81   cp ../libdcp/ratings $resources
82   rm -f build/test/openssl
83   ln -s ../../../openssl/apps/openssl build/test/openssl
84   # SIP stops this being passed in from the caller's environment
85   export DYLD_LIBRARY_PATH=$environment/x86_64/10.10/lib:$HOME/workspace/lib
86   # We need to find ffcmp in here
87   export PATH=$PATH:$HOME/workspace/bin
88 fi
89
90 if [ "$check" == "1" ]; then
91         if [ "$DCPOMATIC_TEST_PRIVATE" == "" ]; then
92                 pushd ../dcpomatic-test-private
93         else
94                 pushd $DCPOMATIC_TEST_PRIVATE
95         fi
96         current=$(git rev-parse HEAD)
97         if [ "$current" != "$PRIVATE_GIT" ]; then
98                 echo "Unexpected dcpomatic-test-private version"
99                 exit 1
100         fi
101         popd
102 fi
103
104 if [ "$type" == "debug" ]; then
105     gdb --args build/test/unit-tests --catch_system_errors=no --log_level=test_suite $*
106 elif [ "$type" == "backtrace" ]; then
107     gdb -batch -ex "run" -ex "thread apply all bt" -return-child-result --args build/test/unit-tests --catch_system_errors=yes $*
108 elif [ "$type" == "valgrind" ]; then
109 #    valgrind --tool="memcheck" --vgdb=yes --vgdb-error=0 build/test/unit-tests $*
110     valgrind --tool="memcheck" --suppressions=suppressions build/test/unit-tests $*
111 elif [ "$type" == "callgrind" ]; then
112     valgrind --tool="callgrind" build/test/unit-tests $*
113 elif [ "$type" == "quiet" ]; then
114     build/test/unit-tests --catch_system_errors=no $*
115 elif [ "$type" == "drd" ]; then
116     valgrind --tool="drd" build/test/unit-tests $*
117 elif [ "$type" == "helgrind" ]; then
118     valgrind --tool="helgrind" build/test/unit-tests $*
119 else
120     ulimit -c unlimited
121     build/test/unit-tests --catch_system_errors=no $*
122 fi