#! @BASH_SHELL@ # --------------------------------------------------------------------- # # # Script to run some examples through VALGRIND. # # Michael Hagemann # # modified by Lorenzo Bettini # # this requires bash extensions # # --------------------------------------------------------------------- # # Hack to run valgrind with new glibcs. Problem: new TLS (thread # local storage) #VG_ENV="LD_ASSUME_KERNEL=2.2.5" # --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes --suppressions=./suppressions.supp # --num-callers=20 --leak-resolution=high --suppressions=/home/bettini/work/src2tags/tests/suppressions.supp VG_PRG="@VALGRIND@" VG_ARGS="--tool=memcheck --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes --suppressions=@srcdir@/suppressions.supp" #VG_ARGS="--tool=memcheck --num-callers=20 --leak-check=yes --leak-resolution=high --suppressions=@srcdir@/suppressions.supp" VGRIND="${VG_ENV} ${VG_PRG} ${VG_ARGS}" if test ! -x "${VG_PRG}"; then echo Valgrind not found! Check path. exit 1 fi # --------------------------------------------------------------------- # DATE=`date +"%Y-%m-%d_%H%M"` SUMMARY=valgrind_summary.log TMP_LOG=valgrind_tmp.log ERROR=0 # --------------------------------------------------------------------- # vgrind () { if test ! -x "1ドル" -o "1ドル" == `basename 0ドル`; then echo "Skipping 1ドル." return fi echo -n "Running $* ..." tmp_err= if [[ 1ドル == *.sh ]]; then # echo "1ドル ${VGRIND}>${TMP_LOG} 2>&1 ..." eval 1ドル ${VGRIND}>${TMP_LOG} 2>&1; else # echo "${VGRIND} $*>${TMP_LOG} 2>&1 ..." eval ${VGRIND} $*>${TMP_LOG} 2>&1 fi; #grep -e "LEAK SUMMARY" ${TMP_LOG}>/dev/null 2>&1 grep -E "(reachable|lost): [1-9][0-9]*" ${TMP_LOG}>/dev/null 2>&1 if test "$?" == "0"; then echo -n " LEAKS!" echo "">> ${SUMMARY} echo "** $*, LEAKS">> ${SUMMARY} cat ${TMP_LOG}>> ${SUMMARY} tmp_err=1 fi grep -e "[1-9][0-9]* error" ${TMP_LOG}>/dev/null 2>&1 if test "$?" == "0"; then echo -n " ERRORS!" echo "">> ${SUMMARY} echo "** $*, ERRORS">> ${SUMMARY} cat ${TMP_LOG}>> ${SUMMARY} tmp_err=1 fi if test "x${tmp_err}" == "x"; then echo " OK." else ERROR=1 echo "" fi rm -f ${TMP_LOG} } # --------------------------------------------------------------------- # echo "Run at ${DATE}">${SUMMARY} vgrind $* # --------------------------------------------------------------------- # # cat ${SUMMARY} exit ${ERROR}

AltStyle によって変換されたページ (->オリジナル) /