Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # FLAC - Free Lossless Audio Codec |
| 4 | # Copyright (C) 2001,2002 Josh Coalson |
| 5 | # |
| 6 | # This program is part of FLAC; you can redistribute it and/or |
| 7 | # modify it under the terms of the GNU General Public License |
| 8 | # as published by the Free Software Foundation; either version 2 |
| 9 | # of the License, or (at your option) any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program; if not, write to the Free Software |
| 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 20 | die () |
| 21 | { |
| 22 | echo $* 1>&2 |
| 23 | exit 1 |
| 24 | } |
| 25 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 26 | LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH |
| 27 | export LD_LIBRARY_PATH |
| 28 | PATH=../src/flac:../src/test_streams:../obj/release/bin:../obj/debug/bin:$PATH |
| 29 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 30 | flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 31 | |
| 32 | run_flac () |
| 33 | { |
| 34 | if [ "$FLAC__VALGRIND" = yes ] ; then |
| 35 | valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log |
| 36 | else |
| 37 | flac $* |
| 38 | fi |
| 39 | } |
| 40 | |
| 41 | echo "Checking for --ogg support in flac..." |
| 42 | if flac --ogg --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then |
| 43 | has_ogg=yes; |
| 44 | echo "flac --ogg works" |
| 45 | else |
| 46 | has_ogg=no; |
| 47 | echo "flac --ogg doesn't work" |
| 48 | fi |
| 49 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 50 | ############################################################################ |
| 51 | # test --skip and --until |
| 52 | ############################################################################ |
| 53 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 54 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 55 | # first make some chopped-up files |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 56 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 57 | echo "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN" > master.raw |
| 58 | dddie="die ERROR: creating files for --skip/--until tests" |
| 59 | dd if=master.raw ibs=1 count=50 of=50c.raw 2>/dev/null || $dddie |
| 60 | dd if=master.raw ibs=1 skip=10 count=40 of=50c.skip10.raw 2>/dev/null || $dddie |
| 61 | dd if=master.raw ibs=1 skip=11 count=39 of=50c.skip11.raw 2>/dev/null || $dddie |
| 62 | dd if=master.raw ibs=1 count=40 of=50c.until40.raw 2>/dev/null || $dddie |
| 63 | dd if=master.raw ibs=1 count=39 of=50c.until39.raw 2>/dev/null || $dddie |
| 64 | dd if=master.raw ibs=1 skip=10 count=30 of=50c.skip10.until40.raw 2>/dev/null || $dddie |
| 65 | dd if=master.raw ibs=1 skip=10 count=29 of=50c.skip10.until39.raw 2>/dev/null || $dddie |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 66 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 67 | eopt="--silent --verify --lax --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1" |
| 68 | dopt="--silent --decode --force-raw-format --endian=big --sign=signed" |
| 69 | |
| 70 | # |
| 71 | # test --skip when encoding |
| 72 | # |
| 73 | |
| 74 | echo -n "testing --skip=# (encode)... " |
| 75 | run_flac $eopt --skip=10 -o z50c.skip10.flac 50c.raw || die "ERROR generating FLAC file" |
| 76 | run_flac $dopt -o z50c.skip10.raw z50c.skip10.flac || die "ERROR decoding FLAC file" |
| 77 | cmp 50c.skip10.raw z50c.skip10.raw || die "ERROR: file mismatch for --skip=10 (encode)" |
| 78 | rm -f z50c.skip10.flac z50c.skip10.raw |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 79 | echo OK |
| 80 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 81 | echo -n "testing --skip=mm:ss (encode)... " |
| 82 | run_flac $eopt --skip=0:01 -o z50c.skip0:01.flac 50c.raw || die "ERROR generating FLAC file" |
| 83 | run_flac $dopt -o z50c.skip0:01.raw z50c.skip0:01.flac || die "ERROR decoding FLAC file" |
| 84 | cmp 50c.skip10.raw z50c.skip0:01.raw || die "ERROR: file mismatch for --skip=0:01 (encode)" |
| 85 | rm -f z50c.skip0:01.flac z50c.skip0:01.raw |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 86 | echo OK |
| 87 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 88 | echo -n "testing --skip=mm:ss.sss (encode)... " |
| 89 | run_flac $eopt --skip=0:01.1001 -o z50c.skip0:01.1001.flac 50c.raw || die "ERROR generating FLAC file" |
| 90 | run_flac $dopt -o z50c.skip0:01.1001.raw z50c.skip0:01.1001.flac || die "ERROR decoding FLAC file" |
| 91 | cmp 50c.skip11.raw z50c.skip0:01.1001.raw || die "ERROR: file mismatch for --skip=0:01.1001 (encode)" |
| 92 | rm -f z50c.skip0:01.1001.flac z50c.skip0:01.1001.raw |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 93 | echo OK |
| 94 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 95 | # |
| 96 | # test --skip when decoding |
| 97 | # |
| 98 | |
| 99 | echo -n "testing --skip=# (decode)... " |
| 100 | run_flac $eopt -o z50c.flac 50c.raw || die "ERROR generating FLAC file" |
| 101 | run_flac $dopt --skip=10 -o z50c.skip10.raw z50c.flac || die "ERROR decoding FLAC file" |
| 102 | cmp 50c.skip10.raw z50c.skip10.raw || die "ERROR: file mismatch for --skip=10 (decode)" |
| 103 | rm -f z50c.skip10.raw |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 104 | echo OK |
| 105 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 106 | echo -n "testing --skip=mm:ss (decode)... " |
| 107 | run_flac $dopt --skip=0:01 -o z50c.skip0:01.raw z50c.flac || die "ERROR decoding FLAC file" |
| 108 | cmp 50c.skip10.raw z50c.skip0:01.raw || die "ERROR: file mismatch for --skip=0:01 (decode)" |
| 109 | rm -f z50c.skip0:01.raw |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 110 | echo OK |
| 111 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 112 | echo -n "testing --skip=mm:ss.sss (decode)... " |
| 113 | run_flac $dopt --skip=0:01.1001 -o z50c.skip0:01.1001.raw z50c.flac || die "ERROR decoding FLAC file" |
| 114 | cmp 50c.skip11.raw z50c.skip0:01.1001.raw || die "ERROR: file mismatch for --skip=0:01.1001 (decode)" |
| 115 | rm -f z50c.skip0:01.1001.raw |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 116 | echo OK |
| 117 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 118 | rm -f z50c.flac |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 119 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 120 | # |
| 121 | # test --until when encoding |
| 122 | # |
| 123 | |
| 124 | echo -n "testing --until=# (encode)... " |
| 125 | run_flac $eopt --until=40 -o z50c.until40.flac 50c.raw || die "ERROR generating FLAC file" |
| 126 | run_flac $dopt -o z50c.until40.raw z50c.until40.flac || die "ERROR decoding FLAC file" |
| 127 | cmp 50c.until40.raw z50c.until40.raw || die "ERROR: file mismatch for --until=40 (encode)" |
| 128 | rm -f z50c.until40.flac z50c.until40.raw |
| 129 | echo OK |
| 130 | |
| 131 | echo -n "testing --until=mm:ss (encode)... " |
| 132 | run_flac $eopt --until=0:04 -o z50c.until0:04.flac 50c.raw || die "ERROR generating FLAC file" |
| 133 | run_flac $dopt -o z50c.until0:04.raw z50c.until0:04.flac || die "ERROR decoding FLAC file" |
| 134 | cmp 50c.until40.raw z50c.until0:04.raw || die "ERROR: file mismatch for --until=0:04 (encode)" |
| 135 | rm -f z50c.until0:04.flac z50c.until0:04.raw |
| 136 | echo OK |
| 137 | |
| 138 | echo -n "testing --until=mm:ss.sss (encode)... " |
| 139 | run_flac $eopt --until=0:03.9001 -o z50c.until0:03.9001.flac 50c.raw || die "ERROR generating FLAC file" |
| 140 | run_flac $dopt -o z50c.until0:03.9001.raw z50c.until0:03.9001.flac || die "ERROR decoding FLAC file" |
| 141 | cmp 50c.until39.raw z50c.until0:03.9001.raw || die "ERROR: file mismatch for --until=0:03.9001 (encode)" |
| 142 | rm -f z50c.until0:03.9001.flac z50c.until0:03.9001.raw |
| 143 | echo OK |
| 144 | |
| 145 | echo -n "testing --until=-# (encode)... " |
| 146 | run_flac $eopt --until=-10 -o z50c.until-10.flac 50c.raw || die "ERROR generating FLAC file" |
| 147 | run_flac $dopt -o z50c.until-10.raw z50c.until-10.flac || die "ERROR decoding FLAC file" |
| 148 | cmp 50c.until40.raw z50c.until-10.raw || die "ERROR: file mismatch for --until=-10 (encode)" |
| 149 | rm -f z50c.until-10.flac z50c.until-10.raw |
| 150 | echo OK |
| 151 | |
| 152 | echo -n "testing --until=-mm:ss (encode)... " |
| 153 | run_flac $eopt --until=-0:01 -o z50c.until-0:01.flac 50c.raw || die "ERROR generating FLAC file" |
| 154 | run_flac $dopt -o z50c.until-0:01.raw z50c.until-0:01.flac || die "ERROR decoding FLAC file" |
| 155 | cmp 50c.until40.raw z50c.until-0:01.raw || die "ERROR: file mismatch for --until=-0:01 (encode)" |
| 156 | rm -f z50c.until-0:01.flac z50c.until-0:01.raw |
| 157 | echo OK |
| 158 | |
| 159 | echo -n "testing --until=-mm:ss.sss (encode)... " |
| 160 | run_flac $eopt --until=-0:01.1001 -o z50c.until-0:01.1001.flac 50c.raw || die "ERROR generating FLAC file" |
| 161 | run_flac $dopt -o z50c.until-0:01.1001.raw z50c.until-0:01.1001.flac || die "ERROR decoding FLAC file" |
| 162 | cmp 50c.until39.raw z50c.until-0:01.1001.raw || die "ERROR: file mismatch for --until=-0:01.1001 (encode)" |
| 163 | rm -f z50c.until-0:01.1001.flac z50c.until-0:01.1001.raw |
| 164 | echo OK |
| 165 | |
| 166 | # |
| 167 | # test --until when decoding |
| 168 | # |
| 169 | |
| 170 | run_flac $eopt -o z50c.flac 50c.raw || die "ERROR generating FLAC file" |
| 171 | |
| 172 | echo -n "testing --until=# (decode)... " |
| 173 | run_flac $dopt --until=40 -o z50c.until40.raw z50c.flac || die "ERROR decoding FLAC file" |
| 174 | cmp 50c.until40.raw z50c.until40.raw || die "ERROR: file mismatch for --until=40 (decode)" |
| 175 | rm -f z50c.until40.raw |
| 176 | echo OK |
| 177 | |
| 178 | echo -n "testing --until=mm:ss (decode)... " |
| 179 | run_flac $dopt --until=0:04 -o z50c.until0:04.raw z50c.flac || die "ERROR decoding FLAC file" |
| 180 | cmp 50c.until40.raw z50c.until0:04.raw || die "ERROR: file mismatch for --until=0:04 (decode)" |
| 181 | rm -f z50c.until0:04.raw |
| 182 | echo OK |
| 183 | |
| 184 | echo -n "testing --until=mm:ss.sss (decode)... " |
| 185 | run_flac $dopt --until=0:03.9001 -o z50c.until0:03.9001.raw z50c.flac || die "ERROR decoding FLAC file" |
| 186 | cmp 50c.until39.raw z50c.until0:03.9001.raw || die "ERROR: file mismatch for --until=0:03.9001 (decode)" |
| 187 | rm -f z50c.until0:03.9001.raw |
| 188 | echo OK |
| 189 | |
| 190 | echo -n "testing --until=-# (decode)... " |
| 191 | run_flac $dopt --until=-10 -o z50c.until-10.raw z50c.flac || die "ERROR decoding FLAC file" |
| 192 | cmp 50c.until40.raw z50c.until-10.raw || die "ERROR: file mismatch for --until=-10 (decode)" |
| 193 | rm -f z50c.until-10.raw |
| 194 | echo OK |
| 195 | |
| 196 | echo -n "testing --until=-mm:ss (decode)... " |
| 197 | run_flac $dopt --until=-0:01 -o z50c.until-0:01.raw z50c.flac || die "ERROR decoding FLAC file" |
| 198 | cmp 50c.until40.raw z50c.until-0:01.raw || die "ERROR: file mismatch for --until=-0:01 (decode)" |
| 199 | rm -f z50c.until-0:01.raw |
| 200 | echo OK |
| 201 | |
| 202 | echo -n "testing --until=-mm:ss.sss (decode)... " |
| 203 | run_flac $dopt --until=-0:01.1001 -o z50c.until-0:01.1001.raw z50c.flac || die "ERROR decoding FLAC file" |
| 204 | cmp 50c.until39.raw z50c.until-0:01.1001.raw || die "ERROR: file mismatch for --until=-0:01.1001 (decode)" |
| 205 | rm -f z50c.until-0:01.1001.raw |
| 206 | echo OK |
| 207 | |
| 208 | rm -f z50c.flac |
| 209 | |
| 210 | # |
| 211 | # test --skip and --until when encoding |
| 212 | # |
| 213 | |
| 214 | echo -n "testing --skip=10 --until=# (encode)... " |
| 215 | run_flac $eopt --skip=10 --until=40 -o z50c.skip10.until40.flac 50c.raw || die "ERROR generating FLAC file" |
| 216 | run_flac $dopt -o z50c.skip10.until40.raw z50c.skip10.until40.flac || die "ERROR decoding FLAC file" |
| 217 | cmp 50c.skip10.until40.raw z50c.skip10.until40.raw || die "ERROR: file mismatch for --skip=10 --until=40 (encode)" |
| 218 | rm -f z50c.skip10.until40.flac z50c.skip10.until40.raw |
| 219 | echo OK |
| 220 | |
| 221 | echo -n "testing --skip=10 --until=mm:ss (encode)... " |
| 222 | run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.flac 50c.raw || die "ERROR generating FLAC file" |
| 223 | run_flac $dopt -o z50c.skip10.until0:04.raw z50c.skip10.until0:04.flac || die "ERROR decoding FLAC file" |
| 224 | cmp 50c.skip10.until40.raw z50c.skip10.until0:04.raw || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode)" |
| 225 | rm -f z50c.skip10.until0:04.flac z50c.skip10.until0:04.raw |
| 226 | echo OK |
| 227 | |
| 228 | echo -n "testing --skip=10 --until=mm:ss.sss (encode)... " |
| 229 | run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.flac 50c.raw || die "ERROR generating FLAC file" |
| 230 | run_flac $dopt -o z50c.skip10.until0:03.9001.raw z50c.skip10.until0:03.9001.flac || die "ERROR decoding FLAC file" |
| 231 | cmp 50c.skip10.until39.raw z50c.skip10.until0:03.9001.raw || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode)" |
| 232 | rm -f z50c.skip10.until0:03.9001.flac z50c.skip10.until0:03.9001.raw |
| 233 | echo OK |
| 234 | |
| 235 | echo -n "testing --skip=10 --until=+# (encode)... " |
| 236 | run_flac $eopt --skip=10 --until=+30 -o z50c.skip10.until+30.flac 50c.raw || die "ERROR generating FLAC file" |
| 237 | run_flac $dopt -o z50c.skip10.until+30.raw z50c.skip10.until+30.flac || die "ERROR decoding FLAC file" |
| 238 | cmp 50c.skip10.until40.raw z50c.skip10.until+30.raw || die "ERROR: file mismatch for --skip=10 --until=+30 (encode)" |
| 239 | rm -f z50c.skip10.until+30.flac z50c.skip10.until+30.raw |
| 240 | echo OK |
| 241 | |
| 242 | echo -n "testing --skip=10 --until=+mm:ss (encode)... " |
| 243 | run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0:03.flac 50c.raw || die "ERROR generating FLAC file" |
| 244 | run_flac $dopt -o z50c.skip10.until+0:03.raw z50c.skip10.until+0:03.flac || die "ERROR decoding FLAC file" |
| 245 | cmp 50c.skip10.until40.raw z50c.skip10.until+0:03.raw || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode)" |
| 246 | rm -f z50c.skip10.until+0:03.flac z50c.skip10.until+0:03.raw |
| 247 | echo OK |
| 248 | |
| 249 | echo -n "testing --skip=10 --until=+mm:ss.sss (encode)... " |
| 250 | run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0:02.9001.flac 50c.raw || die "ERROR generating FLAC file" |
| 251 | run_flac $dopt -o z50c.skip10.until+0:02.9001.raw z50c.skip10.until+0:02.9001.flac || die "ERROR decoding FLAC file" |
| 252 | cmp 50c.skip10.until39.raw z50c.skip10.until+0:02.9001.raw || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode)" |
| 253 | rm -f z50c.skip10.until+0:02.9001.flac z50c.skip10.until+0:02.9001.raw |
| 254 | echo OK |
| 255 | |
| 256 | echo -n "testing --skip=10 --until=-# (encode)... " |
| 257 | run_flac $eopt --skip=10 --until=-10 -o z50c.skip10.until-10.flac 50c.raw || die "ERROR generating FLAC file" |
| 258 | run_flac $dopt -o z50c.skip10.until-10.raw z50c.skip10.until-10.flac || die "ERROR decoding FLAC file" |
| 259 | cmp 50c.skip10.until40.raw z50c.skip10.until-10.raw || die "ERROR: file mismatch for --skip=10 --until=-10 (encode)" |
| 260 | rm -f z50c.skip10.until-10.flac z50c.skip10.until-10.raw |
| 261 | echo OK |
| 262 | |
| 263 | echo -n "testing --skip=10 --until=-mm:ss (encode)... " |
| 264 | run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.flac 50c.raw || die "ERROR generating FLAC file" |
| 265 | run_flac $dopt -o z50c.skip10.until-0:01.raw z50c.skip10.until-0:01.flac || die "ERROR decoding FLAC file" |
| 266 | cmp 50c.skip10.until40.raw z50c.skip10.until-0:01.raw || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode)" |
| 267 | rm -f z50c.skip10.until-0:01.flac z50c.skip10.until-0:01.raw |
| 268 | echo OK |
| 269 | |
| 270 | echo -n "testing --skip=10 --until=-mm:ss.sss (encode)... " |
| 271 | run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.flac 50c.raw || die "ERROR generating FLAC file" |
| 272 | run_flac $dopt -o z50c.skip10.until-0:01.1001.raw z50c.skip10.until-0:01.1001.flac || die "ERROR decoding FLAC file" |
| 273 | cmp 50c.skip10.until39.raw z50c.skip10.until-0:01.1001.raw || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode)" |
| 274 | rm -f z50c.skip10.until-0:01.1001.flac z50c.skip10.until-0:01.1001.raw |
| 275 | echo OK |
| 276 | |
| 277 | # |
| 278 | # test --skip and --until when decoding |
| 279 | # |
| 280 | |
| 281 | run_flac $eopt -o z50c.flac 50c.raw || die "ERROR generating FLAC file" |
| 282 | |
| 283 | echo -n "testing --skip=10 --until=# (decode)... " |
| 284 | run_flac $dopt --skip=10 --until=40 -o z50c.skip10.until40.raw z50c.flac || die "ERROR decoding FLAC file" |
| 285 | cmp 50c.skip10.until40.raw z50c.skip10.until40.raw || die "ERROR: file mismatch for --skip=10 --until=40 (decode)" |
| 286 | rm -f z50c.skip10.until40.raw |
| 287 | echo OK |
| 288 | |
| 289 | echo -n "testing --skip=10 --until=mm:ss (decode)... " |
| 290 | run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.raw z50c.flac || die "ERROR decoding FLAC file" |
| 291 | cmp 50c.skip10.until40.raw z50c.skip10.until0:04.raw || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode)" |
| 292 | rm -f z50c.skip10.until0:04.raw |
| 293 | echo OK |
| 294 | |
| 295 | echo -n "testing --skip=10 --until=mm:ss.sss (decode)... " |
| 296 | run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.raw z50c.flac || die "ERROR decoding FLAC file" |
| 297 | cmp 50c.skip10.until39.raw z50c.skip10.until0:03.9001.raw || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode)" |
| 298 | rm -f z50c.skip10.until0:03.9001.raw |
| 299 | echo OK |
| 300 | |
| 301 | echo -n "testing --skip=10 --until=-# (decode)... " |
| 302 | run_flac $dopt --skip=10 --until=-10 -o z50c.skip10.until-10.raw z50c.flac || die "ERROR decoding FLAC file" |
| 303 | cmp 50c.skip10.until40.raw z50c.skip10.until-10.raw || die "ERROR: file mismatch for --skip=10 --until=-10 (decode)" |
| 304 | rm -f z50c.skip10.until-10.raw |
| 305 | echo OK |
| 306 | |
| 307 | echo -n "testing --skip=10 --until=-mm:ss (decode)... " |
| 308 | run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.raw z50c.flac || die "ERROR decoding FLAC file" |
| 309 | cmp 50c.skip10.until40.raw z50c.skip10.until-0:01.raw || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode)" |
| 310 | rm -f z50c.skip10.until-0:01.raw |
| 311 | echo OK |
| 312 | |
| 313 | echo -n "testing --skip=10 --until=-mm:ss.sss (decode)... " |
| 314 | run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.raw z50c.flac || die "ERROR decoding FLAC file" |
| 315 | cmp 50c.skip10.until39.raw z50c.skip10.until-0:01.1001.raw || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode)" |
| 316 | rm -f z50c.skip10.until-0:01.1001.raw |
| 317 | echo OK |
| 318 | |
| 319 | rm -f z50c.flac |
| 320 | |
| 321 | #@@@@@@ |
| 322 | exit 123 |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 323 | |
| 324 | # |
| 325 | # multi-file tests |
| 326 | # |
| 327 | |
| 328 | echo "Generating streams..." |
| 329 | if [ ! -f wacky1.wav ] ; then |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 330 | test_streams || die "ERROR during test_streams" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 331 | fi |
| 332 | |
| 333 | echo "Generating multiple input files from noise..." |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 334 | run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw || die "ERROR generating FLAC file" |
| 335 | run_flac --decode --silent noise.flac || die "ERROR generating WAVE file" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 336 | rm -f noise.flac |
| 337 | mv noise.wav file0.wav |
| 338 | cp file0.wav file1.wav |
| 339 | cp file1.wav file2.wav |
| 340 | |
| 341 | test_multifile () |
| 342 | { |
| 343 | streamtype=$1 |
| 344 | sector_align=$2 |
| 345 | encode_options="$3" |
| 346 | |
| 347 | if [ $streamtype = ogg ] ; then |
| 348 | suffix=ogg |
| 349 | encode_options="$encode_options --ogg" |
| 350 | else |
| 351 | suffix=flac |
| 352 | fi |
| 353 | |
| 354 | if [ $sector_align = sector_align ] ; then |
| 355 | encode_options="$encode_options --sector-align" |
| 356 | fi |
| 357 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 358 | run_flac $encode_options file0.wav file1.wav file2.wav || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 359 | for n in 0 1 2 ; do |
| 360 | mv file$n.$suffix file${n}x.$suffix |
| 361 | done |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 362 | run_flac --decode file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 363 | if [ $sector_align != sector_align ] ; then |
| 364 | for n in 0 1 2 ; do |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame^] | 365 | cmp file$n.wav file${n}x.wav || die "ERROR: file mismatch on file #$n" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 366 | done |
| 367 | fi |
| 368 | for n in 0 1 2 ; do |
| 369 | rm -f file${n}x.$suffix file${n}x.wav |
| 370 | done |
| 371 | } |
| 372 | |
| 373 | echo "Testing multiple files without verify..." |
| 374 | test_multifile flac no_sector_align "" |
| 375 | |
| 376 | echo "Testing multiple files with verify..." |
| 377 | test_multifile flac no_sector_align "--verify" |
| 378 | |
| 379 | echo "Testing multiple files with --sector-align, without verify..." |
| 380 | test_multifile flac sector_align "" |
| 381 | |
| 382 | echo "Testing multiple files with --sector-align, with verify..." |
| 383 | test_multifile flac sector_align "--verify" |
| 384 | |
| 385 | if [ $has_ogg = "yes" ] ; then |
| 386 | echo "Testing multiple files with --ogg, without verify..." |
| 387 | test_multifile ogg no_sector_align "" |
| 388 | |
| 389 | echo "Testing multiple files with --ogg, with verify..." |
| 390 | test_multifile ogg no_sector_align "--verify" |
| 391 | |
| 392 | echo "Testing multiple files with --ogg and --sector-align, without verify..." |
| 393 | test_multifile ogg sector_align "" |
| 394 | |
| 395 | echo "Testing multiple files with --ogg and --sector-align, with verify..." |
| 396 | test_multifile sector_align ogg "--verify" |
| 397 | |
| 398 | echo "Testing multiple files with --ogg and --serial-number, with verify..." |
| 399 | test_multifile ogg no_sector_align "--serial-number=321 --verify" |
| 400 | fi |