3 # Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
5 # Jansson is free software; you can redistribute it and/or modify
6 # it under the terms of the MIT license. See LICENSE for details.
8 VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
10 N=`find testprogs -type f -executable | wc -l`
12 echo "testprogs: $N tests"
17 if [ -n "$VALGRIND" ]; then
18 runner="$VALGRIND_CMDLINE "
23 for prog in testprogs/*; do
24 [ -x $prog ] || continue
26 logbase="testlogs/api/`printf '%02d-%s' $i $t`"
27 if ! $runner./$prog >$logbase.stdout 2>$logbase.stderr; then
29 echo "### $prog failed:" >&2
33 if [ -n "$VALGRIND" ]; then
34 # Check for Valgrind error output. The valgrind option
35 # --error-exitcode is not enough because Valgrind doesn't
36 # think unfreed allocs are errors.
37 if grep -E -q '^==[0-9]+== ' $logbase.stderr; then
38 echo "### $prog failed:" >&2
39 echo "valgrind detected an error" >&2
40 echo "for details, see test/$logbase.stderr" >&2