1 #!/bin/sh 2 3 case elf in 4 macho) 5 export DYLD_FALLBACK_LIBRARY_PATH="lib" 6 ;; 7 pecoff) 8 export PATH="${PATH}:lib" 9 ;; 10 *) 11 ;; 12 esac 13 14 # Make a copy of the MALLOC_CONF passed in to this script, so 15 # it can be repeatedly concatenated with per test settings. 16 export MALLOC_CONF_ALL=${MALLOC_CONF} 17 # Concatenate the individual test's MALLOC_CONF and MALLOC_CONF_ALL. 18 export_malloc_conf() { 19 if [ "x${MALLOC_CONF}" != "x" -a "x${MALLOC_CONF_ALL}" != "x" ] ; then 20 export MALLOC_CONF="${MALLOC_CONF},${MALLOC_CONF_ALL}" 21 else 22 export MALLOC_CONF="${MALLOC_CONF}${MALLOC_CONF_ALL}" 23 fi 24 } 25 26 # Corresponds to test_status_t. 27 pass_code=0 28 skip_code=1 29 fail_code=2 30 31 pass_count=0 32 skip_count=0 33 fail_count=0 34 for t in $@; do 35 if [ $pass_count -ne 0 -o $skip_count -ne 0 -o $fail_count != 0 ] ; then 36 echo 37 fi 38 echo "=== ${t} ===" 39 if [ -e "${t}.sh" ] ; then 40 # Source the shell script corresponding to the test in a subshell and 41 # execute the test. This allows the shell script to set MALLOC_CONF, which 42 # is then used to set MALLOC_CONF (thus allowing the 43 # per test shell script to ignore the detail). 44 enable_fill=1 \ 45 enable_prof=0 \ 46 disable_large_size_classes=@disable_large_size_classes@ \ 47 . ${t}.sh && \ 48 export_malloc_conf && \ 49 $JEMALLOC_TEST_PREFIX ${t} /home/gdai/gdai-jemalloc/jemalloc-5.3.1/ /home/gdai/gdai-jemalloc/jemalloc-5.3.1/ 50 else 51 export MALLOC_CONF= && \ 52 export_malloc_conf && \ 53 $JEMALLOC_TEST_PREFIX ${t} /home/gdai/gdai-jemalloc/jemalloc-5.3.1/ /home/gdai/gdai-jemalloc/jemalloc-5.3.1/ 54 fi 55 result_code=$? 56 case ${result_code} in 57 ${pass_code}) 58 pass_count=$((pass_count+1)) 59 ;; 60 ${skip_code}) 61 skip_count=$((skip_count+1)) 62 ;; 63 ${fail_code}) 64 fail_count=$((fail_count+1)) 65 ;; 66 *) 67 color_start='' 68 color_end='' 69 if [ -t 2 ] && tput colors >/dev/null 2>&1; then 70 color_start='\033[31m' 71 color_end='\033[0m' 72 fi 73 printf "${color_start}Test harness error: %s w/ MALLOC_CONF=\"%s\"${color_end}\n" "${t}" "${MALLOC_CONF}" 1>&2 74 printf "${color_start}Use prefix to debug, e.g. JEMALLOC_TEST_PREFIX=\"gdb --args\" sh test/test.sh %s${color_end}\n" "${t}" 1>&2 75 exit 1 76 esac 77 done 78 79 total_count=`expr ${pass_count} + ${skip_count} + ${fail_count}` 80 echo 81 echo "Test suite summary: pass: ${pass_count}/${total_count}, skip: ${skip_count}/${total_count}, fail: ${fail_count}/${total_count}" 82 83 if [ ${fail_count} -eq 0 ] ; then 84 exit 0 85 else 86 exit 1 87 fi 88