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 | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 55 | # first make some chopped-up raw 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 | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 67 | wav_eopt="--silent --verify --lax" |
| 68 | wav_dopt="--silent --decode" |
| 69 | |
| 70 | raw_eopt="$wav_eopt --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1" |
| 71 | raw_dopt="$wav_dopt --force-raw-format --endian=big --sign=signed" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 72 | |
| 73 | # |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 74 | # convert them to WAVE files |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 75 | # |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 76 | convert_to_wav () |
| 77 | { |
| 78 | run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to WAVE" |
| 79 | run_flac $wav_dopt $1.flac || die "ERROR converting $1.raw to WAVE" |
| 80 | } |
| 81 | convert_to_wav 50c |
| 82 | convert_to_wav 50c.skip10 |
| 83 | convert_to_wav 50c.skip11 |
| 84 | convert_to_wav 50c.until40 |
| 85 | convert_to_wav 50c.until39 |
| 86 | convert_to_wav 50c.skip10.until40 |
| 87 | convert_to_wav 50c.skip10.until39 |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 88 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 89 | test_skip_until () |
| 90 | { |
| 91 | fmt=$1 |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 92 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 93 | [ $fmt = wav ] || [ $fmt = raw ] || die "ERROR: internal error, bad format '$fmt'" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 94 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 95 | if [ $fmt = raw ] ; then |
| 96 | eopt="$raw_eopt" |
| 97 | dopt="$raw_dopt" |
| 98 | else |
| 99 | eopt="$wav_eopt" |
| 100 | dopt="$wav_dopt" |
| 101 | fi |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 102 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 103 | # |
| 104 | # test --skip when encoding |
| 105 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 106 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 107 | echo -n "testing --skip=# (encode) ($fmt)... " |
| 108 | run_flac $eopt --skip=10 -o z50c.skip10.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 109 | run_flac $dopt -o z50c.skip10.$fmt z50c.skip10.flac || die "ERROR decoding FLAC file ($fmt)" |
| 110 | cmp 50c.skip10.$fmt z50c.skip10.$fmt || die "ERROR: file mismatch for --skip=10 (encode) ($fmt)" |
| 111 | rm -f z50c.skip10.flac z50c.skip10.$fmt |
| 112 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 113 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 114 | echo -n "testing --skip=mm:ss (encode) ($fmt)... " |
| 115 | run_flac $eopt --skip=0:01 -o z50c.skip0:01.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 116 | run_flac $dopt -o z50c.skip0:01.$fmt z50c.skip0:01.flac || die "ERROR decoding FLAC file ($fmt)" |
| 117 | cmp 50c.skip10.$fmt z50c.skip0:01.$fmt || die "ERROR: file mismatch for --skip=0:01 (encode) ($fmt)" |
| 118 | rm -f z50c.skip0:01.flac z50c.skip0:01.$fmt |
| 119 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 120 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 121 | echo -n "testing --skip=mm:ss.sss (encode) ($fmt)... " |
| 122 | run_flac $eopt --skip=0:01.1001 -o z50c.skip0:01.1001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 123 | run_flac $dopt -o z50c.skip0:01.1001.$fmt z50c.skip0:01.1001.flac || die "ERROR decoding FLAC file ($fmt)" |
| 124 | cmp 50c.skip11.$fmt z50c.skip0:01.1001.$fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) ($fmt)" |
| 125 | rm -f z50c.skip0:01.1001.flac z50c.skip0:01.1001.$fmt |
| 126 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 127 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 128 | # |
| 129 | # test --skip when decoding |
| 130 | # |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 131 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 132 | echo -n "testing --skip=# (decode) ($fmt)... " |
| 133 | run_flac $eopt -o z50c.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 134 | run_flac $dopt --skip=10 -o z50c.skip10.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 135 | cmp 50c.skip10.$fmt z50c.skip10.$fmt || die "ERROR: file mismatch for --skip=10 (decode) ($fmt)" |
| 136 | rm -f z50c.skip10.$fmt |
| 137 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 138 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 139 | echo -n "testing --skip=mm:ss (decode) ($fmt)... " |
| 140 | run_flac $dopt --skip=0:01 -o z50c.skip0:01.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 141 | cmp 50c.skip10.$fmt z50c.skip0:01.$fmt || die "ERROR: file mismatch for --skip=0:01 (decode) ($fmt)" |
| 142 | rm -f z50c.skip0:01.$fmt |
| 143 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 144 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 145 | echo -n "testing --skip=mm:ss.sss (decode) ($fmt)... " |
| 146 | run_flac $dopt --skip=0:01.1001 -o z50c.skip0:01.1001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 147 | cmp 50c.skip11.$fmt z50c.skip0:01.1001.$fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) ($fmt)" |
| 148 | rm -f z50c.skip0:01.1001.$fmt |
| 149 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 150 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 151 | rm -f z50c.flac |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 152 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 153 | # |
| 154 | # test --until when encoding |
| 155 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 156 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 157 | echo -n "testing --until=# (encode) ($fmt)... " |
| 158 | run_flac $eopt --until=40 -o z50c.until40.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 159 | run_flac $dopt -o z50c.until40.$fmt z50c.until40.flac || die "ERROR decoding FLAC file ($fmt)" |
| 160 | cmp 50c.until40.$fmt z50c.until40.$fmt || die "ERROR: file mismatch for --until=40 (encode) ($fmt)" |
| 161 | rm -f z50c.until40.flac z50c.until40.$fmt |
| 162 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 163 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 164 | echo -n "testing --until=mm:ss (encode) ($fmt)... " |
| 165 | run_flac $eopt --until=0:04 -o z50c.until0:04.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 166 | run_flac $dopt -o z50c.until0:04.$fmt z50c.until0:04.flac || die "ERROR decoding FLAC file ($fmt)" |
| 167 | cmp 50c.until40.$fmt z50c.until0:04.$fmt || die "ERROR: file mismatch for --until=0:04 (encode) ($fmt)" |
| 168 | rm -f z50c.until0:04.flac z50c.until0:04.$fmt |
| 169 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 170 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 171 | echo -n "testing --until=mm:ss.sss (encode) ($fmt)... " |
| 172 | run_flac $eopt --until=0:03.9001 -o z50c.until0:03.9001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 173 | run_flac $dopt -o z50c.until0:03.9001.$fmt z50c.until0:03.9001.flac || die "ERROR decoding FLAC file ($fmt)" |
| 174 | cmp 50c.until39.$fmt z50c.until0:03.9001.$fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) ($fmt)" |
| 175 | rm -f z50c.until0:03.9001.flac z50c.until0:03.9001.$fmt |
| 176 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 177 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 178 | echo -n "testing --until=-# (encode) ($fmt)... " |
| 179 | run_flac $eopt --until=-10 -o z50c.until-10.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 180 | run_flac $dopt -o z50c.until-10.$fmt z50c.until-10.flac || die "ERROR decoding FLAC file ($fmt)" |
| 181 | cmp 50c.until40.$fmt z50c.until-10.$fmt || die "ERROR: file mismatch for --until=-10 (encode) ($fmt)" |
| 182 | rm -f z50c.until-10.flac z50c.until-10.$fmt |
| 183 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 184 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 185 | echo -n "testing --until=-mm:ss (encode) ($fmt)... " |
| 186 | run_flac $eopt --until=-0:01 -o z50c.until-0:01.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 187 | run_flac $dopt -o z50c.until-0:01.$fmt z50c.until-0:01.flac || die "ERROR decoding FLAC file ($fmt)" |
| 188 | cmp 50c.until40.$fmt z50c.until-0:01.$fmt || die "ERROR: file mismatch for --until=-0:01 (encode) ($fmt)" |
| 189 | rm -f z50c.until-0:01.flac z50c.until-0:01.$fmt |
| 190 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 191 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 192 | echo -n "testing --until=-mm:ss.sss (encode) ($fmt)... " |
| 193 | run_flac $eopt --until=-0:01.1001 -o z50c.until-0:01.1001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 194 | run_flac $dopt -o z50c.until-0:01.1001.$fmt z50c.until-0:01.1001.flac || die "ERROR decoding FLAC file ($fmt)" |
| 195 | cmp 50c.until39.$fmt z50c.until-0:01.1001.$fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) ($fmt)" |
| 196 | rm -f z50c.until-0:01.1001.flac z50c.until-0:01.1001.$fmt |
| 197 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 198 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 199 | # |
| 200 | # test --until when decoding |
| 201 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 202 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 203 | run_flac $eopt -o z50c.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 204 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 205 | echo -n "testing --until=# (decode) ($fmt)... " |
| 206 | run_flac $dopt --until=40 -o z50c.until40.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 207 | cmp 50c.until40.$fmt z50c.until40.$fmt || die "ERROR: file mismatch for --until=40 (decode) ($fmt)" |
| 208 | rm -f z50c.until40.$fmt |
| 209 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 210 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 211 | echo -n "testing --until=mm:ss (decode) ($fmt)... " |
| 212 | run_flac $dopt --until=0:04 -o z50c.until0:04.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 213 | cmp 50c.until40.$fmt z50c.until0:04.$fmt || die "ERROR: file mismatch for --until=0:04 (decode) ($fmt)" |
| 214 | rm -f z50c.until0:04.$fmt |
| 215 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 216 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 217 | echo -n "testing --until=mm:ss.sss (decode) ($fmt)... " |
| 218 | run_flac $dopt --until=0:03.9001 -o z50c.until0:03.9001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 219 | cmp 50c.until39.$fmt z50c.until0:03.9001.$fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) ($fmt)" |
| 220 | rm -f z50c.until0:03.9001.$fmt |
| 221 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 222 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 223 | echo -n "testing --until=-# (decode) ($fmt)... " |
| 224 | run_flac $dopt --until=-10 -o z50c.until-10.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 225 | cmp 50c.until40.$fmt z50c.until-10.$fmt || die "ERROR: file mismatch for --until=-10 (decode) ($fmt)" |
| 226 | rm -f z50c.until-10.$fmt |
| 227 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 228 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 229 | echo -n "testing --until=-mm:ss (decode) ($fmt)... " |
| 230 | run_flac $dopt --until=-0:01 -o z50c.until-0:01.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 231 | cmp 50c.until40.$fmt z50c.until-0:01.$fmt || die "ERROR: file mismatch for --until=-0:01 (decode) ($fmt)" |
| 232 | rm -f z50c.until-0:01.$fmt |
| 233 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 234 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 235 | echo -n "testing --until=-mm:ss.sss (decode) ($fmt)... " |
| 236 | run_flac $dopt --until=-0:01.1001 -o z50c.until-0:01.1001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 237 | cmp 50c.until39.$fmt z50c.until-0:01.1001.$fmt || die "ERROR: file mismatch for --until=-0:01.1001 (decode) ($fmt)" |
| 238 | rm -f z50c.until-0:01.1001.$fmt |
| 239 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 240 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 241 | rm -f z50c.flac |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 242 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 243 | # |
| 244 | # test --skip and --until when encoding |
| 245 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 246 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 247 | echo -n "testing --skip=10 --until=# (encode) ($fmt)... " |
| 248 | run_flac $eopt --skip=10 --until=40 -o z50c.skip10.until40.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 249 | run_flac $dopt -o z50c.skip10.until40.$fmt z50c.skip10.until40.flac || die "ERROR decoding FLAC file ($fmt)" |
| 250 | cmp 50c.skip10.until40.$fmt z50c.skip10.until40.$fmt || die "ERROR: file mismatch for --skip=10 --until=40 (encode) ($fmt)" |
| 251 | rm -f z50c.skip10.until40.flac z50c.skip10.until40.$fmt |
| 252 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 253 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 254 | echo -n "testing --skip=10 --until=mm:ss (encode) ($fmt)... " |
| 255 | run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 256 | run_flac $dopt -o z50c.skip10.until0:04.$fmt z50c.skip10.until0:04.flac || die "ERROR decoding FLAC file ($fmt)" |
| 257 | cmp 50c.skip10.until40.$fmt z50c.skip10.until0:04.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) ($fmt)" |
| 258 | rm -f z50c.skip10.until0:04.flac z50c.skip10.until0:04.$fmt |
| 259 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 260 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 261 | echo -n "testing --skip=10 --until=mm:ss.sss (encode) ($fmt)... " |
| 262 | run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 263 | run_flac $dopt -o z50c.skip10.until0:03.9001.$fmt z50c.skip10.until0:03.9001.flac || die "ERROR decoding FLAC file ($fmt)" |
| 264 | cmp 50c.skip10.until39.$fmt z50c.skip10.until0:03.9001.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode) ($fmt)" |
| 265 | rm -f z50c.skip10.until0:03.9001.flac z50c.skip10.until0:03.9001.$fmt |
| 266 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 267 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 268 | echo -n "testing --skip=10 --until=+# (encode) ($fmt)... " |
| 269 | run_flac $eopt --skip=10 --until=+30 -o z50c.skip10.until+30.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 270 | run_flac $dopt -o z50c.skip10.until+30.$fmt z50c.skip10.until+30.flac || die "ERROR decoding FLAC file ($fmt)" |
| 271 | cmp 50c.skip10.until40.$fmt z50c.skip10.until+30.$fmt || die "ERROR: file mismatch for --skip=10 --until=+30 (encode) ($fmt)" |
| 272 | rm -f z50c.skip10.until+30.flac z50c.skip10.until+30.$fmt |
| 273 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 274 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 275 | echo -n "testing --skip=10 --until=+mm:ss (encode) ($fmt)... " |
| 276 | run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0:03.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 277 | run_flac $dopt -o z50c.skip10.until+0:03.$fmt z50c.skip10.until+0:03.flac || die "ERROR decoding FLAC file ($fmt)" |
| 278 | cmp 50c.skip10.until40.$fmt z50c.skip10.until+0:03.$fmt || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode) ($fmt)" |
| 279 | rm -f z50c.skip10.until+0:03.flac z50c.skip10.until+0:03.$fmt |
| 280 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 281 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 282 | echo -n "testing --skip=10 --until=+mm:ss.sss (encode) ($fmt)... " |
| 283 | run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0:02.9001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 284 | run_flac $dopt -o z50c.skip10.until+0:02.9001.$fmt z50c.skip10.until+0:02.9001.flac || die "ERROR decoding FLAC file ($fmt)" |
| 285 | cmp 50c.skip10.until39.$fmt z50c.skip10.until+0:02.9001.$fmt || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode) ($fmt)" |
| 286 | rm -f z50c.skip10.until+0:02.9001.flac z50c.skip10.until+0:02.9001.$fmt |
| 287 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 288 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 289 | echo -n "testing --skip=10 --until=-# (encode) ($fmt)... " |
| 290 | run_flac $eopt --skip=10 --until=-10 -o z50c.skip10.until-10.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 291 | run_flac $dopt -o z50c.skip10.until-10.$fmt z50c.skip10.until-10.flac || die "ERROR decoding FLAC file ($fmt)" |
| 292 | cmp 50c.skip10.until40.$fmt z50c.skip10.until-10.$fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (encode) ($fmt)" |
| 293 | rm -f z50c.skip10.until-10.flac z50c.skip10.until-10.$fmt |
| 294 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 295 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 296 | echo -n "testing --skip=10 --until=-mm:ss (encode) ($fmt)... " |
| 297 | run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 298 | run_flac $dopt -o z50c.skip10.until-0:01.$fmt z50c.skip10.until-0:01.flac || die "ERROR decoding FLAC file ($fmt)" |
| 299 | cmp 50c.skip10.until40.$fmt z50c.skip10.until-0:01.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode) ($fmt)" |
| 300 | rm -f z50c.skip10.until-0:01.flac z50c.skip10.until-0:01.$fmt |
| 301 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 302 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 303 | echo -n "testing --skip=10 --until=-mm:ss.sss (encode) ($fmt)... " |
| 304 | run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
| 305 | run_flac $dopt -o z50c.skip10.until-0:01.1001.$fmt z50c.skip10.until-0:01.1001.flac || die "ERROR decoding FLAC file ($fmt)" |
| 306 | cmp 50c.skip10.until39.$fmt z50c.skip10.until-0:01.1001.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode) ($fmt)" |
| 307 | rm -f z50c.skip10.until-0:01.1001.flac z50c.skip10.until-0:01.1001.$fmt |
| 308 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 309 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 310 | # |
| 311 | # test --skip and --until when decoding |
| 312 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 313 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 314 | run_flac $eopt -o z50c.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 315 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 316 | echo -n "testing --skip=10 --until=# (decode) ($fmt)... " |
| 317 | run_flac $dopt --skip=10 --until=40 -o z50c.skip10.until40.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 318 | cmp 50c.skip10.until40.$fmt z50c.skip10.until40.$fmt || die "ERROR: file mismatch for --skip=10 --until=40 (decode) ($fmt)" |
| 319 | rm -f z50c.skip10.until40.$fmt |
| 320 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 321 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 322 | echo -n "testing --skip=10 --until=mm:ss (decode) ($fmt)... " |
| 323 | run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 324 | cmp 50c.skip10.until40.$fmt z50c.skip10.until0:04.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) ($fmt)" |
| 325 | rm -f z50c.skip10.until0:04.$fmt |
| 326 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 327 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 328 | echo -n "testing --skip=10 --until=mm:ss.sss (decode) ($fmt)... " |
| 329 | run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 330 | cmp 50c.skip10.until39.$fmt z50c.skip10.until0:03.9001.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode) ($fmt)" |
| 331 | rm -f z50c.skip10.until0:03.9001.$fmt |
| 332 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 333 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame^] | 334 | echo -n "testing --skip=10 --until=-# (decode) ($fmt)... " |
| 335 | run_flac $dopt --skip=10 --until=-10 -o z50c.skip10.until-10.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 336 | cmp 50c.skip10.until40.$fmt z50c.skip10.until-10.$fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (decode) ($fmt)" |
| 337 | rm -f z50c.skip10.until-10.$fmt |
| 338 | echo OK |
| 339 | |
| 340 | echo -n "testing --skip=10 --until=-mm:ss (decode) ($fmt)... " |
| 341 | run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 342 | cmp 50c.skip10.until40.$fmt z50c.skip10.until-0:01.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode) ($fmt)" |
| 343 | rm -f z50c.skip10.until-0:01.$fmt |
| 344 | echo OK |
| 345 | |
| 346 | echo -n "testing --skip=10 --until=-mm:ss.sss (decode) ($fmt)... " |
| 347 | run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)" |
| 348 | cmp 50c.skip10.until39.$fmt z50c.skip10.until-0:01.1001.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode) ($fmt)" |
| 349 | rm -f z50c.skip10.until-0:01.1001.$fmt |
| 350 | echo OK |
| 351 | |
| 352 | rm -f z50c.flac |
| 353 | } |
| 354 | |
| 355 | test_skip_until raw |
| 356 | test_skip_until wav |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 357 | |
| 358 | # |
| 359 | # multi-file tests |
| 360 | # |
| 361 | |
| 362 | echo "Generating streams..." |
| 363 | if [ ! -f wacky1.wav ] ; then |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 364 | test_streams || die "ERROR during test_streams" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 365 | fi |
| 366 | |
| 367 | echo "Generating multiple input files from noise..." |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 368 | 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" |
| 369 | run_flac --decode --silent noise.flac || die "ERROR generating WAVE file" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 370 | rm -f noise.flac |
| 371 | mv noise.wav file0.wav |
| 372 | cp file0.wav file1.wav |
| 373 | cp file1.wav file2.wav |
| 374 | |
| 375 | test_multifile () |
| 376 | { |
| 377 | streamtype=$1 |
| 378 | sector_align=$2 |
| 379 | encode_options="$3" |
| 380 | |
| 381 | if [ $streamtype = ogg ] ; then |
| 382 | suffix=ogg |
| 383 | encode_options="$encode_options --ogg" |
| 384 | else |
| 385 | suffix=flac |
| 386 | fi |
| 387 | |
| 388 | if [ $sector_align = sector_align ] ; then |
| 389 | encode_options="$encode_options --sector-align" |
| 390 | fi |
| 391 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 392 | run_flac $encode_options file0.wav file1.wav file2.wav || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 393 | for n in 0 1 2 ; do |
| 394 | mv file$n.$suffix file${n}x.$suffix |
| 395 | done |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 396 | run_flac --decode file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 397 | if [ $sector_align != sector_align ] ; then |
| 398 | for n in 0 1 2 ; do |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 399 | 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] | 400 | done |
| 401 | fi |
| 402 | for n in 0 1 2 ; do |
| 403 | rm -f file${n}x.$suffix file${n}x.wav |
| 404 | done |
| 405 | } |
| 406 | |
| 407 | echo "Testing multiple files without verify..." |
| 408 | test_multifile flac no_sector_align "" |
| 409 | |
| 410 | echo "Testing multiple files with verify..." |
| 411 | test_multifile flac no_sector_align "--verify" |
| 412 | |
| 413 | echo "Testing multiple files with --sector-align, without verify..." |
| 414 | test_multifile flac sector_align "" |
| 415 | |
| 416 | echo "Testing multiple files with --sector-align, with verify..." |
| 417 | test_multifile flac sector_align "--verify" |
| 418 | |
| 419 | if [ $has_ogg = "yes" ] ; then |
| 420 | echo "Testing multiple files with --ogg, without verify..." |
| 421 | test_multifile ogg no_sector_align "" |
| 422 | |
| 423 | echo "Testing multiple files with --ogg, with verify..." |
| 424 | test_multifile ogg no_sector_align "--verify" |
| 425 | |
| 426 | echo "Testing multiple files with --ogg and --sector-align, without verify..." |
| 427 | test_multifile ogg sector_align "" |
| 428 | |
| 429 | echo "Testing multiple files with --ogg and --sector-align, with verify..." |
| 430 | test_multifile sector_align ogg "--verify" |
| 431 | |
| 432 | echo "Testing multiple files with --ogg and --serial-number, with verify..." |
| 433 | test_multifile ogg no_sector_align "--serial-number=321 --verify" |
| 434 | fi |