Fill test disk partitions with random noise to expose more bugs.
[dcpomatic.git] / run / tests
1 #!/bin/bash
2 #
3 # e.g. --run_tests=foo
4
5 if [ "$(uname)" == "Linux" ]; then 
6   export LD_LIBRARY_PATH=build/src/lib:$LD_LIBRARY_PATH
7   rm -f build/test/dcpomatic2_openssl
8   # This must be our patched openssl or tests will fail
9   if [ ! -f build/test/dcpomatic2_openssl ]; then 
10     ln -s ../../../openssl/apps/openssl build/test/dcpomatic2_openssl
11   fi
12 fi
13
14 if [ "$(uname)" == "Darwin" ]; then
15   resources=build/Resources
16   rm -rf $resources
17   mkdir -p $resources
18   cp fonts/*.ttf $resources
19   cp -r ../libdcp/tags $resources
20   cp -r ../libdcp/xsd $resources
21   cp ../libdcp/ratings $resources
22   rm -f build/test/openssl
23   ln -s ../../../openssl/apps/openssl build/test/openssl
24   # SIP stops this being passed in from the caller's environment
25   export DYLD_LIBRARY_PATH=/Users/ci/osx-environment/x86_64/10.10/lib:/Users/ci/workspace/lib
26   # We need to find ffcmp in here
27   export PATH=$PATH:/Users/ci/workspace/bin
28 fi
29
30 if [ "$1" == "--debug" ]; then
31     shift;
32     gdb --args build/test/unit-tests --catch_system_errors=no --log_level=test_suite $*
33 elif [ "$1" == "--backtrace" ]; then
34     shift;
35     gdb -batch -ex "run" -ex "thread apply all bt" -return-child-result --args build/test/unit-tests --catch_system_errors=yes $*
36 elif [ "$1" == "--valgrind" ]; then
37     shift;
38 #    valgrind --tool="memcheck" --vgdb=yes --vgdb-error=0 build/test/unit-tests $*
39     valgrind --tool="memcheck" --suppressions=suppressions build/test/unit-tests $*
40 elif [ "$1" == "--callgrind" ]; then
41     shift;
42     valgrind --tool="callgrind" build/test/unit-tests $*
43 elif [ "$1" == "--quiet" ]; then
44     shift;
45     build/test/unit-tests --catch_system_errors=no $*
46 elif [ "$1" == "--drd" ]; then
47     shift;
48     valgrind --tool="drd" build/test/unit-tests $*
49 elif [ "$1" == "--helgrind" ]; then
50     shift;
51     valgrind --tool="helgrind" build/test/unit-tests $*
52 else
53     ulimit -c unlimited
54     build/test/unit-tests --catch_system_errors=no --log_level=test_suite $*
55 #    build/test/unit-tests --catch_system_errors=no $*
56 fi