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