From 86f33bb90c6cfe6950f1d36c9e5dd7fdc9798124 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 6 May 2024 22:55:54 +0300 Subject: [PATCH] Test: Add CMake support to test_suffix.sh It needs to find the xz executable from a different directory and work without config.h. (cherry picked from commit a805594ed0b4cbf7b81aa28ff46a8ab3c83c6876) --- tests/test_suffix.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_suffix.sh b/tests/test_suffix.sh index e2b34425..c01ffb5b 100755 --- a/tests/test_suffix.sh +++ b/tests/test_suffix.sh @@ -7,10 +7,10 @@ # ############################################################################### -# If xz was not built, skip this test. -XZ=../src/xz/xz -test -x "$XZ" || XZ= -if test -z "$XZ"; then +# If xz was not built, skip this test. Autotools and CMake put +# the xz executable in a different location. +XZ=${1:-../src/xz}/xz +if test ! -x "$XZ"; then echo "xz was not built, skipping this test." exit 77 fi @@ -19,7 +19,9 @@ fi # This isn't perfect because it does not specifically check for LZMA1/2 # filters. Many of the other tests also assume LZMA1/2 support if encoders # or decoders are enabled. -if grep 'define HAVE_ENCODERS' ../config.h > /dev/null \ +if test ! -f ../config.h ; then + : +elif grep 'define HAVE_ENCODERS' ../config.h > /dev/null \ && grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then : else