3 ###############################################################################
7 # This file has been put into the public domain.
8 # You can do whatever you want with this file.
10 ###############################################################################
12 # Find out if our shell supports functions.
13 eval 'unset foo ; foo() { return 42; } ; foo'
14 if test $? != 42 ; then
15 echo "/bin/sh doesn't support functions, skipping this test."
21 if $XZ -c "$@" "$FILE" > tmp_compressed; then
24 echo "Compressing failed: $* $FILE"
29 if $XZ -cd tmp_compressed > tmp_uncompressed ; then
32 echo "Decoding failed: $* $FILE"
37 if cmp tmp_uncompressed "$FILE" ; then
40 echo "Decoded file does not match the original: $* $FILE"
45 if $XZDEC tmp_compressed > tmp_uncompressed ; then
48 echo "Decoding failed: $* $FILE"
53 if cmp tmp_uncompressed "$FILE" ; then
56 echo "Decoded file does not match the original: $* $FILE"
65 XZ="../src/xz/xz --memory=28MiB --threads=1"
66 XZDEC="../src/xzdec/xzdec --memory=4MiB"
69 # Create the required input files.
70 if ./create_compress_files ; then
74 echo "Failed to create files to test compression."
79 # Remove temporary now (in case they are something weird), and on exit.
80 rm -f tmp_compressed tmp_uncompressed
81 trap 'rm -f tmp_compressed tmp_uncompressed' 0
83 # Encode and decode each file with various filter configurations.
84 # This takes quite a bit of time.
85 echo "test_compress.sh:"
86 for FILE in compress_generated_* "$srcdir"/compress_prepared_*
88 MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'`
89 echo " $MSG" | tr -d '\n\r'
91 # Don't test with empty arguments; it breaks some ancient
92 # proprietary /bin/sh versions due to $@ used in test_xz().
98 # Disabled until Subblock format is stable.
100 # --subblock=size=1 \
101 # --subblock=size=1,rle=1 \
102 # --subblock=size=1,rle=4 \
103 # --subblock=size=4,rle=4 \
104 # --subblock=size=8,rle=4 \
105 # --subblock=size=8,rle=8 \
106 # --subblock=size=4096,rle=12 \
119 test_xz $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
121 # Disabled until Subblock format is stable.
122 # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast