+ if [ -n "$VALGRIND" ]; then
+ # Check for Valgrind error output. The valgrind option
+ # --error-exitcode is not enough because Valgrind doesn't
+ # think unfreed allocs are errors.
+ if grep -E -q '^==[0-9]+== ' $prefix.$prog.stderr; then
+ echo "### $prefix ($prog) failed:" >&2
+ echo "valgrind detected an error" >&2
+ echo "for details, see test/$prefix.$prog.stderr" >&2
+ exit 1
+ fi
+ fi
+}