Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: tests/test_compress.sh

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/files/good-1-lzma2-5.xz ('k') | tests/test_files.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 ############################################################################### 3 ###############################################################################
4 # 4 #
5 # Author: Lasse Collin 5 # Author: Lasse Collin
6 # 6 #
7 # This file has been put into the public domain. 7 # This file has been put into the public domain.
8 # You can do whatever you want with this file. 8 # You can do whatever you want with this file.
9 # 9 #
10 ############################################################################### 10 ###############################################################################
11 11
12 # If xz wasn't built, this test is skipped.
13 if test -x ../src/xz/xz ; then
14 :
15 else
16 (exit 77)
17 exit 77
18 fi
19
12 # Find out if our shell supports functions. 20 # Find out if our shell supports functions.
13 eval 'unset foo ; foo() { return 42; } ; foo' 21 eval 'unset foo ; foo() { return 42; } ; foo'
14 if test $? != 42 ; then 22 if test $? != 42 ; then
15 echo "/bin/sh doesn't support functions, skipping this test." 23 echo "/bin/sh doesn't support functions, skipping this test."
16 (exit 77) 24 (exit 77)
17 exit 77 25 exit 77
18 fi 26 fi
19 27
20 test_xz() { 28 test_xz() {
21 if $XZ -c "$@" "$FILE" > tmp_compressed; then 29 if $XZ -c "$@" "$FILE" > tmp_compressed; then
22 : 30 :
23 else 31 else
24 echo "Compressing failed: $* $FILE" 32 echo "Compressing failed: $* $FILE"
25 (exit 1) 33 (exit 1)
26 exit 1 34 exit 1
27 fi 35 fi
28 36
29 if $XZ -cd tmp_compressed > tmp_uncompressed ; then 37 if $XZ -cd tmp_compressed > tmp_uncompressed ; then
30 : 38 :
31 else 39 else
32 » » echo "Decoding failed: $* $FILE" 40 » » echo "Decompressing failed: $* $FILE"
33 (exit 1) 41 (exit 1)
34 exit 1 42 exit 1
35 fi 43 fi
36 44
37 if cmp tmp_uncompressed "$FILE" ; then 45 if cmp tmp_uncompressed "$FILE" ; then
38 : 46 :
39 else 47 else
40 » » echo "Decoded file does not match the original: $* $FILE" 48 » » echo "Decompressed file does not match" \
49 » » » » "the original: $* $FILE"
41 (exit 1) 50 (exit 1)
42 exit 1 51 exit 1
43 fi 52 fi
44 53
45 » if $XZDEC tmp_compressed > tmp_uncompressed ; then 54 » if test -n "$XZDEC" ; then
46 » » : 55 » » if $XZDEC tmp_compressed > tmp_uncompressed ; then
47 » else 56 » » » :
48 » » echo "Decoding failed: $* $FILE" 57 » » else
49 » » (exit 1) 58 » » » echo "Decompressing failed: $* $FILE"
50 » » exit 1 59 » » » (exit 1)
51 » fi 60 » » » exit 1
61 » » fi
52 62
53 » if cmp tmp_uncompressed "$FILE" ; then 63 » » if cmp tmp_uncompressed "$FILE" ; then
54 » » : 64 » » » :
55 » else 65 » » else
56 » » echo "Decoded file does not match the original: $* $FILE" 66 » » » echo "Decompressed file does not match" \
57 » » (exit 1) 67 » » » » » "the original: $* $FILE"
58 » » exit 1 68 » » » (exit 1)
69 » » » exit 1
70 » » fi
59 fi 71 fi
60 72
61 # Show progress: 73 # Show progress:
62 echo . | tr -d '\n\r' 74 echo . | tr -d '\n\r'
63 } 75 }
64 76
65 XZ="../src/xz/xz --memory=28MiB --threads=1" 77 XZ="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \
66 XZDEC="../src/xzdec/xzdec --memory=4MiB" 78 » » --no-adjust --threads=1 --check=crc64"
67 unset XZ_OPT 79 XZDEC="../src/xzdec/xzdec" # No memory usage limiter available
80 test -x ../src/xzdec/xzdec || XZDEC=
68 81
69 # Create the required input files. 82 # Create the required input files.
70 if ./create_compress_files ; then 83 if ./create_compress_files ; then
71 : 84 :
72 else 85 else
73 rm -f compress_* 86 rm -f compress_*
74 echo "Failed to create files to test compression." 87 echo "Failed to create files to test compression."
75 (exit 1) 88 (exit 1)
76 exit 1 89 exit 1
77 fi 90 fi
78 91
79 # Remove temporary now (in case they are something weird), and on exit. 92 # Remove temporary now (in case they are something weird), and on exit.
80 rm -f tmp_compressed tmp_uncompressed 93 rm -f tmp_compressed tmp_uncompressed
81 trap 'rm -f tmp_compressed tmp_uncompressed' 0 94 trap 'rm -f tmp_compressed tmp_uncompressed' 0
82 95
83 # Encode and decode each file with various filter configurations. 96 # Compress and decompress each file with various filter configurations.
84 # This takes quite a bit of time. 97 # This takes quite a bit of time.
85 echo "test_compress.sh:" 98 echo "test_compress.sh:"
86 for FILE in compress_generated_* "$srcdir"/compress_prepared_* 99 for FILE in compress_generated_* "$srcdir"/compress_prepared_*
87 do 100 do
88 MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'` 101 MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'`
89 echo " $MSG" | tr -d '\n\r' 102 echo " $MSG" | tr -d '\n\r'
90 103
91 # Don't test with empty arguments; it breaks some ancient 104 # Don't test with empty arguments; it breaks some ancient
92 # proprietary /bin/sh versions due to $@ used in test_xz(). 105 # proprietary /bin/sh versions due to $@ used in test_xz().
93 test_xz -1 106 test_xz -1
(...skipping 26 matching lines...) Expand all
120 133
121 # Disabled until Subblock format is stable. 134 # Disabled until Subblock format is stable.
122 # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast 135 # test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
123 done 136 done
124 137
125 echo 138 echo
126 done 139 done
127 140
128 (exit 0) 141 (exit 0)
129 exit 0 142 exit 0
OLDNEW
« no previous file with comments | « tests/files/good-1-lzma2-5.xz ('k') | tests/test_files.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698