Files
stedolan-jq/tests/setup
T

43 lines
793 B
Bash
Raw 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"
2017-02-22 23:01:56 -06:00
VG_EXIT0=--error-exitcode=0
2015-06-18 19:38:25 -07:00
Q=-q
else
VALGRIND=
2017-02-22 23:01:56 -06:00
VG_EXIT0=
2015-06-18 19:38:25 -07:00
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
2017-10-28 10:51:59 -04: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