Files

41 lines
746 B
Bash
Raw Permalink Normal View History

2015-06-18 19:38:25 -07:00
#!/bin/sh
2015-06-26 23:36:34 -05:00
# This is meant to be included by each test's shell script driver.
2016-01-17 12:23:05 -06:00
if [ -n "$TRACE_TESTS" ]; then
set -x
fi
2015-06-26 23:36:34 -05:00
set -eu
2015-06-18 19:38:25 -07:00
JQTESTDIR=$(cd "$(dirname "$0")" && pwd)
JQBASEDIR=$JQTESTDIR/..
JQ=$JQBASEDIR/jq
if [ -z "${NO_VALGRIND-}" ] && which valgrind > /dev/null; then
2015-06-18 19:38:25 -07:00
VALGRIND="valgrind --error-exitcode=1 --leak-check=full \
--suppressions=$JQTESTDIR/onig.supp"
Q=-q
else
VALGRIND=
Q=
fi
mods=$JQTESTDIR/modules
clean=true
d=
clean () {
if ! $clean; then
echo "See temp files in $d!"
elif [ -n "$d" ]; then
rm -rf "$d"
fi
}
trap clean EXIT
2015-10-24 11:21:16 -07:00
d=`mktemp -d -t jqXXXXXX || true`
2015-06-18 19:38:25 -07:00
if [ -z "$d" ]; then
echo "Your OS does not support mktemp(1) -d" 1>&2
exit 1
2015-06-18 19:38:25 -07:00
fi