3 ###############################################################################
7 # This file has been put into the public domain.
8 # You can do whatever you want with this file.
10 ###############################################################################
12 # If xz wasn't built, this test is skipped.
13 if test -x ..
/src
/xz
/xz
; then
20 # Find out if our shell supports functions.
21 eval 'unset foo ; foo() { return 42; } ; foo'
22 if test $?
!= 42 ; then
23 echo "/bin/sh doesn't support functions, skipping this test."
29 if $XZ -c "$@" "$FILE" > tmp_compressed
; then
32 echo "Compressing failed: $* $FILE"
37 if $XZ -cd tmp_compressed
> tmp_uncompressed
; then
40 echo "Decompressing failed: $* $FILE"
45 if cmp tmp_uncompressed
"$FILE" ; then
48 echo "Decompressed file does not match" \
49 "the original: $* $FILE"
54 if test -n "$XZDEC" ; then
55 if $XZDEC tmp_compressed
> tmp_uncompressed
; then
58 echo "Decompressing failed: $* $FILE"
63 if cmp tmp_uncompressed
"$FILE" ; then
66 echo "Decompressed file does not match" \
67 "the original: $* $FILE"
77 XZ
="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \
78 --no-adjust --threads=1 --check=crc64"
79 XZDEC
="../src/xzdec/xzdec" # No memory usage limiter available
80 test -x ..
/src
/xzdec
/xzdec || XZDEC
=
82 # Create the required input files.
83 if .
/create_compress_files
; then
87 echo "Failed to create files to test compression."
92 # Remove temporary now (in case they are something weird), and on exit.
93 rm -f tmp_compressed tmp_uncompressed
94 trap 'rm -f tmp_compressed tmp_uncompressed' 0
96 # Compress and decompress each file with various filter configurations.
97 # This takes quite a bit of time.
98 echo "test_compress.sh:"
99 for FILE
in compress_generated_
* "$srcdir"/compress_prepared_
*
101 MSG
=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'`
102 echo " $MSG" |
tr -d '\n\r'
104 # Don't test with empty arguments; it breaks some ancient
105 # proprietary /bin/sh versions due to $@ used in test_xz().
111 # Disabled until Subblock format is stable.
113 # --subblock=size=1 \
114 # --subblock=size=1,rle=1 \
115 # --subblock=size=1,rle=4 \
116 # --subblock=size=4,rle=4 \
117 # --subblock=size=8,rle=4 \
118 # --subblock=size=8,rle=8 \
119 # --subblock=size=4096,rle=12 \
132 test_xz
$ARGS --lzma2=dict
=64KiB
,nice
=32,mode
=fast
134 # Disabled until Subblock format is stable.
135 # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast