3 ###############################################################################
5 # Copyright (C) 2008 Lasse Collin
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 ###############################################################################
19 # Find out if our shell supports functions.
20 eval 'unset foo ; foo() { return 42; } ; foo'
21 if test $? != 42 ; then
22 echo "/bin/sh doesn't support functions, skipping this test."
28 if $XZ -c "$@" "$FILE" > tmp_compressed; then
31 echo "Compressing failed: $* $FILE"
36 if $XZ -cd tmp_compressed > tmp_uncompressed ; then
39 echo "Decoding failed: $* $FILE"
44 if cmp tmp_uncompressed "$FILE" ; then
47 echo "Decoded file does not match the original: $* $FILE"
52 if $XZDEC tmp_compressed > tmp_uncompressed ; then
55 echo "Decoding failed: $* $FILE"
60 if cmp tmp_uncompressed "$FILE" ; then
63 echo "Decoded file does not match the original: $* $FILE"
72 XZ="../src/xz/xz --memory=28MiB --threads=1"
73 XZDEC="../src/xzdec/xzdec --memory=4MiB"
76 # Create the required input files.
77 if ./create_compress_files ; then
81 echo "Failed to create files to test compression."
86 # Remove temporary now (in case they are something weird), and on exit.
87 rm -f tmp_compressed tmp_uncompressed
88 trap 'rm -f tmp_compressed tmp_uncompressed' 0
90 # Encode and decode each file with various filter configurations.
91 # This takes quite a bit of time.
92 echo "test_compress.sh:"
93 for FILE in compress_generated_* "$srcdir"/compress_prepared_*
95 MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'`
96 echo " $MSG" | tr -d '\n\r'
98 # Don't test with empty arguments; it breaks some ancient
99 # proprietary /bin/sh versions due to $@ used in test_xz().
105 # Disabled until Subblock format is stable.
107 # --subblock=size=1 \
108 # --subblock=size=1,rle=1 \
109 # --subblock=size=1,rle=4 \
110 # --subblock=size=4,rle=4 \
111 # --subblock=size=8,rle=4 \
112 # --subblock=size=8,rle=8 \
113 # --subblock=size=4096,rle=12 \
126 test_xz $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
128 # Disabled until Subblock format is stable.
129 # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast