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 a805594ed0)
This commit is contained in:
Lasse Collin 2024-05-06 22:55:54 +03:00
parent 1e243ab378
commit 86f33bb90c
1 changed files with 7 additions and 5 deletions

View File

@ -7,10 +7,10 @@
# #
############################################################################### ###############################################################################
# If xz was not built, skip this test. # If xz was not built, skip this test. Autotools and CMake put
XZ=../src/xz/xz # the xz executable in a different location.
test -x "$XZ" || XZ= XZ=${1:-../src/xz}/xz
if test -z "$XZ"; then if test ! -x "$XZ"; then
echo "xz was not built, skipping this test." echo "xz was not built, skipping this test."
exit 77 exit 77
fi fi
@ -19,7 +19,9 @@ fi
# This isn't perfect because it does not specifically check for LZMA1/2 # 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 # filters. Many of the other tests also assume LZMA1/2 support if encoders
# or decoders are enabled. # 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 && grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then
: :
else else