Check that the private test data repo is as we expect before running tests on Linux...
[dcpomatic.git] / run / tests
1 #!/bin/bash
2 #
3 # e.g. --run_tests=foo
4 set -e
5
6 PRIVATE_GIT="a462680c7c6df8a84f9ee0bb7b4fb90055b96ca8"
7
8 if [ "$(uname)" == "Linux" ]; then 
9   export LD_LIBRARY_PATH=build/src/lib:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
10   rm -f build/test/dcpomatic2_openssl
11   # This must be our patched openssl or tests will fail
12   if [ ! -f build/test/dcpomatic2_openssl ]; then 
13     ln -s ../../../openssl/apps/openssl build/test/dcpomatic2_openssl
14   fi
15 fi
16
17 if [ "$(uname)" == "Darwin" ]; then
18   resources=build/Resources
19   rm -rf $resources
20   mkdir -p $resources
21   cp fonts/*.ttf $resources
22   cp -r ../libdcp/tags $resources
23   cp -r ../libdcp/xsd $resources
24   cp ../libdcp/ratings $resources
25   rm -f build/test/openssl
26   ln -s ../../../openssl/apps/openssl build/test/openssl
27   # SIP stops this being passed in from the caller's environment
28   export DYLD_LIBRARY_PATH=/Users/ci/osx-environment/x86_64/10.10/lib:/Users/ci/workspace/lib
29   # We need to find ffcmp in here
30   export PATH=$PATH:/Users/ci/workspace/bin
31 fi
32
33 pushd ../dcpomatic-test-private
34 current=$(git rev-parse HEAD)
35 if [ "$current" != "$PRIVATE_GIT" ]; then
36         echo "Unexpected dcpomatic-test-private version"
37         exit 1
38 fi
39 ./check_sums || (echo "dcpomatic-test-private checksums are incorrect"; exit 1)
40 popd
41
42 if [ "$1" == "--debug" ]; then
43     shift;
44     gdb --args build/test/unit-tests --catch_system_errors=no --log_level=test_suite $*
45 elif [ "$1" == "--backtrace" ]; then
46     shift;
47     gdb -batch -ex "run" -ex "thread apply all bt" -return-child-result --args build/test/unit-tests --catch_system_errors=yes $*
48 elif [ "$1" == "--valgrind" ]; then
49     shift;
50 #    valgrind --tool="memcheck" --vgdb=yes --vgdb-error=0 build/test/unit-tests $*
51     valgrind --tool="memcheck" --suppressions=suppressions build/test/unit-tests $*
52 elif [ "$1" == "--callgrind" ]; then
53     shift;
54     valgrind --tool="callgrind" build/test/unit-tests $*
55 elif [ "$1" == "--quiet" ]; then
56     shift;
57     build/test/unit-tests --catch_system_errors=no $*
58 elif [ "$1" == "--drd" ]; then
59     shift;
60     valgrind --tool="drd" build/test/unit-tests $*
61 elif [ "$1" == "--helgrind" ]; then
62     shift;
63     valgrind --tool="helgrind" build/test/unit-tests $*
64 else
65     ulimit -c unlimited
66     build/test/unit-tests --catch_system_errors=no $*
67 fi