blob: 44ff3b3f97846a95b5b070690fec0db89f0b2900 [file] [log] [blame]
Stefan Krah1919b7e2012-03-21 18:25:23 +01001#!/bin/sh
2
3#
4# Purpose: test with and without threads, all machine configurations, pydebug,
5# refleaks, release build and release build with valgrind.
6#
7# Synopsis: ./runall-memorydebugger.sh [--all-configs64 | --all-configs32]
8#
9# Requirements: valgrind
10#
11
12# Set additional CFLAGS for ./configure
13ADD_CFLAGS=
14
15
16CONFIGS_64="x64 uint128 ansi64 universal"
17CONFIGS_32="ppro ansi32 ansi-legacy universal"
18
19VALGRIND="valgrind --tool=memcheck --leak-resolution=high \
20 --db-attach=yes --suppressions=Misc/valgrind-python.supp"
21
22# Get args
23case $@ in
24 *--all-configs64*)
25 CONFIGS=$CONFIGS_64
26 ;;
27 *--all-configs32*)
28 CONFIGS=$CONFIGS_32
29 ;;
30 *)
31 CONFIGS="auto"
32 ;;
33esac
34
35# gmake required
36GMAKE=`which gmake`
37if [ X"$GMAKE" = X"" ]; then
38 GMAKE=make
39fi
40
41# Pretty print configurations
42print_config ()
43{
44 len=`echo $@ | wc -c`
45 margin="#%"`expr \( 74 - $len \) / 2`"s"
46
47 echo ""
48 echo "# ========================================================================"
49 printf $margin ""
50 echo $@
51 echo "# ========================================================================"
52 echo ""
53}
54
55
56cd ..
57
58# test_decimal: refleak, regular and Valgrind tests
59for args in "--without-threads" ""; do
60 for config in $CONFIGS; do
61
62 unset PYTHON_DECIMAL_WITH_MACHINE
63 libmpdec_config=$config
64 if [ X"$config" != X"auto" ]; then
65 PYTHON_DECIMAL_WITH_MACHINE=$config
66 export PYTHON_DECIMAL_WITH_MACHINE
67 else
68 libmpdec_config=""
69 fi
70
71 ############ refleak tests ###########
72 print_config "refleak tests: config=$config" $args
73 printf "\nbuilding python ...\n\n"
74
75 cd ../../
76 $GMAKE distclean > /dev/null 2>&1
77 ./configure CFLAGS="$ADD_CFLAGS" --with-pydebug $args > /dev/null 2>&1
78 $GMAKE | grep _decimal
79
80 printf "\n\n# ======================== refleak tests ===========================\n\n"
81 ./python -m test -uall -R 2:2 test_decimal
82
83
84 ############ regular tests ###########
85 print_config "regular tests: config=$config" $args
86 printf "\nbuilding python ...\n\n"
87
88 $GMAKE distclean > /dev/null 2>&1
89 ./configure CFLAGS="$ADD_CFLAGS" $args > /dev/null 2>&1
90 $GMAKE | grep _decimal
91
92 printf "\n\n# ======================== regular tests ===========================\n\n"
93 ./python -m test -uall test_decimal
94
95
96 ########### valgrind tests ###########
97 valgrind=$VALGRIND
98 case "$config" in
99 # Valgrind has no support for 80 bit long double arithmetic.
100 ppro) valgrind= ;;
101 auto) case `uname -m` in
102 i386|i486|i586|i686) valgrind= ;;
103 esac
104 esac
105
106 print_config "valgrind tests: config=$config" $args
107 printf "\nbuilding python ...\n\n"
108 $GMAKE distclean > /dev/null 2>&1
109 ./configure CFLAGS="$ADD_CFLAGS" --without-pymalloc $args > /dev/null 2>&1
110 $GMAKE | grep _decimal
111
112 printf "\n\n# ======================== valgrind tests ===========================\n\n"
113 $valgrind ./python -m test -uall test_decimal
114
115 cd Modules/_decimal
116 done
117done
118
119# deccheck
120cd ../../
121for config in $CONFIGS; do
122 for args in "--without-threads" ""; do
123
124 unset PYTHON_DECIMAL_WITH_MACHINE
125 if [ X"$config" != X"auto" ]; then
126 PYTHON_DECIMAL_WITH_MACHINE=$config
127 export PYTHON_DECIMAL_WITH_MACHINE
128 fi
129
130 ############ debug ############
131 print_config "deccheck: config=$config --with-pydebug" $args
132 printf "\nbuilding python ...\n\n"
133
134 $GMAKE distclean > /dev/null 2>&1
135 ./configure CFLAGS="$ADD_CFLAGS" --with-pydebug $args > /dev/null 2>&1
136 $GMAKE | grep _decimal
137
138 printf "\n\n# ========================== debug ===========================\n\n"
139 ./python Modules/_decimal/tests/deccheck.py
140
141 ########### regular ###########
142 print_config "deccheck: config=$config " $args
143 printf "\nbuilding python ...\n\n"
144
145 $GMAKE distclean > /dev/null 2>&1
146 ./configure CFLAGS="$ADD_CFLAGS" $args > /dev/null 2>&1
147 $GMAKE | grep _decimal
148
149 printf "\n\n# ======================== regular ===========================\n\n"
150 ./python Modules/_decimal/tests/deccheck.py
151
152 ########### valgrind ###########
153 valgrind=$VALGRIND
154 case "$config" in
155 # Valgrind has no support for 80 bit long double arithmetic.
156 ppro) valgrind= ;;
157 auto) case `uname -m` in
158 i386|i486|i586|i686) valgrind= ;;
159 esac
160 esac
161
162 print_config "valgrind deccheck: config=$config " $args
163 printf "\nbuilding python ...\n\n"
164
165 $GMAKE distclean > /dev/null 2>&1
166 ./configure CFLAGS="$ADD_CFLAGS" --without-pymalloc $args > /dev/null 2>&1
167 $GMAKE | grep _decimal
168
169 printf "\n\n# ======================== valgrind ==========================\n\n"
170 $valgrind ./python Modules/_decimal/tests/deccheck.py
171 done
172done
173
174
175