1*8e33eff8Schristos#!/bin/sh 2*8e33eff8Schristos 3*8e33eff8Schristoscase @abi@ in 4*8e33eff8Schristos macho) 5*8e33eff8Schristos export DYLD_FALLBACK_LIBRARY_PATH="@objroot@lib" 6*8e33eff8Schristos ;; 7*8e33eff8Schristos pecoff) 8*8e33eff8Schristos export PATH="${PATH}:@objroot@lib" 9*8e33eff8Schristos ;; 10*8e33eff8Schristos *) 11*8e33eff8Schristos ;; 12*8e33eff8Schristosesac 13*8e33eff8Schristos 14*8e33eff8Schristos# Make a copy of the @JEMALLOC_CPREFIX@MALLOC_CONF passed in to this script, so 15*8e33eff8Schristos# it can be repeatedly concatenated with per test settings. 16*8e33eff8Schristosexport MALLOC_CONF_ALL=${@JEMALLOC_CPREFIX@MALLOC_CONF} 17*8e33eff8Schristos# Concatenate the individual test's MALLOC_CONF and MALLOC_CONF_ALL. 18*8e33eff8Schristosexport_malloc_conf() { 19*8e33eff8Schristos if [ "x${MALLOC_CONF}" != "x" -a "x${MALLOC_CONF_ALL}" != "x" ] ; then 20*8e33eff8Schristos export @JEMALLOC_CPREFIX@MALLOC_CONF="${MALLOC_CONF},${MALLOC_CONF_ALL}" 21*8e33eff8Schristos else 22*8e33eff8Schristos export @JEMALLOC_CPREFIX@MALLOC_CONF="${MALLOC_CONF}${MALLOC_CONF_ALL}" 23*8e33eff8Schristos fi 24*8e33eff8Schristos} 25*8e33eff8Schristos 26*8e33eff8Schristos# Corresponds to test_status_t. 27*8e33eff8Schristospass_code=0 28*8e33eff8Schristosskip_code=1 29*8e33eff8Schristosfail_code=2 30*8e33eff8Schristos 31*8e33eff8Schristospass_count=0 32*8e33eff8Schristosskip_count=0 33*8e33eff8Schristosfail_count=0 34*8e33eff8Schristosfor t in $@; do 35*8e33eff8Schristos if [ $pass_count -ne 0 -o $skip_count -ne 0 -o $fail_count != 0 ] ; then 36*8e33eff8Schristos echo 37*8e33eff8Schristos fi 38*8e33eff8Schristos echo "=== ${t} ===" 39*8e33eff8Schristos if [ -e "@srcroot@${t}.sh" ] ; then 40*8e33eff8Schristos # Source the shell script corresponding to the test in a subshell and 41*8e33eff8Schristos # execute the test. This allows the shell script to set MALLOC_CONF, which 42*8e33eff8Schristos # is then used to set @JEMALLOC_CPREFIX@MALLOC_CONF (thus allowing the 43*8e33eff8Schristos # per test shell script to ignore the @JEMALLOC_CPREFIX@ detail). 44*8e33eff8Schristos enable_fill=@enable_fill@ \ 45*8e33eff8Schristos enable_prof=@enable_prof@ \ 46*8e33eff8Schristos . @srcroot@${t}.sh && \ 47*8e33eff8Schristos export_malloc_conf && \ 48*8e33eff8Schristos $JEMALLOC_TEST_PREFIX ${t}@exe@ @abs_srcroot@ @abs_objroot@ 49*8e33eff8Schristos else 50*8e33eff8Schristos export MALLOC_CONF= && \ 51*8e33eff8Schristos export_malloc_conf && \ 52*8e33eff8Schristos $JEMALLOC_TEST_PREFIX ${t}@exe@ @abs_srcroot@ @abs_objroot@ 53*8e33eff8Schristos fi 54*8e33eff8Schristos result_code=$? 55*8e33eff8Schristos case ${result_code} in 56*8e33eff8Schristos ${pass_code}) 57*8e33eff8Schristos pass_count=$((pass_count+1)) 58*8e33eff8Schristos ;; 59*8e33eff8Schristos ${skip_code}) 60*8e33eff8Schristos skip_count=$((skip_count+1)) 61*8e33eff8Schristos ;; 62*8e33eff8Schristos ${fail_code}) 63*8e33eff8Schristos fail_count=$((fail_count+1)) 64*8e33eff8Schristos ;; 65*8e33eff8Schristos *) 66*8e33eff8Schristos echo "Test harness error: ${t} w/ MALLOC_CONF=\"${MALLOC_CONF}\"" 1>&2 67*8e33eff8Schristos echo "Use prefix to debug, e.g. JEMALLOC_TEST_PREFIX=\"gdb --args\" sh test/test.sh ${t}" 1>&2 68*8e33eff8Schristos exit 1 69*8e33eff8Schristos esac 70*8e33eff8Schristosdone 71*8e33eff8Schristos 72*8e33eff8Schristostotal_count=`expr ${pass_count} + ${skip_count} + ${fail_count}` 73*8e33eff8Schristosecho 74*8e33eff8Schristosecho "Test suite summary: pass: ${pass_count}/${total_count}, skip: ${skip_count}/${total_count}, fail: ${fail_count}/${total_count}" 75*8e33eff8Schristos 76*8e33eff8Schristosif [ ${fail_count} -eq 0 ] ; then 77*8e33eff8Schristos exit 0 78*8e33eff8Schristoselse 79*8e33eff8Schristos exit 1 80*8e33eff8Schristosfi 81