aboutsummaryrefslogtreecommitdiff
path: root/tests/test_compress.sh
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-10-19 19:39:35 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-10-19 19:39:35 +0300
commit424ac91c7e0419393ff2bde4f62e21fa611c776d (patch)
tree38816b3dbc0ffdfbcc44e903f0ce591ad5a8d61e /tests/test_compress.sh
parentTest: Remove the (exit 1) lines. (diff)
downloadxz-424ac91c7e0419393ff2bde4f62e21fa611c776d.tar.xz
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.
Diffstat (limited to 'tests/test_compress.sh')
-rwxr-xr-xtests/test_compress.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_compress.sh b/tests/test_compress.sh
index a6d07c6b..128ef854 100755
--- a/tests/test_compress.sh
+++ b/tests/test_compress.sh
@@ -16,6 +16,18 @@ else
exit 77
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.
eval 'unset foo ; foo() { return 42; } ; foo'
if test $? != 42 ; then