mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Make tests accommodate missing xz or xzdec.
This commit is contained in:
parent
b1c7368f95
commit
11f51b6714
2 changed files with 55 additions and 18 deletions
|
@ -9,6 +9,14 @@
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# If xz wasn't built, this test is skipped.
|
||||||
|
if test -x ../src/xz/xz ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
(exit 77)
|
||||||
|
exit 77
|
||||||
|
fi
|
||||||
|
|
||||||
# Find out if our shell supports functions.
|
# Find out if our shell supports functions.
|
||||||
eval 'unset foo ; foo() { return 42; } ; foo'
|
eval 'unset foo ; foo() { return 42; } ; foo'
|
||||||
if test $? != 42 ; then
|
if test $? != 42 ; then
|
||||||
|
@ -29,7 +37,7 @@ test_xz() {
|
||||||
if $XZ -cd tmp_compressed > tmp_uncompressed ; then
|
if $XZ -cd tmp_compressed > tmp_uncompressed ; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "Decoding failed: $* $FILE"
|
echo "Decompressing failed: $* $FILE"
|
||||||
(exit 1)
|
(exit 1)
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -37,25 +45,29 @@ test_xz() {
|
||||||
if cmp tmp_uncompressed "$FILE" ; then
|
if cmp tmp_uncompressed "$FILE" ; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "Decoded file does not match the original: $* $FILE"
|
echo "Decompressed file does not match" \
|
||||||
|
"the original: $* $FILE"
|
||||||
(exit 1)
|
(exit 1)
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $XZDEC tmp_compressed > tmp_uncompressed ; then
|
if test -n "$XZDEC" ; then
|
||||||
:
|
if $XZDEC tmp_compressed > tmp_uncompressed ; then
|
||||||
else
|
:
|
||||||
echo "Decoding failed: $* $FILE"
|
else
|
||||||
(exit 1)
|
echo "Decompressing failed: $* $FILE"
|
||||||
exit 1
|
(exit 1)
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if cmp tmp_uncompressed "$FILE" ; then
|
if cmp tmp_uncompressed "$FILE" ; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "Decoded file does not match the original: $* $FILE"
|
echo "Decompressed file does not match" \
|
||||||
(exit 1)
|
"the original: $* $FILE"
|
||||||
exit 1
|
(exit 1)
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Show progress:
|
# Show progress:
|
||||||
|
@ -65,6 +77,7 @@ test_xz() {
|
||||||
XZ="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \
|
XZ="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \
|
||||||
--no-adjust --threads=1 --check=crc64"
|
--no-adjust --threads=1 --check=crc64"
|
||||||
XZDEC="../src/xzdec/xzdec" # No memory usage limiter available
|
XZDEC="../src/xzdec/xzdec" # No memory usage limiter available
|
||||||
|
test -x ../src/xzdec/xzdec || XZDEC=
|
||||||
|
|
||||||
# Create the required input files.
|
# Create the required input files.
|
||||||
if ./create_compress_files ; then
|
if ./create_compress_files ; then
|
||||||
|
@ -80,7 +93,7 @@ fi
|
||||||
rm -f tmp_compressed tmp_uncompressed
|
rm -f tmp_compressed tmp_uncompressed
|
||||||
trap 'rm -f tmp_compressed tmp_uncompressed' 0
|
trap 'rm -f tmp_compressed tmp_uncompressed' 0
|
||||||
|
|
||||||
# Encode and decode each file with various filter configurations.
|
# Compress and decompress each file with various filter configurations.
|
||||||
# This takes quite a bit of time.
|
# This takes quite a bit of time.
|
||||||
echo "test_compress.sh:"
|
echo "test_compress.sh:"
|
||||||
for FILE in compress_generated_* "$srcdir"/compress_prepared_*
|
for FILE in compress_generated_* "$srcdir"/compress_prepared_*
|
||||||
|
|
|
@ -9,9 +9,27 @@
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# If both xz and xzdec were not build, skip this test.
|
||||||
|
XZ=../src/xz/xz
|
||||||
|
XZDEC=../src/xzdec/xzdec
|
||||||
|
test -x "$XZ" || XZ=
|
||||||
|
test -x "$XZDEC" || XZDEC=
|
||||||
|
if test -z "$XZ$XZDEC"; then
|
||||||
|
(exit 77)
|
||||||
|
exit 77
|
||||||
|
fi
|
||||||
|
|
||||||
for I in "$srcdir"/files/good-*.xz
|
for I in "$srcdir"/files/good-*.xz
|
||||||
do
|
do
|
||||||
if ../src/xzdec/xzdec "$I" > /dev/null 2> /dev/null ; then
|
if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null 2>&1; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo "Good file failed: $I"
|
||||||
|
(exit 1)
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$XZDEC" || "$XZDEC" "$I" > /dev/null 2>&1; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
echo "Good file failed: $I"
|
echo "Good file failed: $I"
|
||||||
|
@ -22,7 +40,13 @@ done
|
||||||
|
|
||||||
for I in "$srcdir"/files/bad-*.xz
|
for I in "$srcdir"/files/bad-*.xz
|
||||||
do
|
do
|
||||||
if ../src/xzdec/xzdec "$I" > /dev/null 2> /dev/null ; then
|
if test -n "$XZ" && "$XZ" -dc "$I" > /dev/null 2>&1; then
|
||||||
|
echo "Bad file succeeded: $I"
|
||||||
|
(exit 1)
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$XZDEC" && "$XZDEC" "$I" > /dev/null 2>&1; then
|
||||||
echo "Bad file succeeded: $I"
|
echo "Bad file succeeded: $I"
|
||||||
(exit 1)
|
(exit 1)
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue