annotate src/flac-1.2.1/test/test_seeking.sh @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 05aa0afa9217
children
rev   line source
Chris@1 1 #!/bin/sh
Chris@1 2
Chris@1 3 # FLAC - Free Lossless Audio Codec
Chris@1 4 # Copyright (C) 2004,2005,2006,2007 Josh Coalson
Chris@1 5 #
Chris@1 6 # This file is part the FLAC project. FLAC is comprised of several
Chris@1 7 # components distributed under difference licenses. The codec libraries
Chris@1 8 # are distributed under Xiph.Org's BSD-like license (see the file
Chris@1 9 # COPYING.Xiph in this distribution). All other programs, libraries, and
Chris@1 10 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
Chris@1 11 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
Chris@1 12 # FLAC distribution contains at the top the terms under which it may be
Chris@1 13 # distributed.
Chris@1 14 #
Chris@1 15 # Since this particular file is relevant to all components of FLAC,
Chris@1 16 # it may be distributed under the Xiph.Org license, which is the least
Chris@1 17 # restrictive of those mentioned above. See the file COPYING.Xiph in this
Chris@1 18 # distribution.
Chris@1 19
Chris@1 20 die ()
Chris@1 21 {
Chris@1 22 echo $* 1>&2
Chris@1 23 exit 1
Chris@1 24 }
Chris@1 25
Chris@1 26 if [ x = x"$1" ] ; then
Chris@1 27 BUILD=debug
Chris@1 28 else
Chris@1 29 BUILD="$1"
Chris@1 30 fi
Chris@1 31
Chris@1 32 LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH
Chris@1 33 LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
Chris@1 34 export LD_LIBRARY_PATH
Chris@1 35 PATH=../src/flac:$PATH
Chris@1 36 PATH=../src/metaflac:$PATH
Chris@1 37 PATH=../src/test_seeking:$PATH
Chris@1 38 PATH=../src/test_streams:$PATH
Chris@1 39 PATH=../obj/$BUILD/bin:$PATH
Chris@1 40
Chris@1 41 if [ x"$FLAC__TEST_LEVEL" = x ] ; then
Chris@1 42 FLAC__TEST_LEVEL=1
Chris@1 43 fi
Chris@1 44
Chris@1 45 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
Chris@1 46 metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"
Chris@1 47
Chris@1 48 run_flac ()
Chris@1 49 {
Chris@1 50 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
Chris@1 51 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_seeking.valgrind.log
Chris@1 52 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 flac $* 4>>test_seeking.valgrind.log
Chris@1 53 else
Chris@1 54 flac $*
Chris@1 55 fi
Chris@1 56 }
Chris@1 57
Chris@1 58 run_metaflac ()
Chris@1 59 {
Chris@1 60 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
Chris@1 61 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 metaflac $*" >>test_seeking.valgrind.log
Chris@1 62 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 metaflac $* 4>>test_seeking.valgrind.log
Chris@1 63 else
Chris@1 64 metaflac $*
Chris@1 65 fi
Chris@1 66 }
Chris@1 67
Chris@1 68 run_test_seeking ()
Chris@1 69 {
Chris@1 70 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
Chris@1 71 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 test_seeking $*" >>test_seeking.valgrind.log
Chris@1 72 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 test_seeking $* 4>>test_seeking.valgrind.log
Chris@1 73 else
Chris@1 74 test_seeking $*
Chris@1 75 fi
Chris@1 76 }
Chris@1 77
Chris@1 78 echo "Checking for --ogg support in flac..."
Chris@1 79 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
Chris@1 80 has_ogg=yes;
Chris@1 81 echo "flac --ogg works"
Chris@1 82 else
Chris@1 83 has_ogg=no;
Chris@1 84 echo "flac --ogg doesn't work"
Chris@1 85 fi
Chris@1 86
Chris@1 87
Chris@1 88 echo "Generating streams..."
Chris@1 89 if [ ! -f noise.raw ] ; then
Chris@1 90 test_streams || die "ERROR during test_streams"
Chris@1 91 fi
Chris@1 92
Chris@1 93 echo "generating FLAC files for seeking:"
Chris@1 94 run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S- --output-name=tiny.flac noise8m32.raw || die "ERROR generating FLAC file"
Chris@1 95 run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 -S- --output-name=small.flac noise.raw || die "ERROR generating FLAC file"
Chris@1 96 run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S10x --output-name=tiny-s.flac noise8m32.raw || die "ERROR generating FLAC file"
Chris@1 97 run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 -S10x --output-name=small-s.flac noise.raw || die "ERROR generating FLAC file"
Chris@1 98
Chris@1 99 tiny_samples=`metaflac --show-total-samples tiny.flac`
Chris@1 100 small_samples=`metaflac --show-total-samples small.flac`
Chris@1 101
Chris@1 102 tiny_seek_count=100
Chris@1 103 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
Chris@1 104 small_seek_count=10000
Chris@1 105 else
Chris@1 106 small_seek_count=100000
Chris@1 107 fi
Chris@1 108
Chris@1 109 for suffix in '' '-s' ; do
Chris@1 110 echo "testing tiny$suffix.flac:"
Chris@1 111 if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
Chris@1 112 die "ERROR: during test_seeking"
Chris@1 113 fi
Chris@1 114
Chris@1 115 echo "testing small$suffix.flac:"
Chris@1 116 if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
Chris@1 117 die "ERROR: during test_seeking"
Chris@1 118 fi
Chris@1 119
Chris@1 120 echo "removing sample count from tiny$suffix.flac and small$suffix.flac:"
Chris@1 121 if run_metaflac --no-filename --set-total-samples=0 tiny$suffix.flac small$suffix.flac ; then : ; else
Chris@1 122 die "ERROR: during metaflac"
Chris@1 123 fi
Chris@1 124
Chris@1 125 echo "testing tiny$suffix.flac with total_samples=0:"
Chris@1 126 if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
Chris@1 127 die "ERROR: during test_seeking"
Chris@1 128 fi
Chris@1 129
Chris@1 130 echo "testing small$suffix.flac with total_samples=0:"
Chris@1 131 if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
Chris@1 132 die "ERROR: during test_seeking"
Chris@1 133 fi
Chris@1 134 done
Chris@1 135
Chris@1 136 if [ $has_ogg = "yes" ] ; then
Chris@1 137
Chris@1 138 echo "generating Ogg FLAC files for seeking:"
Chris@1 139 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"
Chris@1 140 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"
Chris@1 141 # seek tables are not used in Ogg FLAC
Chris@1 142
Chris@1 143 echo "testing tiny.oga:"
Chris@1 144 if run_test_seeking tiny.oga $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
Chris@1 145 die "ERROR: during test_seeking"
Chris@1 146 fi
Chris@1 147
Chris@1 148 echo "testing small.oga:"
Chris@1 149 if run_test_seeking small.oga $small_seek_count $small_samples noise.raw ; then : ; else
Chris@1 150 die "ERROR: during test_seeking"
Chris@1 151 fi
Chris@1 152
Chris@1 153 fi
Chris@1 154
Chris@1 155 rm -f tiny.flac tiny.oga small.flac small.oga tiny-s.flac small-s.flac