mirror of
https://github.com/jqlang/jq.git
synced 2026-10-12 02:16:58 +00:00
Previously, the configure script automatically enables Valgrind during testing when the valgrind command is found. However, running tests with Valgrind is quite slow, so it is better to disable it by default, and to enable it only when the user specifies the `--enable-valgrind` flag.
48 lines
960 B
Bash
Executable File
48 lines
960 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# This is meant to be included by each test's shell script driver.
|
|
|
|
if [ -n "$TRACE_TESTS" ]; then
|
|
set -x
|
|
fi
|
|
|
|
set -eu
|
|
|
|
JQTESTDIR=$(cd "$(dirname "$0")" && pwd)
|
|
JQBASEDIR=$JQTESTDIR/..
|
|
JQ=${JQ:-$JQBASEDIR/jq}
|
|
|
|
# Some tests have locale-dependent output; use C locale. Fixes #3038
|
|
LC_ALL=C
|
|
export LC_ALL
|
|
|
|
if [ -n "${ENABLE_VALGRIND-}" ] && which valgrind > /dev/null; then
|
|
VALGRIND="valgrind --error-exitcode=1 --leak-check=full \
|
|
--suppressions=$JQTESTDIR/onig.supp \
|
|
--suppressions=$JQTESTDIR/local.supp"
|
|
VG_EXIT0=--error-exitcode=0
|
|
Q=-q
|
|
else
|
|
VALGRIND=
|
|
VG_EXIT0=
|
|
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
|
|
d=$(mktemp -d -t jqXXXXXX || true)
|
|
if [ -z "$d" ]; then
|
|
echo "Your OS does not support mktemp(1) -d" 1>&2
|
|
exit 1
|
|
fi
|