Chris@1: #!/bin/sh Chris@1: Chris@1: # FLAC - Free Lossless Audio Codec Chris@1: # Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson Chris@1: # Chris@1: # This file is part the FLAC project. FLAC is comprised of several Chris@1: # components distributed under difference licenses. The codec libraries Chris@1: # are distributed under Xiph.Org's BSD-like license (see the file Chris@1: # COPYING.Xiph in this distribution). All other programs, libraries, and Chris@1: # plugins are distributed under the GPL (see COPYING.GPL). The documentation Chris@1: # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the Chris@1: # FLAC distribution contains at the top the terms under which it may be Chris@1: # distributed. Chris@1: # Chris@1: # Since this particular file is relevant to all components of FLAC, Chris@1: # it may be distributed under the Xiph.Org license, which is the least Chris@1: # restrictive of those mentioned above. See the file COPYING.Xiph in this Chris@1: # distribution. Chris@1: Chris@1: die () Chris@1: { Chris@1: echo $* 1>&2 Chris@1: exit 1 Chris@1: } Chris@1: Chris@1: if [ x = x"$1" ] ; then Chris@1: BUILD=debug Chris@1: else Chris@1: BUILD="$1" Chris@1: fi Chris@1: Chris@1: LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH Chris@1: LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH Chris@1: LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH Chris@1: LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH Chris@1: LD_LIBRARY_PATH=../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH Chris@1: LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH Chris@1: LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH Chris@1: export LD_LIBRARY_PATH Chris@1: PATH=../src/flac:$PATH Chris@1: PATH=../obj/$BUILD/bin:$PATH Chris@1: BINS_PATH=../../test_files/bins Chris@1: Chris@1: if [ x"$FLAC__TEST_LEVEL" = x ] ; then Chris@1: FLAC__TEST_LEVEL=1 Chris@1: fi Chris@1: Chris@1: flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" Chris@1: Chris@1: run_flac () Chris@1: { Chris@1: if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then Chris@1: echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_bins.valgrind.log Chris@1: valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 flac $* 4>>test_bins.valgrind.log Chris@1: else Chris@1: flac $* Chris@1: fi Chris@1: } Chris@1: Chris@1: test -d ${BINS_PATH} || exit 77 Chris@1: Chris@1: test_file () Chris@1: { Chris@1: name=$1 Chris@1: channels=$2 Chris@1: bps=$3 Chris@1: encode_options="$4" Chris@1: Chris@1: echo -n "$name.bin (--channels=$channels --bps=$bps $encode_options): encode..." Chris@1: cmd="run_flac --verify --silent --force --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding $name.bin" Chris@1: echo "### ENCODE $name #######################################################" >> ./streams.log Chris@1: echo "### cmd=$cmd" >> ./streams.log Chris@1: $cmd 2>>./streams.log || die "ERROR during encode of $name" Chris@1: Chris@1: echo -n "decode..." Chris@1: cmd="run_flac --silent --force --endian=big --sign=signed --decode --force-raw-format $name.flac"; Chris@1: echo "### DECODE $name #######################################################" >> ./streams.log Chris@1: echo "### cmd=$cmd" >> ./streams.log Chris@1: $cmd 2>>./streams.log || die "ERROR during decode of $name" Chris@1: Chris@1: ls -1l $name.bin >> ./streams.log Chris@1: ls -1l $name.flac >> ./streams.log Chris@1: ls -1l $name.raw >> ./streams.log Chris@1: Chris@1: echo -n "compare..." Chris@1: cmp $name.bin $name.raw || die "ERROR during compare of $name" Chris@1: Chris@1: echo OK Chris@1: } Chris@1: Chris@1: echo "Testing bins..." Chris@1: for f in b00 b01 b02 b03 b04 ; do Chris@1: binfile=$BINS_PATH/$f Chris@1: if [ -f $binfile.bin ] ; then Chris@1: for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do Chris@1: for channels in 1 2 4 8 ; do Chris@1: for bps in 8 16 24 ; do Chris@1: for opt in 0 1 2 4 5 6 8 ; do Chris@1: for extras in '' '-p' '-e' ; do Chris@1: for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do Chris@1: test_file $binfile $channels $bps "-$opt $extras $blocksize $disable" Chris@1: done Chris@1: done Chris@1: done Chris@1: if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then Chris@1: test_file $binfile $channels $bps "--lax -b 16384 -m -r 8 -l 32 -e -p $disable" Chris@1: fi Chris@1: done Chris@1: done Chris@1: done Chris@1: else Chris@1: echo "$binfile not found, skipping." Chris@1: fi Chris@1: done