• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3SYSTEM=`uname -s`
4case $SYSTEM in
5    darwin*|Darwin*)
6        # malloc() on OS X does not conform to the C standard.
7        export MallocLogFile=/dev/null
8        export MallocDebugReport=crash
9        ;;
10    *)
11        ;;
12esac
13
14
15# Download or copy the official test cases (text files).
16./gettests.sh || exit 1
17
18if [ ! -f ./runtest -a ! -f ./runtest_shared ]; then
19    printf "\nERROR: ./runtest and ./runtest_shared not found\n\n\n"; exit 1;
20fi
21
22if [ -f ./runtest ]; then
23    printf "\n# ========================================================================\n"
24    printf "#                        libmpdec++: static library\n"
25    printf "# ========================================================================\n\n"
26
27    printf "Running official tests with allocation failures ...\n\n"
28    ./runtest official.topTest --thread --alloc || { printf "\nFAIL\n\n\n"; exit 1; }
29
30
31    printf "Running additional tests with allocation failures ...\n\n"
32    ./runtest additional.topTest --thread --alloc || { printf "\nFAIL\n\n\n"; exit 1; }
33
34    printf "Running API tests (single thread) ... \n\n"
35    ./apitest || { printf "\nFAIL\n\n\n"; exit 1; }
36
37    printf "Running API tests (threaded) ... \n\n"
38    ./apitest --thread || { printf "\nFAIL\n\n\n"; exit 1; }
39fi
40
41if [ -f ./runtest_shared ]; then
42    printf "\n# ========================================================================\n"
43    printf "#                        libmpdec++: shared library\n"
44    printf "# ========================================================================\n\n"
45
46    PORTABLE_PWD=`pwd`
47    LD_LIBRARY_PATH="$PORTABLE_PWD/../libmpdec:$PORTABLE_PWD/../libmpdec++:$LD_LIBRARY_PATH"
48    DYLD_LIBRARY_PATH="$PORTABLE_PWD/../libmpdec:$PORTABLE_PWD/../libmpdec++:$DYLD_LIBRARY_PATH"
49    LD_64_LIBRARY_PATH="$PORTABLE_PWD/../libmpdec:$PORTABLE_PWD/../libmpdec++:$LD_64_LIBRARY_PATH"
50    LD_32_LIBRARY_PATH="$PORTABLE_PWD/../libmpdec:$PORTABLE_PWD/../libmpdec++:$LD_32_LIBRARY_PATH"
51    LD_LIBRARY_PATH_64="$PORTABLE_PWD/../libmpdec:$PORTABLE_PWD/../libmpdec++:$LD_LIBRARY_PATH_64"
52    LD_LIBRARY_PATH_32="$PORTABLE_PWD/../libmpdec:$PORTABLE_PWD/../libmpdec++:$LD_LIBRARY_PATH_32"
53    PATH="$LD_LIBRARY_PATH:$PATH"
54    export LD_LIBRARY_PATH
55    export DYLD_LIBRARY_PATH
56    export LD_64_LIBRARY_PATH
57    export LD_32_LIBRARY_PATH
58    export LD_LIBRARY_PATH_64
59    export LD_LIBRARY_PATH_32
60
61    printf "Running official tests with allocation failures ...\n\n"
62    ./runtest_shared official.topTest --thread --alloc || { printf "\nFAIL\n\n\n"; exit 1; }
63
64    printf "Running additional tests with allocation failures ...\n\n"
65    ./runtest_shared additional.topTest --thread --alloc || { printf "\nFAIL\n\n\n"; exit 1; }
66
67    printf "Running API tests (single thread) ... \n\n"
68    ./apitest_shared || { printf "\nFAIL\n\n\n"; exit 1; }
69
70    printf "Running API tests (threaded) ... \n\n"
71    ./apitest_shared --thread || { printf "\nFAIL\n\n\n"; exit 1; }
72fi
73