jq/tests/upstream/jqtests.sh
Scott Poore 9c974c6015 Update gating to tmt, add segfault test
Moving gating to use tmt format for finding/running tests.

Also adding test to cover segfault bug.

Adding perf test script from Thomas Halman for jqspeed.sh.

Dropping log collection in favor of printing on failure for upstream
tests.

Related: RHEL-12897
Related: RHEL-5052
(cherry picked from commit 771c857cf5)
2023-10-25 14:28:43 -05:00

49 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
die () {
echo "$1" >&2
exit 1
}
# If source not found, download it with dnf
if [ ! -d ./source ]; then
# Extract source from srpm
dnf download --source jq && \
rpm2cpio jq*.rpm|cpio -id && \
mkdir source && \
tar -zxf jq-*.tar.gz -C source --strip-components=1
if [ $? != 0 ]; then
echo "Failed to download upstream tests"
exit 1
fi
fi
pushd ./source || die "missing source directory"
rm -f jq tests/*.log 2>/dev/null
ln -s /usr/bin/jq || die "failed to link jq binary"
FAIL=0
# run the tests
# List of tests is taken from Makefile
TESTS="tests/optionaltest tests/mantest tests/jqtest tests/onigtest tests/shtest tests/utf8test tests/base64test"
for t in $TESTS; do
echo -n "Test $t ... "
./${t} >"${t}.log" 2>&1
RET=$?
if [ $RET = 0 ]; then
echo "ok"
else
echo "failed"
echo "-------------------- ${t}.log start -----------------------------"
cat "${t}.log"
echo "-------------------- ${t}.log end -----------------------------"
FAIL=1
fi
done
popd # exit SOURCE_DIR
exit $FAIL