Another windows utf8 I/O patch from Janne Hyvärinen <cse@sci.fi>.
[platform/upstream/flac.git] / test / test_flac.sh
index 94f6852..10981c0 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #  FLAC - Free Lossless Audio Codec
-#  Copyright (C) 2001,2002,2003,2004,2005,2006  Josh Coalson
+#  Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009  Josh Coalson
 #
 #  This file is part the FLAC project.  FLAC is comprised of several
 #  components distributed under difference licenses.  The codec libraries
 #  restrictive of those mentioned above.  See the file COPYING.Xiph in this
 #  distribution.
 
+# we use '.' as decimal separator in --skip/--until tests
+export LANG=C LC_ALL=C
+
 die ()
 {
        echo $* 1>&2
        exit 1
 }
 
+dddie="die ERROR: creating files with dd"
+
 if [ x = x"$1" ] ; then
        BUILD=debug
 else
@@ -44,19 +49,22 @@ LD_LIBRARY_PATH=`pwd`/../src/share/getopt/.libs:$LD_LIBRARY_PATH
 LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
 LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH
 LD_LIBRARY_PATH=`pwd`/../src/share/utf8/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=`pwd`/../obj/$BUILD/lib:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../objs/$BUILD/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
+export MALLOC_CHECK_=3
+export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
 PATH=`pwd`/../src/flac:$PATH
 PATH=`pwd`/../src/metaflac:$PATH
 PATH=`pwd`/../src/test_streams:$PATH
-PATH=`pwd`/../obj/$BUILD/bin:$PATH
+PATH=`pwd`/../objs/$BUILD/bin:$PATH
 
 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
 
 run_flac ()
 {
        if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
-               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_flac.valgrind.log
+               echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_flac.valgrind.log
+               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 flac $* 4>>test_flac.valgrind.log
        else
                flac $*
        fi
@@ -65,7 +73,8 @@ run_flac ()
 run_metaflac ()
 {
        if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
-               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>test_flac.valgrind.log
+               echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 metaflac $*" >>test_flac.valgrind.log
+               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 metaflac $* 4>>test_flac.valgrind.log
        else
                metaflac $*
        fi
@@ -135,18 +144,57 @@ fi
 rm -f exist.wav exist.flac
 
 ############################################################################
+# test fractional block sizes
+############################################################################
+
+test_fractional ()
+{
+       blocksize=$1
+       samples=$2
+       dd if=noise.raw ibs=4 count=$samples of=pbs.raw 2>/dev/null || $dddie
+       echo -n "fractional block size test (blocksize=$blocksize samples=$samples) encode... "
+       run_flac $SILENT --force --verify --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=$blocksize --no-padding --lax -o pbs.flac pbs.raw || die "ERROR"
+       echo -n "decode... "
+       run_flac $SILENT --force --decode --force-raw-format --endian=little --sign=signed -o pbs.cmp pbs.flac || die "ERROR"
+       echo -n "compare... "
+       cmp pbs.raw pbs.cmp || die "ERROR: file mismatch"
+       echo "OK"
+       rm -f pbs.raw pbs.flac pbs.cmp
+}
+
+# The special significance of 2048 is it's the # of samples that flac calls
+# FLAC__stream_encoder_process() on.
+#
+# We're trying to make sure the 1-sample overread logic in the stream encoder
+# (used for last-block checking) works; these values probe around common
+# multiples of the flac sample chunk size (2048) and the blocksize.
+for samples in 31 32 33 34 35 2046 2047 2048 2049 2050 ; do
+       test_fractional 33 $samples
+done
+for samples in 254 255 256 257 258 510 511 512 513 514 1022 1023 1024 1025 1026 2046 2047 2048 2049 2050 4094 4095 4096 4097 4098 ; do
+       test_fractional 256 $samples
+done
+for samples in 1022 1023 1024 1025 1026 2046 2047 2048 2049 2050 4094 4095 4096 4097 4098 ; do
+       test_fractional 2048 $samples
+done
+for samples in 1022 1023 1024 1025 1026 2046 2047 2048 2049 2050 4094 4095 4096 4097 4098 4606 4607 4608 4609 4610 8190 8191 8192 8193 8194 16382 16383 16384 16385 16386 ; do
+       test_fractional 4608 $samples
+done
+
+############################################################################
 # basic 'round-trip' tests of various kinds of streams
 ############################################################################
 
 rt_test_raw ()
 {
        f="$1"
+       extra="$2"
        channels=`echo $f | awk -F- '{print $2}'`
        bps=`echo $f | awk -F- '{print $3}'`
        echo -n "round-trip test ($f) encode... "
-       run_flac $SILENT --force --verify --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels --lax -o rt.flac $f || die "ERROR"
+       run_flac $SILENT --force --verify --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels --no-padding --lax -o rt.flac $extra $f || die "ERROR"
        echo -n "decode... "
-       run_flac $SILENT --force --decode --force-raw-format --endian=little --sign=signed -o rt.raw rt.flac || die "ERROR"
+       run_flac $SILENT --force --decode --force-raw-format --endian=little --sign=signed -o rt.raw $extra rt.flac || die "ERROR"
        echo -n "compare... "
        cmp $f rt.raw || die "ERROR: file mismatch"
        echo "OK"
@@ -156,23 +204,53 @@ rt_test_raw ()
 rt_test_wav ()
 {
        f="$1"
+       extra="$2"
        echo -n "round-trip test ($f) encode... "
-       run_flac $SILENT --force --verify --channel-map=none --lax -o rt.flac $f || die "ERROR"
+       run_flac $SILENT --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR"
        echo -n "decode... "
-       run_flac $SILENT --force --decode --channel-map=none -o rt.wav rt.flac || die "ERROR"
+       run_flac $SILENT --force --decode --channel-map=none -o rt.wav $extra rt.flac || die "ERROR"
        echo -n "compare... "
        cmp $f rt.wav || die "ERROR: file mismatch"
        echo "OK"
        rm -f rt.flac rt.wav
 }
 
+rt_test_w64 ()
+{
+       f="$1"
+       extra="$2"
+       echo -n "round-trip test ($f) encode... "
+       run_flac $SILENT --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR"
+       echo -n "decode... "
+       run_flac $SILENT --force --decode --channel-map=none -o rt.w64 $extra rt.flac || die "ERROR"
+       echo -n "compare... "
+       cmp $f rt.w64 || die "ERROR: file mismatch"
+       echo "OK"
+       rm -f rt.flac rt.w64
+}
+
+rt_test_rf64 ()
+{
+       f="$1"
+       extra="$2"
+       echo -n "round-trip test ($f) encode... "
+       run_flac $SILENT --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR"
+       echo -n "decode... "
+       run_flac $SILENT --force --decode --channel-map=none -o rt.rf64 $extra rt.flac || die "ERROR"
+       echo -n "compare... "
+       cmp $f rt.rf64 || die "ERROR: file mismatch"
+       echo "OK"
+       rm -f rt.flac rt.rf64
+}
+
 rt_test_aiff ()
 {
        f="$1"
+       extra="$2"
        echo -n "round-trip test ($f) encode... "
-       run_flac $SILENT --force --verify --channel-map=none --lax -o rt.flac $f || die "ERROR"
+       run_flac $SILENT --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR"
        echo -n "decode... "
-       run_flac $SILENT --force --decode --channel-map=none -o rt.aiff rt.flac || die "ERROR"
+       run_flac $SILENT --force --decode --channel-map=none -o rt.aiff $extra rt.flac || die "ERROR"
        echo -n "compare... "
        cmp $f rt.aiff || die "ERROR: file mismatch"
        echo "OK"
@@ -183,30 +261,59 @@ rt_test_aiff ()
 rt_test_flac ()
 {
        f="$1"
+       extra="$2"
        echo -n "round-trip test ($f->flac->flac->wav) encode... "
-       run_flac $SILENT --force --verify --channel-map=none --lax -o rt.flac $f || die "ERROR"
+       run_flac $SILENT --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR"
        echo -n "re-encode... "
        run_flac $SILENT --force --verify --lax -o rt2.flac rt.flac || die "ERROR"
        echo -n "decode... "
-       run_flac $SILENT --force --decode --channel-map=none -o rt.wav rt2.flac || die "ERROR"
+       run_flac $SILENT --force --decode --channel-map=none -o rt.wav $extra rt2.flac || die "ERROR"
        echo -n "compare... "
        cmp $f rt.wav || die "ERROR: file mismatch"
        echo "OK"
        rm -f rt.wav rt.flac rt2.flac
 }
 
+# assumes input file is WAVE; does not check the metadata-preserving features of flac-to-flac; that is checked later
+rt_test_ogg_flac ()
+{
+       f="$1"
+       extra="$2"
+       echo -n "round-trip test ($f->oggflac->oggflac->wav) encode... "
+       run_flac $SILENT --force --verify --channel-map=none --no-padding --lax -o rt.oga --ogg $extra $f || die "ERROR"
+       echo -n "re-encode... "
+       run_flac $SILENT --force --verify --lax -o rt2.oga --ogg rt.oga || die "ERROR"
+       echo -n "decode... "
+       run_flac $SILENT --force --decode --channel-map=none -o rt.wav $extra rt2.oga || die "ERROR"
+       echo -n "compare... "
+       cmp $f rt.wav || die "ERROR: file mismatch"
+       echo "OK"
+       rm -f rt.wav rt.oga rt2.oga
+}
+
 for f in rt-*.raw ; do
        rt_test_raw $f
 done
 for f in rt-*.wav ; do
        rt_test_wav $f
 done
+for f in rt-*.w64 ; do
+       rt_test_w64 $f
+done
+for f in rt-*.rf64 ; do
+       rt_test_rf64 $f
+done
 for f in rt-*.aiff ; do
        rt_test_aiff $f
 done
 for f in rt-*.wav ; do
        rt_test_flac $f
 done
+if [ $has_ogg = yes ] ; then
+       for f in rt-*.wav ; do
+               rt_test_ogg_flac $f
+       done
+fi
 
 ############################################################################
 # test --skip and --until
@@ -216,7 +323,6 @@ done
 # first make some chopped-up raw files
 #
 echo "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN" > master.raw
-dddie="die ERROR: creating files with dd"
 dd if=master.raw ibs=1 count=50 of=50c.raw 2>/dev/null || $dddie
 dd if=master.raw ibs=1 skip=10 count=40 of=50c.skip10.raw 2>/dev/null || $dddie
 dd if=master.raw ibs=1 skip=11 count=39 of=50c.skip11.raw 2>/dev/null || $dddie
@@ -234,14 +340,14 @@ dd if=master.raw ibs=1 skip=10 count=30 of=50c.skip10.until40.raw 2>/dev/null ||
 dd if=master.raw ibs=1 skip=20 count=10 of=50c.skip20.until30.raw 2>/dev/null || $dddie
 dd if=master.raw ibs=1 skip=20 count=20 of=50c.skip20.until40.raw 2>/dev/null || $dddie
 
-wav_eopt="$SILENT --force --verify --lax"
+wav_eopt="$SILENT --force --verify --no-padding --lax"
 wav_dopt="$SILENT --force --decode"
 
 raw_eopt="$wav_eopt --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1"
 raw_dopt="$wav_dopt --force-raw-format --endian=big --sign=signed"
 
 #
-# convert them to WAVE and AIFF files
+# convert them to WAVE/AIFF/Ogg FLAC files
 #
 convert_to_wav ()
 {
@@ -287,12 +393,35 @@ convert_to_aiff 50c.skip10.until40 "$raw_eopt" "$wav_dopt"
 convert_to_aiff 50c.skip20.until30 "$raw_eopt" "$wav_dopt"
 convert_to_aiff 50c.skip20.until40 "$raw_eopt" "$wav_dopt"
 
+convert_to_ogg ()
+{
+       run_flac "$wav_eopt" --ogg $1.wav || die "ERROR converting $1.raw to Ogg FLAC"
+}
+if [ $has_ogg = yes ] ; then
+       convert_to_ogg 50c
+       convert_to_ogg 50c.skip10
+       convert_to_ogg 50c.skip11
+       convert_to_ogg 50c.skip20
+       convert_to_ogg 50c.skip30
+       convert_to_ogg 50c.skip40
+       convert_to_ogg 50c.until10
+       convert_to_ogg 50c.until20
+       convert_to_ogg 50c.until30
+       convert_to_ogg 50c.until39
+       convert_to_ogg 50c.until40
+       convert_to_ogg 50c.skip10.until30
+       convert_to_ogg 50c.skip10.until39
+       convert_to_ogg 50c.skip10.until40
+       convert_to_ogg 50c.skip20.until30
+       convert_to_ogg 50c.skip20.until40
+fi
+
 test_skip_until ()
 {
        in_fmt=$1
        out_fmt=$2
 
-       [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || [ "$in_fmt" = flac ] || die "ERROR: internal error, bad 'in' format '$in_fmt'"
+       [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || [ "$in_fmt" = flac ] || [ "$in_fmt" = ogg ] || die "ERROR: internal error, bad 'in' format '$in_fmt'"
 
        [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'"
 
@@ -304,7 +433,7 @@ test_skip_until ()
                dopt="$wav_dopt"
        fi
 
-       if [ $in_fmt = flac ] && [ $out_fmt = flac ] ; then
+       if ( [ $in_fmt = flac ] || [ $in_fmt = ogg ] ) && ( [ $out_fmt = flac ] || [ $out_fmt = ogg ] ) ; then
                CMP=md5cmp
        else
                CMP=cmp
@@ -328,17 +457,17 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=mm:ss (encode) $desc... "
-       run_flac $eopt --skip=0:01 -o z50c.skip0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip0:01.$in_fmt z50c.skip0:01.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.$in_fmt z50c.skip0:01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (encode) $desc"
-       rm -f z50c.skip0:01.$out_fmt z50c.skip0:01.$in_fmt
+       run_flac $eopt --skip=0:01 -o z50c.skip0_01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip0_01.$in_fmt z50c.skip0_01.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.$in_fmt z50c.skip0_01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (encode) $desc"
+       rm -f z50c.skip0_01.$out_fmt z50c.skip0_01.$in_fmt
        echo OK
 
        echo -n "testing --skip=mm:ss.sss (encode) $desc... "
-       run_flac $eopt --skip=0:01.1001 -o z50c.skip0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip0:01.1001.$in_fmt z50c.skip0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip11.$in_fmt z50c.skip0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) $desc"
-       rm -f z50c.skip0:01.1001.$out_fmt z50c.skip0:01.1001.$in_fmt
+       run_flac $eopt --skip=0:01.1001 -o z50c.skip0_01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip0_01.1001.$in_fmt z50c.skip0_01.1001.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip11.$in_fmt z50c.skip0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) $desc"
+       rm -f z50c.skip0_01.1001.$out_fmt z50c.skip0_01.1001.$in_fmt
        echo OK
 
        #
@@ -354,15 +483,15 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=mm:ss (decode) $desc... "
-       run_flac $dopt --skip=0:01 -o z50c.skip0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.$in_fmt z50c.skip0:01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (decode) $desc"
-       rm -f z50c.skip0:01.$in_fmt
+       run_flac $dopt --skip=0:01 -o z50c.skip0_01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.$in_fmt z50c.skip0_01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (decode) $desc"
+       rm -f z50c.skip0_01.$in_fmt
        echo OK
 
        echo -n "testing --skip=mm:ss.sss (decode) $desc... "
-       run_flac $dopt --skip=0:01.1001 -o z50c.skip0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip11.$in_fmt z50c.skip0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) $desc"
-       rm -f z50c.skip0:01.1001.$in_fmt
+       run_flac $dopt --skip=0:01.1001 -o z50c.skip0_01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip11.$in_fmt z50c.skip0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) $desc"
+       rm -f z50c.skip0_01.1001.$in_fmt
        echo OK
 
        rm -f z50c.$out_fmt
@@ -379,17 +508,17 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --until=mm:ss (encode) $desc... "
-       run_flac $eopt --until=0:04 -o z50c.until0:04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until0:04.$in_fmt z50c.until0:04.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until40.$in_fmt z50c.until0:04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (encode) $desc"
-       rm -f z50c.until0:04.$out_fmt z50c.until0:04.$in_fmt
+       run_flac $eopt --until=0:04 -o z50c.until0_04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until0_04.$in_fmt z50c.until0_04.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until40.$in_fmt z50c.until0_04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (encode) $desc"
+       rm -f z50c.until0_04.$out_fmt z50c.until0_04.$in_fmt
        echo OK
 
        echo -n "testing --until=mm:ss.sss (encode) $desc... "
-       run_flac $eopt --until=0:03.9001 -o z50c.until0:03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until0:03.9001.$in_fmt z50c.until0:03.9001.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until39.$in_fmt z50c.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) $desc"
-       rm -f z50c.until0:03.9001.$out_fmt z50c.until0:03.9001.$in_fmt
+       run_flac $eopt --until=0:03.9001 -o z50c.until0_03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until0_03.9001.$in_fmt z50c.until0_03.9001.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until39.$in_fmt z50c.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) $desc"
+       rm -f z50c.until0_03.9001.$out_fmt z50c.until0_03.9001.$in_fmt
        echo OK
 
        echo -n "testing --until=-# (encode) $desc... "
@@ -400,17 +529,17 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --until=-mm:ss (encode) $desc... "
-       run_flac $eopt --until=-0:01 -o z50c.until-0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-0:01.$in_fmt z50c.until-0:01.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until40.$in_fmt z50c.until-0:01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (encode) $desc"
-       rm -f z50c.until-0:01.$out_fmt z50c.until-0:01.$in_fmt
+       run_flac $eopt --until=-0:01 -o z50c.until-0_01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-0_01.$in_fmt z50c.until-0_01.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until40.$in_fmt z50c.until-0_01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (encode) $desc"
+       rm -f z50c.until-0_01.$out_fmt z50c.until-0_01.$in_fmt
        echo OK
 
        echo -n "testing --until=-mm:ss.sss (encode) $desc... "
-       run_flac $eopt --until=-0:01.1001 -o z50c.until-0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-0:01.1001.$in_fmt z50c.until-0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until39.$in_fmt z50c.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) $desc"
-       rm -f z50c.until-0:01.1001.$out_fmt z50c.until-0:01.1001.$in_fmt
+       run_flac $eopt --until=-0:01.1001 -o z50c.until-0_01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-0_01.1001.$in_fmt z50c.until-0_01.1001.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until39.$in_fmt z50c.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) $desc"
+       rm -f z50c.until-0_01.1001.$out_fmt z50c.until-0_01.1001.$in_fmt
        echo OK
 
        #
@@ -426,15 +555,15 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --until=mm:ss (decode) $desc... "
-       run_flac $dopt --until=0:04 -o z50c.until0:04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until40.$in_fmt z50c.until0:04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (decode) $desc"
-       rm -f z50c.until0:04.$in_fmt
+       run_flac $dopt --until=0:04 -o z50c.until0_04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until40.$in_fmt z50c.until0_04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (decode) $desc"
+       rm -f z50c.until0_04.$in_fmt
        echo OK
 
        echo -n "testing --until=mm:ss.sss (decode) $desc... "
-       run_flac $dopt --until=0:03.9001 -o z50c.until0:03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until39.$in_fmt z50c.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) $desc"
-       rm -f z50c.until0:03.9001.$in_fmt
+       run_flac $dopt --until=0:03.9001 -o z50c.until0_03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until39.$in_fmt z50c.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) $desc"
+       rm -f z50c.until0_03.9001.$in_fmt
        echo OK
 
        echo -n "testing --until=-# (decode) $desc... "
@@ -444,15 +573,15 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --until=-mm:ss (decode) $desc... "
-       run_flac $dopt --until=-0:01 -o z50c.until-0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until40.$in_fmt z50c.until-0:01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (decode) $desc"
-       rm -f z50c.until-0:01.$in_fmt
+       run_flac $dopt --until=-0:01 -o z50c.until-0_01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until40.$in_fmt z50c.until-0_01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (decode) $desc"
+       rm -f z50c.until-0_01.$in_fmt
        echo OK
 
        echo -n "testing --until=-mm:ss.sss (decode) $desc... "
-       run_flac $dopt --until=-0:01.1001 -o z50c.until-0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.until39.$in_fmt z50c.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (decode) $desc"
-       rm -f z50c.until-0:01.1001.$in_fmt
+       run_flac $dopt --until=-0:01.1001 -o z50c.until-0_01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.until39.$in_fmt z50c.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (decode) $desc"
+       rm -f z50c.until-0_01.1001.$in_fmt
        echo OK
 
        rm -f z50c.$out_fmt
@@ -469,17 +598,17 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=10 --until=mm:ss (encode) $desc... "
-       run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until0:04.$in_fmt z50c.skip10.until0:04.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until0:04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) $desc"
-       rm -f z50c.skip10.until0:04.$out_fmt z50c.skip10.until0:04.$in_fmt
+       run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0_04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until0_04.$in_fmt z50c.skip10.until0_04.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until0_04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) $desc"
+       rm -f z50c.skip10.until0_04.$out_fmt z50c.skip10.until0_04.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=mm:ss.sss (encode) $desc... "
-       run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until0:03.9001.$in_fmt z50c.skip10.until0:03.9001.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode) $desc"
-       rm -f z50c.skip10.until0:03.9001.$out_fmt z50c.skip10.until0:03.9001.$in_fmt
+       run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0_03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until0_03.9001.$in_fmt z50c.skip10.until0_03.9001.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode) $desc"
+       rm -f z50c.skip10.until0_03.9001.$out_fmt z50c.skip10.until0_03.9001.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=+# (encode) $desc... "
@@ -490,17 +619,17 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=10 --until=+mm:ss (encode) $desc... "
-       run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0:03.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+0:03.$in_fmt z50c.skip10.until+0:03.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until+0:03.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode) $desc"
-       rm -f z50c.skip10.until+0:03.$out_fmt z50c.skip10.until+0:03.$in_fmt
+       run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0_03.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+0_03.$in_fmt z50c.skip10.until+0_03.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until+0_03.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode) $desc"
+       rm -f z50c.skip10.until+0_03.$out_fmt z50c.skip10.until+0_03.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=+mm:ss.sss (encode) $desc... "
-       run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0:02.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+0:02.9001.$in_fmt z50c.skip10.until+0:02.9001.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until+0:02.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode) $desc"
-       rm -f z50c.skip10.until+0:02.9001.$out_fmt z50c.skip10.until+0:02.9001.$in_fmt
+       run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0_02.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+0_02.9001.$in_fmt z50c.skip10.until+0_02.9001.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until+0_02.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode) $desc"
+       rm -f z50c.skip10.until+0_02.9001.$out_fmt z50c.skip10.until+0_02.9001.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=-# (encode) $desc... "
@@ -511,17 +640,17 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=10 --until=-mm:ss (encode) $desc... "
-       run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-0:01.$in_fmt z50c.skip10.until-0:01.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-0:01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode) $desc"
-       rm -f z50c.skip10.until-0:01.$out_fmt z50c.skip10.until-0:01.$in_fmt
+       run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0_01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-0_01.$in_fmt z50c.skip10.until-0_01.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-0_01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode) $desc"
+       rm -f z50c.skip10.until-0_01.$out_fmt z50c.skip10.until-0_01.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=-mm:ss.sss (encode) $desc... "
-       run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
-       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-0:01.1001.$in_fmt z50c.skip10.until-0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode) $desc"
-       rm -f z50c.skip10.until-0:01.1001.$out_fmt z50c.skip10.until-0:01.1001.$in_fmt
+       run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0_01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"
+       [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-0_01.1001.$in_fmt z50c.skip10.until-0_01.1001.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode) $desc"
+       rm -f z50c.skip10.until-0_01.1001.$out_fmt z50c.skip10.until-0_01.1001.$in_fmt
        echo OK
 
        #
@@ -538,15 +667,15 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=10 --until=mm:ss (decode) $desc... "
-       run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until0:04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) $desc"
-       rm -f z50c.skip10.until0:04.$in_fmt
+       run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0_04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until0_04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) $desc"
+       rm -f z50c.skip10.until0_04.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=mm:ss.sss (decode) $desc... "
-       run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode) $desc"
-       rm -f z50c.skip10.until0:03.9001.$in_fmt
+       run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0_03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode) $desc"
+       rm -f z50c.skip10.until0_03.9001.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=-# (decode) $desc... "
@@ -556,15 +685,15 @@ test_skip_until ()
        echo OK
 
        echo -n "testing --skip=10 --until=-mm:ss (decode) $desc... "
-       run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-0:01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode) $desc"
-       rm -f z50c.skip10.until-0:01.$in_fmt
+       run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0_01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-0_01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode) $desc"
+       rm -f z50c.skip10.until-0_01.$in_fmt
        echo OK
 
        echo -n "testing --skip=10 --until=-mm:ss.sss (decode) $desc... "
-       run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
-       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode) $desc"
-       rm -f z50c.skip10.until-0:01.1001.$in_fmt
+       run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0_01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc"
+       $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode) $desc"
+       rm -f z50c.skip10.until-0_01.1001.$in_fmt
        echo OK
 
        rm -f z50c.$out_fmt
@@ -574,18 +703,23 @@ test_skip_until raw flac
 test_skip_until wav flac
 test_skip_until aiff flac
 test_skip_until flac flac
+#@@@if [ $has_ogg = yes ] ; then
+#@@@   #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet
+#@@@   test_skip_until ogg flac
+#@@@fi
 
-if [ $has_ogg = "yes" ] ; then
+if [ $has_ogg = yes ] ; then
        test_skip_until raw ogg
        test_skip_until wav ogg
        test_skip_until aiff ogg
-       #@@@ doesn't work yet, no comparison step written since metaflac doesn't work on ogg flac yet
+       #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet
        #@@@test_skip_until flac ogg
+       #@@@test_skip_until ogg ogg
 fi
 
 echo "testing seek extremes:"
 
-run_flac --verify --force $SILENT --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 noise.raw || die "ERROR generating FLAC file"
+run_flac --verify --force $SILENT --no-padding --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 noise.raw || die "ERROR generating FLAC file"
 
 if [ $is_win = no ] ; then
        total_noise_cdda_samples=`run_metaflac --show-total-samples noise.flac`
@@ -652,7 +786,7 @@ test_cue ()
        in_fmt=$1
        out_fmt=$2
 
-       [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || [ "$in_fmt" = flac ] || die "ERROR: internal error, bad 'in' format '$in_fmt'"
+       [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || [ "$in_fmt" = flac ] || [ "$in_fmt" = ogg ] || die "ERROR: internal error, bad 'in' format '$in_fmt'"
 
        [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'"
 
@@ -664,7 +798,7 @@ test_cue ()
                dopt="$wav_dopt"
        fi
 
-       if [ $in_fmt = flac ] && [ $out_fmt = flac ] ; then
+       if ( [ $in_fmt = flac ] || [ $in_fmt = ogg ] ) && ( [ $out_fmt = flac ] || [ $out_fmt = ogg ] ) ; then
                CMP=md5cmp
        else
                CMP=cmp
@@ -799,13 +933,18 @@ test_cue raw flac
 test_cue wav flac
 test_cue aiff flac
 test_cue flac flac
+#@@@if [ $has_ogg = yes ] ; then
+#@@@   #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet
+#@@@   test_cue ogg flac
+#@@@fi
 
-if [ $has_ogg = "yes" ] ; then
+if [ $has_ogg = yes ] ; then
        test_cue raw ogg
        test_cue wav ogg
        test_cue aiff ogg
-       #@@@ doesn't work yet, no comparison step written since metaflac doesn't work on ogg flac yet
+       #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet
        #@@@test_cue flac ogg
+       #@@@test_cue ogg ogg
 fi
 
 ############################################################################
@@ -871,7 +1010,7 @@ rm -f noise.aiff fixup.aiff fixup.flac
 
 echo "Generating multiple input files from noise..."
 multifile_format_decode="--endian=big --sign=signed"
-multifile_format_encode="$multifile_format_decode --sample-rate=44100 --bps=16 --channels=2"
+multifile_format_encode="$multifile_format_decode --sample-rate=44100 --bps=16 --channels=2 --no-padding"
 short_noise_cdda_samples=`expr $total_noise_cdda_samples / 8`
 run_flac --verify --force $SILENT --force-raw-format $multifile_format_encode --until=$short_noise_cdda_samples -o shortnoise.flac noise.raw || die "ERROR generating FLAC file"
 run_flac --decode --force $SILENT shortnoise.flac -o shortnoise.raw --force-raw-format $multifile_format_decode || die "ERROR generating RAW file"
@@ -945,7 +1084,7 @@ test_multifile ()
        fi
 
        if [ $streamtype = ogg ] ; then
-               suffix=ogg
+               suffix=oga
                encode_options="$encode_options --ogg"
        else
                suffix=flac
@@ -955,7 +1094,7 @@ test_multifile ()
                encode_options="$encode_options --sector-align"
        fi
 
-       if [ $input_type = flac ] ; then
+       if [ $input_type = flac ] || [ $input_type = ogg ] ; then
                CMP=md5cmp
        else
                CMP=cmp
@@ -980,14 +1119,19 @@ test_multifile ()
        done
 }
 
-for input_type in raw wav aiff flac ; do
+input_types="raw wav aiff flac"
+#@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet
+#@@@if [ $has_ogg = yes ] ; then
+#@@@   input_types="$input_types ogg"
+#@@@fi
+for input_type in $input_types ; do
        echo "Testing multiple $input_type files without verify..."
        test_multifile $input_type flac no_sector_align ""
 
        echo "Testing multiple $input_type files with verify..."
        test_multifile $input_type flac no_sector_align "--verify"
 
-       if [ $input_type != flac ] ; then # --sector-align not supported for FLAC input
+       if [ $input_type != flac ] && [ $input_type != ogg ] ; then # --sector-align not supported for FLAC input
                echo "Testing multiple $input_type files with --sector-align, without verify..."
                test_multifile $input_type flac sector_align ""
 
@@ -995,7 +1139,7 @@ for input_type in raw wav aiff flac ; do
                test_multifile $input_type flac sector_align "--verify"
        fi
 
-       if [ $has_ogg = "yes" ] ; then
+       if [ $has_ogg = yes ] ; then
                echo "Testing multiple $input_type files with --ogg, without verify..."
                test_multifile $input_type ogg no_sector_align ""
 
@@ -1017,6 +1161,20 @@ done
 
 
 ############################################################################
+# test --keep-foreign-metadata
+############################################################################
+
+echo "Testing --keep-foreign-metadata..."
+
+rt_test_wav wacky1.wav '--keep-foreign-metadata'
+rt_test_wav wacky2.wav '--keep-foreign-metadata'
+rt_test_w64 wacky1.w64 '--keep-foreign-metadata'
+rt_test_w64 wacky2.w64 '--keep-foreign-metadata'
+rt_test_rf64 wacky1.rf64 '--keep-foreign-metadata'
+rt_test_rf64 wacky2.rf64 '--keep-foreign-metadata'
+
+
+############################################################################
 # test the metadata-handling properties of flac-to-flac encoding
 ############################################################################
 
@@ -1025,7 +1183,7 @@ echo "Testing the metadata-handling properties of flac-to-flac encoding..."
 testdir="flac-to-flac-metadata-test-files"
 filter ()
 {
-       # minor danger, changing vendor strings will change the length of the
+       # minor danger, changing vendor strings might change the length of the
        # VORBIS_COMMENT block, but if we add "^  length: " to the patterns,
        # we lose info about PADDING size that we need
        grep -Ev '^  vendor string: |^  m..imum .....size: ' | sed -e 's/, stream_offset.*//'
@@ -1085,4 +1243,6 @@ flac2flac input-SCVA.flac case04e "$TOTALLY_SILENT --no-padding -S 5x"
 
 rm -f out.flac out.meta
 
+#@@@ when metaflac handles ogg flac, duplicate flac2flac tests here
+
 cd ..