]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
Tests: Improve feature testing for skipping.
authorJia Tan <jiat0218@gmail.com>
Fri, 14 Jul 2023 13:30:25 +0000 (21:30 +0800)
committerJia Tan <jiat0218@gmail.com>
Fri, 14 Jul 2023 13:30:25 +0000 (21:30 +0800)
Fixed a bug where test_compress_* would all fail if arm64 or armthumb
filters were enabled for compression but arm was disabled. Since the
grep tests only checked for "define HAVE_ENCODER_ARM", this would match
on HAVE_ENCODER_ARM64 or HAVE_ENCODER_ARMTHUMB.

Now the config.h feature test requires " 1" at the end to prevent the
prefix problem. have_feature() was also updated for this even though
there were known current bugs affecting it. This is just in case future
features have a similar prefix problem.

tests/test_compress.sh
tests/test_files.sh

index 61d20ce965f3339be92a42868f455eebca0b5b47..0aa81001862ed971e745b036c5490ce4865f1257 100755 (executable)
@@ -130,8 +130,8 @@ test_xz -4
 
 test_filter()
 {
-       grep "define HAVE_ENCODER_$1" ../config.h > /dev/null || return
-       grep "define HAVE_DECODER_$1" ../config.h > /dev/null || return
+       grep "define HAVE_ENCODER_$1 1" ../config.h > /dev/null || return
+       grep "define HAVE_DECODER_$1 1" ../config.h > /dev/null || return
        shift
        test_xz "$@" --lzma2=dict=64KiB,nice=32,mode=fast
 }
index 64d730815de62c021b098000da4e37cf2672e936..e42af9185bd33fa8cd31966109f64a717310ecc9 100755 (executable)
@@ -35,7 +35,7 @@ fi
 EXIT_STATUS=0
 have_feature()
 {
-       grep "define HAVE_$1" ../config.h > /dev/null && 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
        return 1