1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Tests: Skip tests in test_*.sh if encoders and/or decoders are disabled.

This isn't perfect as the scripts can still fail if only
certain filters are disabled. This is still an improvement
as now "make check" has better behavior when all encoders
or decoders are disabled.

Grepping ../config.h is simple and fairly clean but it only
works if config.h was created. CMake builds don't create
config.h but they don't use these test scripts either.

Thanks to Sebastian Andrzej Siewior for reporting the problem.
Thanks to Jia Tan for the original patch which grepped xz
error messages instead of config.h.
This commit is contained in:
Lasse Collin 2022-10-19 19:39:35 +03:00
parent ca8bf9d7c5
commit 424ac91c7e
3 changed files with 34 additions and 0 deletions

View file

@ -16,6 +16,18 @@ else
exit 77 exit 77
fi fi
# If compression or decompression support is missing, this test is skipped.
# This isn't perfect as if only some compressors or decompressors are disabled
# then this script can still fail because for now this doesn't check the
# availability of each filter.
if grep 'define HAVE_ENCODERS' ../config.h > /dev/null \
&& grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then
:
else
echo "Compression or decompression support is disabled, skipping this test."
exit 77
fi
# Find out if our shell supports functions. # Find out if our shell supports functions.
eval 'unset foo ; foo() { return 42; } ; foo' eval 'unset foo ; foo() { return 42; } ; foo'
if test $? != 42 ; then if test $? != 42 ; then

View file

@ -18,6 +18,17 @@ if test -z "$XZ$XZDEC"; then
exit 77 exit 77
fi fi
# If decompression support is missing, this test is skipped.
# This isn't perfect as if only some decompressors are disabled
# then some good files might not decompress and the test fails
# for a (kind of) wrong reason.
if grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then
:
else
echo "Decompression support is disabled, skipping this test."
exit 77
fi
for I in "$srcdir"/files/good-*.xz for I in "$srcdir"/files/good-*.xz
do do
if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then

View file

@ -19,6 +19,17 @@ for i in XZ XZDIFF XZGREP; do
exit 77 exit 77
done done
# If decompression support is missing, this test is skipped.
# Installing the scripts in this case is a bit silly but they
# could still be used with other decompression tools so configure
# doesn't automatically disable scripts if decoders are disabled.
if grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then
:
else
echo "Decompression support is disabled, skipping this test."
exit 77
fi
PATH=`pwd`/../src/xz:$PATH PATH=`pwd`/../src/xz:$PATH
export PATH export PATH