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