2010-10-10 14:43:26 +00:00
|
|
|
#!/bin/sh
|
2008-01-07 11:49:19 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
2009-04-13 08:27:40 +00:00
|
|
|
# Author: Lasse Collin
|
2008-01-07 11:49:19 +00:00
|
|
|
#
|
2009-04-13 08:27:40 +00:00
|
|
|
# This file has been put into the public domain.
|
|
|
|
# You can do whatever you want with this file.
|
2008-01-07 11:49:19 +00:00
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
|
2023-11-17 12:04:58 +00:00
|
|
|
# If both xz and xzdec were not built, skip this test.
|
2010-10-08 12:32:29 +00:00
|
|
|
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
|
|
|
|
|
2008-09-30 14:43:55 +00:00
|
|
|
for I in "$srcdir"/files/good-*.xz
|
2008-01-07 11:49:19 +00:00
|
|
|
do
|
2015-01-06 18:30:15 +00:00
|
|
|
if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then
|
2010-10-08 12:32:29 +00:00
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Good file failed: $I"
|
|
|
|
(exit 1)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-01-06 18:30:15 +00:00
|
|
|
if test -z "$XZDEC" || "$XZDEC" "$I" > /dev/null; then
|
2008-01-08 10:29:58 +00:00
|
|
|
:
|
|
|
|
else
|
2008-01-07 11:49:19 +00:00
|
|
|
echo "Good file failed: $I"
|
|
|
|
(exit 1)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-09-30 14:43:55 +00:00
|
|
|
for I in "$srcdir"/files/bad-*.xz
|
2008-01-07 11:49:19 +00:00
|
|
|
do
|
2010-10-08 12:32:29 +00:00
|
|
|
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
|
2008-01-07 11:49:19 +00:00
|
|
|
echo "Bad file succeeded: $I"
|
|
|
|
(exit 1)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2022-09-16 14:08:53 +00:00
|
|
|
# Testing for the lzma_index_append() bug in <= 5.2.6 needs "xz -l":
|
|
|
|
I="$srcdir/files/bad-3-index-uncomp-overflow.xz"
|
|
|
|
if test -n "$XZ" && "$XZ" -l "$I" > /dev/null 2>&1; then
|
|
|
|
echo "Bad file succeeded with xz -l: $I"
|
|
|
|
(exit 1)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-07-14 17:33:05 +00:00
|
|
|
for I in "$srcdir"/files/good-*.lzma
|
|
|
|
do
|
|
|
|
if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "Good file failed: $I"
|
|
|
|
(exit 1)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for I in "$srcdir"/files/bad-*.lzma
|
|
|
|
do
|
|
|
|
if test -n "$XZ" && "$XZ" -dc "$I" > /dev/null 2>&1; then
|
|
|
|
echo "Bad file succeeded: $I"
|
|
|
|
(exit 1)
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-01-07 11:49:19 +00:00
|
|
|
(exit 0)
|
|
|
|
exit 0
|