summaryrefslogtreecommitdiffstats
path: root/tests/test_files.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtests/test_files.sh29
1 files changed, 20 insertions, 9 deletions
diff --git a/tests/test_files.sh b/tests/test_files.sh
index 60402e7..99c9f2f 100755
--- a/tests/test_files.sh
+++ b/tests/test_files.sh
@@ -1,17 +1,18 @@
#!/bin/sh
+# SPDX-License-Identifier: 0BSD
###############################################################################
#
# Author: Lasse Collin
#
-# This file has been put into the public domain.
-# You can do whatever you want with this file.
-#
###############################################################################
-# If both xz and xzdec were not build, skip this test.
-XZ=../src/xz/xz
-XZDEC=../src/xzdec/xzdec
+# Optional argument:
+# $1 = directory of the xz executable
+
+# If both xz and xzdec were not built, skip this test.
+XZ=${1:-../src/xz}/xz
+XZDEC=${2:-../src/xzdec}/xzdec
test -x "$XZ" || XZ=
test -x "$XZDEC" || XZDEC=
if test -z "$XZ$XZDEC"; then
@@ -23,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."
@@ -35,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
@@ -49,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
@@ -80,6 +86,11 @@ do
have_feature DECODER_ARM64 "$I" || continue
;;
esac
+ case $I in
+ */good-1-riscv-lzma2-*.xz)
+ have_feature DECODER_RISCV "$I" || continue
+ ;;
+ esac
if test -z "$XZ" || "$XZ" $NO_WARN -dc "$I" > /dev/null; then
: