2009-07-28 16:01:52 +08:00
|
|
|
# Copyright (c) 2009 Petri Lehtinen <petri@digip.org>
|
|
|
|
#
|
|
|
|
# Jansson is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the MIT license. See LICENSE for details.
|
|
|
|
|
2009-07-27 03:44:11 +08:00
|
|
|
VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
|
2009-07-10 02:01:40 +08:00
|
|
|
|
|
|
|
run_testprog() {
|
|
|
|
local prog=$1
|
2009-07-27 03:44:11 +08:00
|
|
|
local prefix=$2
|
|
|
|
if [ -n "$VALGRIND" ]; then
|
|
|
|
local runner="$VALGRIND_CMDLINE "
|
|
|
|
fi
|
|
|
|
|
2009-07-10 02:01:40 +08:00
|
|
|
case "$prog" in
|
2009-07-28 15:57:17 +08:00
|
|
|
load_file_dump_file)
|
2009-07-27 03:44:11 +08:00
|
|
|
$runner./$prog \
|
|
|
|
$prefix.in \
|
|
|
|
$prefix.$prog.stdout \
|
|
|
|
2>$prefix.$prog.stderr
|
2009-07-10 02:01:40 +08:00
|
|
|
;;
|
|
|
|
*)
|
2009-07-27 03:44:11 +08:00
|
|
|
$runner./$prog \
|
|
|
|
<$prefix.in \
|
|
|
|
>$prefix.$prog.stdout \
|
|
|
|
2>$prefix.$prog.stderr
|
2009-07-10 02:01:40 +08:00
|
|
|
;;
|
|
|
|
esac
|
2009-07-27 03:44:11 +08:00
|
|
|
|
|
|
|
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
|
2009-07-10 02:01:40 +08:00
|
|
|
}
|
|
|
|
|
2009-07-18 20:59:55 +08:00
|
|
|
for testfile in $TESTFILES; do
|
2009-07-27 03:44:11 +08:00
|
|
|
tmpdir="testlogs/`basename $testfile`"
|
2009-08-23 18:00:22 +08:00
|
|
|
rm -rf $tmpdir
|
2009-07-27 03:44:11 +08:00
|
|
|
mkdir -p $tmpdir
|
2009-09-08 21:32:47 +08:00
|
|
|
if echo "$testfile" | grep -q -E -e '-strip$'; then
|
|
|
|
opts="--strip"
|
|
|
|
fi
|
|
|
|
${srcdir}/split-testfile.py $opts $testfile $tmpdir | while read name; do
|
2009-07-27 03:44:11 +08:00
|
|
|
run_test loadf_dumpf $tmpdir/$name
|
|
|
|
run_test loads_dumps $tmpdir/$name
|
2009-07-28 15:57:17 +08:00
|
|
|
run_test load_file_dump_file $tmpdir/$name
|
2009-07-27 03:44:11 +08:00
|
|
|
echo -n '.'
|
2009-07-18 20:59:55 +08:00
|
|
|
done || exit 1
|
2009-07-27 03:44:11 +08:00
|
|
|
echo
|
2009-07-10 02:01:40 +08:00
|
|
|
done
|