Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # FLAC - Free Lossless Audio Codec |
Josh Coalson | 0395dac | 2006-04-25 06:59:33 +0000 | [diff] [blame] | 4 | # Copyright (C) 2002,2003,2004,2005,2006 Josh Coalson |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 5 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 6 | # This file is part the FLAC project. FLAC is comprised of several |
| 7 | # components distributed under difference licenses. The codec libraries |
| 8 | # are distributed under Xiph.Org's BSD-like license (see the file |
| 9 | # COPYING.Xiph in this distribution). All other programs, libraries, and |
| 10 | # plugins are distributed under the GPL (see COPYING.GPL). The documentation |
| 11 | # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the |
| 12 | # FLAC distribution contains at the top the terms under which it may be |
| 13 | # distributed. |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 14 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 15 | # Since this particular file is relevant to all components of FLAC, |
| 16 | # it may be distributed under the Xiph.Org license, which is the least |
| 17 | # restrictive of those mentioned above. See the file COPYING.Xiph in this |
| 18 | # distribution. |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 19 | |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 20 | die () |
| 21 | { |
| 22 | echo $* 1>&2 |
| 23 | exit 1 |
| 24 | } |
| 25 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 26 | if [ x = x"$1" ] ; then |
Josh Coalson | b43d3cb | 2004-11-09 01:28:05 +0000 | [diff] [blame] | 27 | BUILD=debug |
| 28 | else |
| 29 | BUILD="$1" |
| 30 | fi |
| 31 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 32 | # change to 'false' to show all flac/metaflac output (useful for debugging) |
| 33 | if true ; then |
| 34 | SILENT='--silent' |
| 35 | TOTALLY_SILENT='--totally-silent' |
| 36 | else |
| 37 | SILENT='' |
| 38 | TOTALLY_SILENT='' |
| 39 | fi |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 40 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 41 | LD_LIBRARY_PATH=`pwd`/../src/libFLAC/.libs:$LD_LIBRARY_PATH |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 42 | LD_LIBRARY_PATH=`pwd`/../src/share/grabbag/.libs:$LD_LIBRARY_PATH |
| 43 | LD_LIBRARY_PATH=`pwd`/../src/share/getopt/.libs:$LD_LIBRARY_PATH |
| 44 | LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH |
| 45 | LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH |
| 46 | LD_LIBRARY_PATH=`pwd`/../src/share/utf8/.libs:$LD_LIBRARY_PATH |
| 47 | LD_LIBRARY_PATH=`pwd`/../obj/$BUILD/lib:$LD_LIBRARY_PATH |
| 48 | export LD_LIBRARY_PATH |
| 49 | PATH=`pwd`/../src/flac:$PATH |
| 50 | PATH=`pwd`/../src/metaflac:$PATH |
| 51 | PATH=`pwd`/../obj/$BUILD/bin:$PATH |
| 52 | |
| 53 | testdir="metaflac-test-files" |
| 54 | flacfile="metaflac.flac" |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 55 | |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 56 | flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" |
| 57 | metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 58 | |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 59 | run_flac () |
| 60 | { |
Josh Coalson | de9091e | 2006-05-25 02:48:22 +0000 | [diff] [blame] | 61 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Josh Coalson | 80936c5 | 2002-12-30 23:31:47 +0000 | [diff] [blame] | 62 | valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_metaflac.valgrind.log |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 63 | else |
| 64 | flac $* |
| 65 | fi |
| 66 | } |
| 67 | |
| 68 | run_metaflac () |
| 69 | { |
Josh Coalson | de9091e | 2006-05-25 02:48:22 +0000 | [diff] [blame] | 70 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Josh Coalson | 80936c5 | 2002-12-30 23:31:47 +0000 | [diff] [blame] | 71 | valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>test_metaflac.valgrind.log |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 72 | else |
| 73 | metaflac $* |
| 74 | fi |
| 75 | } |
Josh Coalson | 2858ff3 | 2002-10-11 06:22:43 +0000 | [diff] [blame] | 76 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 77 | run_metaflac_silent () |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 78 | { |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 79 | if [ -z "$SILENT" ] ; then |
| 80 | run_metaflac $* |
| 81 | else |
| 82 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
| 83 | valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 2>/dev/null 4>>test_metaflac.valgrind.log |
| 84 | else |
| 85 | metaflac $* 2>/dev/null |
| 86 | fi |
| 87 | fi |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | check_flac () |
| 91 | { |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 92 | run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2 |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 95 | echo "Generating stream..." |
| 96 | bytes=80000 |
| 97 | if dd if=/dev/zero ibs=1 count=$bytes | flac --force --verify -0 --input-size=$bytes --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=8000 - ; then |
| 98 | chmod +w $flacfile |
| 99 | else |
| 100 | die "ERROR during generation" |
| 101 | fi |
| 102 | |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 103 | check_flac |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 104 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 105 | echo |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 106 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 107 | filter () |
| 108 | { |
| 109 | # minor danger, changing vendor strings will change the length of the |
| 110 | # VORBIS_COMMENT block, but if we add "^ length: " to the patterns, |
| 111 | # we lose info about PADDING size that we need |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 112 | # grep pattern 1: remove vendor string |
| 113 | # grep pattern 2: remove minimum/maximum frame and block size from STREAMINFO |
| 114 | # grep pattern 3: remove hexdump data from PICTURE metadata blocks |
| 115 | # sed pattern 1: remove stream offset values from SEEKTABLE points |
| 116 | grep -Ev '^ vendor string: |^ m..imum .....size: |^ 0000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]: ' | sed -e 's/, stream_offset.*//' |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 117 | } |
| 118 | metaflac_test () |
| 119 | { |
| 120 | case="$1" |
| 121 | desc="$2" |
| 122 | args="$3" |
| 123 | expect="$testdir/$case-expect.meta" |
| 124 | echo -n "test $case: $desc... " |
| 125 | run_metaflac $args $flacfile | filter > $testdir/out.meta || die "ERROR running metaflac" |
| 126 | diff -q -w $expect $testdir/out.meta 2>/dev/null || die "ERROR: metadata does not match expected $expect" |
| 127 | echo OK |
| 128 | } |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 129 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 130 | metaflac_test case00 "--list" "--list" |
| 131 | |
| 132 | metaflac_test case01 "STREAMINFO --show-* shortcuts" " |
| 133 | --show-md5sum |
| 134 | --show-min-blocksize |
| 135 | --show-max-blocksize |
| 136 | --show-min-framesize |
| 137 | --show-max-framesize |
| 138 | --show-sample-rate |
| 139 | --show-channels |
| 140 | --show-bps |
| 141 | --show-total-samples" |
| 142 | |
| 143 | run_metaflac --preserve-modtime --add-padding=12345 $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 144 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 145 | metaflac_test case02 "--add-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 146 | |
Josh Coalson | c6ea43b | 2002-10-26 04:28:11 +0000 | [diff] [blame] | 147 | # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore: |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 148 | run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 149 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 150 | metaflac_test case03 "--set-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 151 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 152 | run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 153 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 154 | metaflac_test case04 "--set-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 155 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 156 | run_metaflac --set-tag="ARTIST=Vern" $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 157 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 158 | metaflac_test case05 "--set-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 159 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 160 | run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 161 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 162 | metaflac_test case06 "--set-tag=TITLE" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 163 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 164 | metaflac_test case07 "--show-vendor-tag --show-tag=ARTIST" "--show-vendor-tag --show-tag=ARTIST" |
Josh Coalson | c6ea43b | 2002-10-26 04:28:11 +0000 | [diff] [blame] | 165 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 166 | run_metaflac --remove-first-tag=ARTIST $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 167 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 168 | metaflac_test case08 "--remove-first-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 169 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 170 | run_metaflac --remove-tag=ARTIST $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 171 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 172 | metaflac_test case09 "--remove-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 173 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 174 | metaflac_test case10 "--list --block-type=VORBIS_COMMENT" "--list --block-type=VORBIS_COMMENT" |
| 175 | metaflac_test case11 "--list --block-number=0" "--list --block-number=0" |
| 176 | metaflac_test case12 "--list --block-number=1,2,999" "--list --block-number=1,2,999" |
| 177 | metaflac_test case13 "--list --block-type=VORBIS_COMMENT,PADDING" "--list --block-type=VORBIS_COMMENT,PADDING" |
| 178 | metaflac_test case14 "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" |
| 179 | metaflac_test case15 "--list --except-block-type=STREAMINFO" "--list --except-block-type=STREAMINFO" |
Josh Coalson | c6ea43b | 2002-10-26 04:28:11 +0000 | [diff] [blame] | 180 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 181 | run_metaflac --add-padding=4321 $flacfile $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 182 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 183 | metaflac_test case16 "--add-padding=4321 * 2" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 184 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 185 | run_metaflac --merge-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 186 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 187 | metaflac_test case17 "--merge-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 188 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 189 | run_metaflac --add-padding=0 $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 190 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 191 | metaflac_test case18 "--add-padding=0" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 192 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 193 | run_metaflac --sort-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 194 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 195 | metaflac_test case19 "--sort-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 196 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 197 | run_metaflac --add-padding=0 $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 198 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 199 | metaflac_test case20 "--add-padding=0" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 200 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 201 | run_metaflac --remove-all-tags $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 202 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 203 | metaflac_test case21 "--remove-all-tags" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 204 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 205 | run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 206 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 207 | metaflac_test case22 "--remove --block-number=1,99 --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 208 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 209 | run_metaflac --remove --block-number=99 --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 210 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 211 | metaflac_test case23 "--remove --block-number=99 --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 212 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 213 | run_metaflac --remove --block-type=PADDING $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 214 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 215 | metaflac_test case24 "--remove --block-type=PADDING" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 216 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 217 | run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 218 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 219 | metaflac_test case25 "--remove --block-type=PADDING --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 220 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 221 | run_metaflac --add-padding=0 $flacfile $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 222 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 223 | metaflac_test case26 "--add-padding=0 * 2" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 224 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 225 | run_metaflac --remove --except-block-type=PADDING $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 226 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 227 | metaflac_test case27 "--remove --except-block-type=PADDING" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 228 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 229 | run_metaflac --remove-all $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 230 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 231 | metaflac_test case28 "--remove-all" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 232 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 233 | run_metaflac --remove-all --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 234 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 235 | metaflac_test case29 "--remove-all --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 236 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 237 | run_metaflac --remove-all --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 238 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 239 | metaflac_test case30 "--remove-all --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 240 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 241 | run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 242 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 243 | metaflac_test case31 "--set-tag=..." "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 244 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 245 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 246 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 247 | metaflac_test case32 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 248 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 249 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 250 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 251 | metaflac_test case33 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 252 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 253 | run_metaflac --remove-all-tags --set-tag="f=0" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 254 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 255 | metaflac_test case34 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 256 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 257 | run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 258 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 259 | metaflac_test case35 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 260 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 261 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 262 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 263 | metaflac_test case36 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 264 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 265 | run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 266 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 267 | metaflac_test case37 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 268 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 269 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 270 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 271 | metaflac_test case38 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 272 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 273 | echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 274 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 275 | metaflac_test case39 "--import-tags-from=-" "--list" |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 276 | |
| 277 | cat > vc.txt << EOF |
| 278 | artist=Fartist |
| 279 | artist=artits |
| 280 | EOF |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 281 | run_metaflac --import-tags-from=vc.txt $flacfile |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 282 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 283 | metaflac_test case40 "--import-tags-from=[FILE]" "--list" |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 284 | |
| 285 | rm vc.txt |
| 286 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 287 | run_metaflac --add-replay-gain $flacfile |
| 288 | check_flac |
| 289 | metaflac_test case41 "--add-replay-gain" "--list" |
| 290 | |
| 291 | run_metaflac --remove-replay-gain $flacfile |
| 292 | check_flac |
| 293 | metaflac_test case42 "--remove-replay-gain" "--list" |
| 294 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 295 | # CUESHEET blocks |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 296 | cs_in=cuesheets/good.000.cue |
| 297 | cs_out=metaflac.cue |
| 298 | cs_out2=metaflac2.cue |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 299 | run_metaflac --import-cuesheet-from="$cs_in" $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 300 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 301 | metaflac_test case43 "--import-cuesheet-from" "--list" |
| 302 | run_metaflac --export-cuesheet-to=$cs_out $flacfile |
| 303 | run_metaflac --remove --block-type=CUESHEET $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 304 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 305 | metaflac_test case44 "--remove --block-type=CUESHEET" "--list" |
| 306 | run_metaflac --import-cuesheet-from=$cs_out $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 307 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 308 | metaflac_test case45 "--import-cuesheet-from" "--list" |
| 309 | run_metaflac --export-cuesheet-to=$cs_out2 $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 310 | echo "comparing cuesheets:" |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 311 | diff $cs_out $cs_out2 || die "ERROR, cuesheets should be identical" |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 312 | echo identical |
| 313 | |
| 314 | rm -f $cs_out $cs_out2 |
| 315 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 316 | # PICTURE blocks |
| 317 | ncase=46 |
| 318 | for f in \ |
| 319 | 0.gif \ |
| 320 | 1.gif \ |
| 321 | 2.gif \ |
| 322 | ; do |
| 323 | run_metaflac --import-picture="|image/gif|$f||pictures/$f" $flacfile |
| 324 | check_flac |
| 325 | metaflac_test "case$ncase" "--import-picture" "--list" |
| 326 | ncase=`expr $ncase + 1` |
| 327 | done |
| 328 | for f in \ |
| 329 | 0.jpg \ |
| 330 | 4.jpg \ |
| 331 | ; do |
| 332 | run_metaflac --import-picture="4|image/jpeg|$f||pictures/$f" $flacfile |
| 333 | check_flac |
| 334 | metaflac_test "case$ncase" "--import-picture" "--list" |
| 335 | ncase=`expr $ncase + 1` |
| 336 | done |
| 337 | for f in \ |
| 338 | 0.png \ |
| 339 | 1.png \ |
| 340 | 2.png \ |
| 341 | 3.png \ |
| 342 | 4.png \ |
| 343 | 5.png \ |
| 344 | 6.png \ |
| 345 | 7.png \ |
| 346 | 8.png \ |
| 347 | ; do |
| 348 | run_metaflac --import-picture="5|image/png|$f||pictures/$f" $flacfile |
| 349 | check_flac |
| 350 | metaflac_test "case$ncase" "--import-picture" "--list" |
| 351 | ncase=`expr $ncase + 1` |
| 352 | done |
Josh Coalson | a65fd93 | 2006-10-03 01:02:44 +0000 | [diff] [blame] | 353 | [ $ncase = 60 ] || die "expected case# to be 60" |
Josh Coalson | 989f267 | 2006-11-02 03:40:44 +0000 | [diff] [blame^] | 354 | |
| 355 | fn=export-picture-check |
| 356 | echo -n "Testing --export-picture-to... " |
| 357 | run_metaflac --export-picture-to=$fn $flacfile |
| 358 | check_flac |
| 359 | cmp $fn pictures/0.gif || die "ERROR, exported picture file and original differ" |
| 360 | echo OK |
| 361 | rm -f $fn |
| 362 | echo -n "Testing --block-number --export-picture-to... " |
| 363 | run_metaflac --block-number=9 --export-picture-to=$fn $flacfile |
| 364 | check_flac |
| 365 | cmp $fn pictures/0.png || die "ERROR, exported picture file and original differ" |
| 366 | echo OK |
| 367 | rm -f $fn |
| 368 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 369 | run_metaflac --remove --block-type=PICTURE $flacfile |
| 370 | check_flac |
| 371 | metaflac_test case60 "--remove --block-type=PICTURE" "--list" |
| 372 | run_metaflac --import-picture="1|image/png|standard_icon|32x32x24|pictures/0.png" $flacfile |
| 373 | check_flac |
| 374 | metaflac_test case61 "--import-picture" "--list" |
| 375 | run_metaflac --import-picture="2|image/png|icon|64x64x24|pictures/1.png" $flacfile |
| 376 | check_flac |
| 377 | metaflac_test case62 "--import-picture" "--list" |
| 378 | |
| 379 | # UNKNOWN blocks |
Josh Coalson | 6b4dfd0 | 2003-01-11 06:23:16 +0000 | [diff] [blame] | 380 | echo -n "Testing FLAC file with unknown metadata... " |
| 381 | cp -p metaflac.flac.in $flacfile |
Josh Coalson | 43bb14d | 2003-01-16 07:21:20 +0000 | [diff] [blame] | 382 | # remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison: |
| 383 | run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile |
Josh Coalson | 6b4dfd0 | 2003-01-11 06:23:16 +0000 | [diff] [blame] | 384 | cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ" |
| 385 | echo OK |
| 386 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 387 | rm -f $testdir/out.flac $testdir/out.meta |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 388 | |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 389 | exit 0 |