Use new function flac_snprintf() where ever appropriate.
[platform/upstream/flac.git] / test / test_seeking.sh
index b3cf624..653c152 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #  FLAC - Free Lossless Audio Codec
-#  Copyright (C) 2004,2005,2006,2007  Josh Coalson
+#  Copyright (C) 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
@@ -30,13 +30,19 @@ else
 fi
 
 LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=../objs/$BUILD/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
+export MALLOC_CHECK_=3
+export MALLOC_PERTURB_=$((RANDOM % 255 + 1))
 PATH=../src/flac:$PATH
 PATH=../src/metaflac:$PATH
 PATH=../src/test_seeking:$PATH
 PATH=../src/test_streams:$PATH
-PATH=../obj/$BUILD/bin:$PATH
+PATH=../objs/$BUILD/bin:$PATH
+
+if [ x"$FLAC__TEST_LEVEL" = x ] ; then
+       FLAC__TEST_LEVEL=1
+fi
 
 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
 metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"
@@ -45,7 +51,7 @@ run_flac ()
 {
        if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
                echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_seeking.valgrind.log
-               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_seeking.valgrind.log
+               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 flac $* 4>>test_seeking.valgrind.log
        else
                flac $*
        fi
@@ -55,7 +61,7 @@ run_metaflac ()
 {
        if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
                echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 metaflac $*" >>test_seeking.valgrind.log
-               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>test_seeking.valgrind.log
+               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 metaflac $* 4>>test_seeking.valgrind.log
        else
                metaflac $*
        fi
@@ -65,7 +71,7 @@ run_test_seeking ()
 {
        if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
                echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 test_seeking $*" >>test_seeking.valgrind.log
-               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 test_seeking $* 4>>test_seeking.valgrind.log
+               valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 test_seeking $* 4>>test_seeking.valgrind.log
        else
                test_seeking $*
        fi
@@ -95,14 +101,21 @@ run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed
 tiny_samples=`metaflac --show-total-samples tiny.flac`
 small_samples=`metaflac --show-total-samples small.flac`
 
+tiny_seek_count=100
+if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
+       small_seek_count=10000
+else
+       small_seek_count=100
+fi
+
 for suffix in '' '-s' ; do
        echo "testing tiny$suffix.flac:"
-       if run_test_seeking tiny$suffix.flac 100 $tiny_samples ; then : ; else
+       if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
                die "ERROR: during test_seeking"
        fi
 
        echo "testing small$suffix.flac:"
-       if run_test_seeking small$suffix.flac 1000 $small_samples ; then : ; else
+       if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
                die "ERROR: during test_seeking"
        fi
 
@@ -112,12 +125,12 @@ for suffix in '' '-s' ; do
        fi
 
        echo "testing tiny$suffix.flac with total_samples=0:"
-       if run_test_seeking tiny$suffix.flac 100 $tiny_samples ; then : ; else
+       if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
                die "ERROR: during test_seeking"
        fi
 
        echo "testing small$suffix.flac with total_samples=0:"
-       if run_test_seeking small$suffix.flac 1000 $small_samples ; then : ; else
+       if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
                die "ERROR: during test_seeking"
        fi
 done
@@ -125,20 +138,20 @@ done
 if [ $has_ogg = "yes" ] ; then
 
        echo "generating Ogg FLAC files for seeking:"
-       run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 --output-name=tiny.ogg --ogg noise8m32.raw || die "ERROR generating Ogg FLAC file"
-       run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 --output-name=small.ogg --ogg noise.raw || die "ERROR generating Ogg FLAC file"
+       run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 --output-name=tiny.oga --ogg noise8m32.raw || die "ERROR generating Ogg FLAC file"
+       run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 --output-name=small.oga --ogg noise.raw || die "ERROR generating Ogg FLAC file"
        # seek tables are not used in Ogg FLAC
 
-       echo "testing tiny.ogg:"
-       if run_test_seeking tiny.ogg 100 $tiny_samples ; then : ; else
+       echo "testing tiny.oga:"
+       if run_test_seeking tiny.oga $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
                die "ERROR: during test_seeking"
        fi
 
-       echo "testing small.ogg:"
-       if run_test_seeking small.ogg 1000 $small_samples ; then : ; else
+       echo "testing small.oga:"
+       if run_test_seeking small.oga $small_seek_count $small_samples noise.raw ; then : ; else
                die "ERROR: during test_seeking"
        fi
 
 fi
 
-rm -f tiny.flac tiny.ogg small.flac small.ogg tiny-s.flac small-s.flac
+rm -f tiny.flac tiny.oga small.flac small.oga tiny-s.flac small-s.flac