Source

micropython / runtests_valgrind.bash

Full commit
#!/usr/bin/env bash

cleanup() {
    rm -f $TMPFILE
}

trap "cleanup; exit" EXIT

TMPFILE=`mktemp -t` || exit 1
LOGFILE=valgrind_results-`date +%Y%m%d-%H.%M`
test() {
    i=$1
    make ${i%.py}.bytecode
    echo valgrind -v --leak-check=full --track-origins=yes ./interp_valgrind ${i%.py}.bytecode
    time valgrind -v --leak-check=full --track-origins=yes ./interp_valgrind ${i%.py}.bytecode 2>&1 > $TMPFILE | tee -a $LOGFILE 
    echo $?
    # XXX: this code is from runtests.bash. If you want to enable this, you
    # should first disable VERB_DEBUG when compiling interp_valgrind, since that
    # messes up the output.
    #if ! cat $TMPFILE | grep "Return value: 127"; then
	#cat $TMPFILE | grep "Return value" 
	#echo -e "============================================"
	#echo -e "============================================"
	#echo -e "=== Error in $i." 
	#echo -e "============================================"
	#echo -e "============================================\n\n"
    #fi
    grep "ERROR" $LOGFILE
}

make interp_valgrind

for i in test/test*.py; do
    case $i in
	test/test_factorial_bench_short.py|test/test_list_bench_short.py|test/test_while.py|test/test_gc.py|test/test_gc2.py|test/test_gc3.py)
	;;
	test/testAdv.py)
	;;
	*)
	    test $i
	;;
    esac
done
# Test it at the end.
test test/test_gc.py
# It's useless to test this.
#test test/test_while.py

# These are too long, just test the short version

# Short version: test_factorial.py 
# test/test_factorial_bench_short.py

# Short version: test/test_list_really_short.py
# test/test_list_bench_short.py

#for i in bench/test*.py; do
#    test $i
#done

cleanup
# vim: set sw=4: