From 424ac91c7e0419393ff2bde4f62e21fa611c776d Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 19 Oct 2022 19:39:35 +0300 Subject: 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. --- tests/test_scripts.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/test_scripts.sh') diff --git a/tests/test_scripts.sh b/tests/test_scripts.sh index baa9e249..ee823612 100755 --- a/tests/test_scripts.sh +++ b/tests/test_scripts.sh @@ -19,6 +19,17 @@ for i in XZ XZDIFF XZGREP; do exit 77 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 export PATH -- cgit v1.2.3