diff --git a/tests/test_files.sh b/tests/test_files.sh index 16cb8619..99c9f2fa 100755 --- a/tests/test_files.sh +++ b/tests/test_files.sh @@ -7,9 +7,12 @@ # ############################################################################### +# Optional argument: +# $1 = directory of the xz executable + # If both xz and xzdec were not built, skip this test. -XZ=../src/xz/xz -XZDEC=../src/xzdec/xzdec +XZ=${1:-../src/xz}/xz +XZDEC=${2:-../src/xzdec}/xzdec test -x "$XZ" || XZ= test -x "$XZDEC" || XZDEC= if test -z "$XZ$XZDEC"; then @@ -21,7 +24,9 @@ fi # 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 +if test ! -f ../config.h ; then + : +elif grep 'define HAVE_DECODERS' ../config.h > /dev/null ; then : else echo "Decompression support is disabled, skipping this test." @@ -33,6 +38,7 @@ fi EXIT_STATUS=0 have_feature() { + test -f ../config.h || return 0 grep "define HAVE_$1 1" ../config.h > /dev/null && return 0 printf '%s: Skipping because HAVE_%s is not enabled\n' "$2" "$1" EXIT_STATUS=77 @@ -47,8 +53,10 @@ have_feature() # If these integrity check types were disabled at build time, # allow the tests to pass still. NO_WARN= -grep 'define HAVE_CHECK_CRC64' ../config.h > /dev/null || NO_WARN=-qQ -grep 'define HAVE_CHECK_SHA256' ../config.h > /dev/null || NO_WARN=-qQ +if test -f ../config.h ; then + grep 'define HAVE_CHECK_CRC64' ../config.h > /dev/null || NO_WARN=-qQ + grep 'define HAVE_CHECK_SHA256' ../config.h > /dev/null || NO_WARN=-qQ +fi for I in "$srcdir"/files/good-*.xz do