diff options
-rw-r--r-- | test/common.sh.in | 20 | ||||
-rwxr-xr-x | test/test_compression.sh | 8 | ||||
-rwxr-xr-x | test/test_flac.sh | 56 | ||||
-rwxr-xr-x | test/test_grabbag.sh | 8 | ||||
-rwxr-xr-x | test/test_libFLAC++.sh | 4 | ||||
-rwxr-xr-x | test/test_libFLAC.sh | 4 | ||||
-rwxr-xr-x | test/test_metaflac.sh | 18 | ||||
-rwxr-xr-x | test/test_replaygain.sh | 18 | ||||
-rwxr-xr-x | test/test_seeking.sh | 12 | ||||
-rwxr-xr-x | test/test_streams.sh | 14 |
10 files changed, 81 insertions, 81 deletions
diff --git a/test/common.sh.in b/test/common.sh.in index 335f8409..11461297 100644 --- a/test/common.sh.in +++ b/test/common.sh.in @@ -19,20 +19,20 @@ export MALLOC_CHECK_=3 export MALLOC_PERTURB_=$((RANDOM % 255 + 1)) -if [ x = x"$1" ] ; then +if [ -z "$1" ] ; then BUILD=debug else BUILD="$1" fi LD_LIBRARY_PATH=../objs/$BUILD/lib:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../objs/$BUILD/lib:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/libFLAC/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/getopt/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/grabbag/.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)/../objs/$BUILD/lib:$LD_LIBRARY_PATH" +LD_LIBRARY_PATH="$(pwd)/../src/libFLAC/.libs:$LD_LIBRARY_PATH" +LD_LIBRARY_PATH="$(pwd)/../src/share/getopt/.libs:$LD_LIBRARY_PATH" +LD_LIBRARY_PATH="$(pwd)/../src/share/grabbag/.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=../src/libFLAC/.libs:$LD_LIBRARY_PATH LD_LIBRARY_PATH=../src/libFLAC++/.libs:$LD_LIBRARY_PATH LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH @@ -43,8 +43,8 @@ LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH export LD_LIBRARY_PATH -PATH=`pwd`/../objs/$CMAKE_CONFIG_TYPE:$PATH -PATH=`pwd`/../objs:$PATH +PATH="$(pwd)/../objs/$CMAKE_CONFIG_TYPE:$PATH" +PATH="$(pwd)/../objs:$PATH" EXE=@EXEEXT@ diff --git a/test/test_compression.sh b/test/test_compression.sh index e1191ad7..68c5a017 100755 --- a/test/test_compression.sh +++ b/test/test_compression.sh @@ -19,11 +19,11 @@ . ./common.sh -PATH=`pwd`/../src/flac:$PATH +PATH="$(pwd)/../src/flac:$PATH" -echo "Using FLAC binary :" $(which flac) +printf "Using FLAC binary : %s\n" "$(which flac)" -date=`date "+%Y%m%dT%H%M%S"` +date="$(date "+%Y%m%dT%H%M%S")" fname="comp${date}.flac" last_k=0 @@ -40,7 +40,7 @@ for k in 0 1 2 3 4 5 6 7 8 ; do exit 1 fi # Need this because OSX's 'wc -c' returns a number with leading whitespace. - last_size=$((${size}+10)) + last_size=$((size+10)) last_k=${k} rm -f ${fname} done diff --git a/test/test_flac.sh b/test/test_flac.sh index 6ecd0f66..3e5f982e 100755 --- a/test/test_flac.sh +++ b/test/test_flac.sh @@ -25,16 +25,16 @@ export LANG=C LC_ALL=C dddie="die ERROR: creating files with dd" -PATH=`pwd`/../src/flac:$PATH -PATH=`pwd`/../src/metaflac:$PATH -PATH=`pwd`/../src/test_streams:$PATH -PATH=`pwd`/../objs/$BUILD/bin:$PATH +PATH="$(pwd)/../src/flac:$PATH" +PATH="$(pwd)/../src/metaflac:$PATH" +PATH="$(pwd)/../src/test_streams:$PATH" +PATH="$(pwd)/../objs/$BUILD/bin:$PATH" flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" run_flac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_flac.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} $TOTALLY_SILENT --no-error-on-compression-fail $* 4>>test_flac.valgrind.log else @@ -44,7 +44,7 @@ run_flac () run_metaflac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_flac.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_flac.valgrind.log else @@ -54,7 +54,7 @@ run_metaflac () md5cmp () { - n=`( [ -f "$1" ] && [ -f "$2" ] && metaflac${EXE} --show-md5sum --no-filename "$1" "$2" 2>/dev/null || exit 1 ) | uniq | wc -l` + n=$( ( [ -f "$1" ] && [ -f "$2" ] && metaflac${EXE} --show-md5sum --no-filename "$1" "$2" 2>/dev/null || exit 1 ) | uniq | wc -l) [ "$n" != "" ] && [ $n = 1 ] } @@ -154,9 +154,9 @@ rt_test_raw () { f="$1" extra="$2" - channels=`echo $f | awk -F- '{print $2}'` - bps=`echo $f | awk -F- '{print $3}'` - sign=`echo $f | awk -F- '{print $4}'` + channels="$(echo $f | awk -F- '{print $2}')" + bps="$(echo $f | awk -F- '{print $3}')" + sign="$(echo $f | awk -F- '{print $4}')" echo $ECHO_N "round-trip test ($f) encode... " $ECHO_C run_flac --force --verify --force-raw-format --endian=little --sign=$sign --sample-rate=44100 --bps=$bps --channels=$channels --no-padding --lax -o rt.flac $extra $f || die "ERROR" @@ -400,7 +400,7 @@ test_skip_until () dopt="$wav_dopt" fi - if ( [ $in_fmt = flac ] || [ $in_fmt = ogg ] ) && ( [ $out_fmt = flac ] || [ $out_fmt = ogg ] ) ; then + if [ $in_fmt = flac -o $in_fmt = ogg ] && [ $out_fmt = flac -o $out_fmt = ogg ]; then CMP=md5cmp else CMP=cmp @@ -690,7 +690,7 @@ echo "testing seek extremes:" run_flac --verify --force --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` + total_noise_cdda_samples="$(run_metaflac --show-total-samples noise.flac)" [ $? = 0 ] || die "ERROR getting total sample count from noise.flac" else # some flavors of cygwin don't seem to treat the \x0d as a word @@ -704,7 +704,7 @@ run_flac $wav_dopt --skip=0 -o z.wav noise.flac || die "ERROR decoding FLAC file echo OK for delta in 2 1 ; do - n=`expr $total_noise_cdda_samples - $delta` + n=$((total_noise_cdda_samples - delta)) echo $ECHO_N "testing --skip=$n... " $ECHO_C run_flac $wav_dopt --skip=$n -o z.wav noise.flac || die "ERROR decoding FLAC file noise.flac" echo OK @@ -719,7 +719,7 @@ rm noise.flac z.wav #@@@ cat will not work on old cygwin, need to fix if [ $is_win = no ] ; then echo $ECHO_N "testing --input-size=50 --skip=10... " $ECHO_C - cat 50c.raw | run_flac $raw_eopt --input-size=50 --skip=10 -o z50c.skip10.flac - || die "ERROR generating FLAC file" + run_flac $raw_eopt --input-size=50 --skip=10 -o z50c.skip10.flac - < 50c.raw || die "ERROR generating FLAC file" run_flac $raw_dopt -o z50c.skip10.raw z50c.skip10.flac || die "ERROR decoding FLAC file" cmp 50c.skip10.raw z50c.skip10.raw || die "ERROR: file mismatch for --input-size=50 --skip=10" rm -f z50c.skip10.raw z50c.skip10.flac @@ -802,7 +802,7 @@ test_cue () dopt="$wav_dopt" fi - if ( [ $in_fmt = flac ] || [ $in_fmt = ogg ] ) && ( [ $out_fmt = flac ] || [ $out_fmt = ogg ] ) ; then + if [ $in_fmt = flac -o $in_fmt = ogg ] && [ $out_fmt = flac -o $out_fmt = ogg ]; then CMP=md5cmp else CMP=cmp @@ -970,7 +970,7 @@ if [ $is_win = yes ] ; then run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file" run_metaflac --set-total-samples=0 fixup.flac 2> /dev/null else - cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" + run_flac $raw_eopt - -c < noise.raw > fixup.flac || die "ERROR generating FLAC file" fi echo $ECHO_N "decode... " $ECHO_C @@ -995,7 +995,7 @@ if [ $is_win = yes ] ; then run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file" run_metaflac --set-total-samples=0 fixup.flac 2> /dev/null else - cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" + run_flac $raw_eopt - -c < noise.raw > fixup.flac || die "ERROR generating FLAC file" fi echo $ECHO_N "decode... " $ECHO_C @@ -1015,7 +1015,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 --no-padding" -short_noise_cdda_samples=`expr $total_noise_cdda_samples / 8` +short_noise_cdda_samples=$((total_noise_cdda_samples / 8)) run_flac --verify --force --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 shortnoise.flac -o shortnoise.raw --force-raw-format $multifile_format_decode || die "ERROR generating RAW file" run_flac --decode --force shortnoise.flac || die "ERROR generating WAVE file" @@ -1037,17 +1037,17 @@ cp shortnoise.raw file1.raw cp shortnoise.raw file2.raw rm -f shortnoise.raw # create authoritative sector-aligned files for comparison -file0_samples=`expr \( $short_noise_cdda_samples / 588 \) \* 588` -file0_remainder=`expr $short_noise_cdda_samples - $file0_samples` -file1_samples=`expr \( \( $file0_remainder + $short_noise_cdda_samples \) / 588 \) \* 588` -file1_remainder=`expr $file0_remainder + $short_noise_cdda_samples - $file1_samples` -file1_samples=`expr $file1_samples - $file0_remainder` -file2_samples=`expr \( \( $file1_remainder + $short_noise_cdda_samples \) / 588 \) \* 588` -file2_remainder=`expr $file1_remainder + $short_noise_cdda_samples - $file2_samples` -file2_samples=`expr $file2_samples - $file1_remainder` +file0_samples=$(( (short_noise_cdda_samples / 588) * 588)) +file0_remainder=$((short_noise_cdda_samples - file0_samples)) +file1_samples=$(( ( ( file0_remainder + short_noise_cdda_samples ) / 588 ) * 588)) +file1_remainder=$((file0_remainder + short_noise_cdda_samples - file1_samples)) +file1_samples=$((file1_samples - file0_remainder)) +file2_samples=$(( ( ( file1_remainder + short_noise_cdda_samples ) / 588 ) * 588)) +file2_remainder=$(( file1_remainder + short_noise_cdda_samples - file2_samples)) +file2_samples=$((file2_samples - file1_remainder)) if [ $file2_remainder != '0' ] ; then - file2_samples=`expr $file2_samples + $file2_remainder` - file2_remainder=`expr 588 - $file2_remainder` + file2_samples=$((file2_samples + file2_remainder)) + file2_remainder=$((588 - file2_remainder)) fi dd if=file0.raw ibs=4 count=$file0_samples of=file0s.raw 2>/dev/null || $dddie diff --git a/test/test_grabbag.sh b/test/test_grabbag.sh index 3af2741d..32afe3c2 100755 --- a/test/test_grabbag.sh +++ b/test/test_grabbag.sh @@ -29,7 +29,7 @@ test_picture -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_picture ex run_test_cuesheet () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_cuesheet $*" >>test_grabbag.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_cuesheet${EXE} $* 4>>test_grabbag.valgrind.log else @@ -39,7 +39,7 @@ run_test_cuesheet () run_test_picture () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_picture $*" >>test_grabbag.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_picture${EXE} $* 4>>test_grabbag.valgrind.log else @@ -79,8 +79,8 @@ echo "PASSED (results are in $log)" log=cuesheet.log bad_cuesheets=${top_srcdir}/test/cuesheets/bad.*.cue good_cuesheets=${top_srcdir}/test/cuesheets/good.*.cue -good_leadout=`expr 80 \* 60 \* 44100` -bad_leadout=`expr $good_leadout + 1` +good_leadout=$((80 * 60 * 44100)) +bad_leadout=$((good_leadout + 1)) echo "Running test_cuesheet..." diff --git a/test/test_libFLAC++.sh b/test/test_libFLAC++.sh index d71f36f3..d58ea7af 100755 --- a/test/test_libFLAC++.sh +++ b/test/test_libFLAC++.sh @@ -25,11 +25,11 @@ PATH=../objs/$BUILD/bin:$PATH run_test_libFLACpp () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_libFLAC++${EXE} $* 4>>test_libFLAC++.valgrind.log else test_libFLAC++${EXE} $* fi } -run_test_libFLACpp || die "ERROR during test_libFLAC++" +run_test_libFLACpp "$@" || die "ERROR during test_libFLAC++" diff --git a/test/test_libFLAC.sh b/test/test_libFLAC.sh index 2259eb08..6fa97af4 100755 --- a/test/test_libFLAC.sh +++ b/test/test_libFLAC.sh @@ -25,11 +25,11 @@ PATH=../objs/$BUILD/bin:$PATH run_test_libFLAC () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_libFLAC${EXE} $* 4>>test_libFLAC.valgrind.log else test_libFLAC${EXE} $* fi } -run_test_libFLAC || die "ERROR during test_libFLAC" +run_test_libFLAC "$@"|| die "ERROR during test_libFLAC" diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh index 28e4dbf5..b5dfa72b 100755 --- a/test/test_metaflac.sh +++ b/test/test_metaflac.sh @@ -20,9 +20,9 @@ . ./common.sh -PATH=`pwd`/../src/flac:$PATH -PATH=`pwd`/../src/metaflac:$PATH -PATH=`pwd`/../objs/$BUILD/bin:$PATH +PATH="$(pwd)/../src/flac:$PATH" +PATH="$(pwd)/../src/metaflac:$PATH" +PATH="$(pwd)/../objs/$BUILD/bin:$PATH" if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then EGREP='grep -E' @@ -37,7 +37,7 @@ metaflac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac run_flac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_metaflac.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} ${TOTALLY_SILENT} --no-error-on-compression-fail $* 4>>test_metaflac.valgrind.log else @@ -47,7 +47,7 @@ run_flac () run_metaflac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_metaflac.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_metaflac.valgrind.log else @@ -60,7 +60,7 @@ run_metaflac_silent () if [ -z "$SILENT" ] ; then run_metaflac $* else - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_metaflac.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 2>/dev/null 4>>test_metaflac.valgrind.log else @@ -317,7 +317,7 @@ for f in \ run_metaflac --import-picture-from="|image/gif|$f||${top_srcdir}/test/pictures/$f" $flacfile check_flac metaflac_test "case$ncase" "--import-picture-from" "--list" - ncase=`expr $ncase + 1` + ncase=$((ncase + 1)) done for f in \ 0.jpg \ @@ -326,7 +326,7 @@ for f in \ run_metaflac --import-picture-from="4|image/jpeg|$f||${top_srcdir}/test/pictures/$f" $flacfile check_flac metaflac_test "case$ncase" "--import-picture-from" "--list" - ncase=`expr $ncase + 1` + ncase=$((ncase + 1)) done for f in \ 0.png \ @@ -342,7 +342,7 @@ for f in \ run_metaflac --import-picture-from="5|image/png|$f||${top_srcdir}/test/pictures/$f" $flacfile check_flac metaflac_test "case$ncase" "--import-picture-from" "--list" - ncase=`expr $ncase + 1` + ncase=$((ncase + 1)) done [ $ncase = 60 ] || die "expected case# to be 60" diff --git a/test/test_replaygain.sh b/test/test_replaygain.sh index 2e7ab53a..ada02c59 100755 --- a/test/test_replaygain.sh +++ b/test/test_replaygain.sh @@ -20,9 +20,9 @@ . ./common.sh -PATH=`pwd`/../src/flac:$PATH -PATH=`pwd`/../src/metaflac:$PATH -PATH=`pwd`/../objs/$BUILD/bin:$PATH +PATH="$(pwd)/../src/flac:$PATH" +PATH="$(pwd)/../src/metaflac:$PATH" +PATH="$(pwd)/../objs/$BUILD/bin:$PATH" if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then EGREP='grep -E' @@ -34,7 +34,7 @@ flacfile="replaygain.flac" run_flac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_replaygain.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac --no-error-on-compression-fail $* 4>>test_replaygain.valgrind.log else @@ -44,7 +44,7 @@ run_flac () run_metaflac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_replaygain.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac $* 4>>test_replaygain.valgrind.log else @@ -57,7 +57,7 @@ run_metaflac_silent () if [ -z "$SILENT" ] ; then run_metaflac $* else - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_replaygain.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac $* 2>/dev/null 4>>test_replaygain.valgrind.log else @@ -117,18 +117,18 @@ for ACTION in $REPLAYGAIN_FREQ ; do GAIN="${GAIN%%:*}" while [ -n "$HARMONICS" ] ; do MULTIPLE="${HARMONICS%%:*}" - if [ x"$MULTIPLE" = x"$HARMONICS" ] ; then + if [ "$MULTIPLE" = "$HARMONICS" ] ; then HARMONICS= else HARMONICS="${HARMONICS#*:}" fi - RATE=$(($MULTIPLE * FREQ)) + RATE=$((MULTIPLE * FREQ)) [ $MULTIPLE -eq 1 -o -n "${REPLAYGAIN_FREQ##* $RATE/*}" ] || break echo $ECHO_N "Testing FLAC replaygain $RATE ($FREQ x $MULTIPLE) ... " $ECHO_C tonegenerator $RATE $flacfile run_metaflac --scan-replay-gain $flacfile run_metaflac --add-replay-gain $flacfile - run_metaflac --list $flacfile | grep REPLAYGAIN.*GAIN= | + run_metaflac --list $flacfile | grep "REPLAYGAIN.*GAIN=" | while read -r REPLAYGAIN ; do MEASUREDGAIN="${REPLAYGAIN##*=}" MEASUREDGAIN="${MEASUREDGAIN%% *}" diff --git a/test/test_seeking.sh b/test/test_seeking.sh index 316d3db3..31907704 100755 --- a/test/test_seeking.sh +++ b/test/test_seeking.sh @@ -26,7 +26,7 @@ PATH=../src/test_seeking:$PATH PATH=../src/test_streams:$PATH PATH=../objs/$BUILD/bin:$PATH -if [ x"$FLAC__TEST_LEVEL" = x ] ; then +if [ -z "$FLAC__TEST_LEVEL" ] ; then FLAC__TEST_LEVEL=1 fi @@ -35,7 +35,7 @@ metaflac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac run_flac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_seeking.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} --no-error-on-compression-fail $* 4>>test_seeking.valgrind.log else @@ -45,7 +45,7 @@ run_flac () run_metaflac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_seeking.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_seeking.valgrind.log else @@ -55,7 +55,7 @@ run_metaflac () run_test_seeking () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_seeking $*" >>test_seeking.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_seeking $* 4>>test_seeking.valgrind.log else @@ -82,8 +82,8 @@ run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed 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" 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" -tiny_samples=`metaflac${EXE} --show-total-samples tiny.flac` -small_samples=`metaflac${EXE} --show-total-samples small.flac` +tiny_samples="$(metaflac${EXE} --show-total-samples tiny.flac)" +small_samples="$(metaflac${EXE} --show-total-samples small.flac)" tiny_seek_count=100 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then diff --git a/test/test_streams.sh b/test/test_streams.sh index e86fce96..bf05bf84 100755 --- a/test/test_streams.sh +++ b/test/test_streams.sh @@ -24,7 +24,7 @@ PATH=../src/flac:$PATH PATH=../src/test_streams:$PATH PATH=../objs/$BUILD/bin:$PATH -if [ x"$FLAC__TEST_LEVEL" = x ] ; then +if [ -z "$FLAC__TEST_LEVEL" ] ; then FLAC__TEST_LEVEL=1 fi @@ -32,7 +32,7 @@ flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executab run_flac () { - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then + if [ "$FLAC__TEST_WITH_VALGRIND" = yes ] ; then echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_streams.valgrind.log valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac --no-error-on-compression-fail $* 4>>test_streams.valgrind.log else @@ -85,7 +85,7 @@ test_file_piped () bps=$3 encode_options="$4" - if [ `env | grep -ic '^comspec='` != 0 ] ; then + if [ "$(env | grep -ic '^comspec=')" != 0 ] ; then is_win=yes else is_win=no @@ -101,7 +101,7 @@ test_file_piped () cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout -" echo "### ENCODE $name #######################################################" >> ./streams.log echo "### cmd=$cmd" >> ./streams.log - cat $name.raw | $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name" + $cmd < $name.raw 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name" fi echo $ECHO_N "decode via pipes..." $ECHO_C if [ $is_win = yes ] ; then @@ -113,7 +113,7 @@ test_file_piped () cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout -" echo "### DECODE $name #######################################################" >> ./streams.log echo "### cmd=$cmd" >> ./streams.log - cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name" + $cmd < $name.flac 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name" fi ls -1l $name.raw >> ./streams.log ls -1l $name.flac >> ./streams.log @@ -162,7 +162,7 @@ test_corrupted_file () ls -1l $name.cmp >> ./streams.log echo $ECHO_N "compare..." $ECHO_C - if [ $(wc -c < $name.raw) -ne $(wc -c < $name.cmp) ]; then + if [ "$(wc -c < $name.raw)" -ne "$(wc -c < $name.cmp)" ]; then die "ERROR, length of decoded file not equal to length of original" fi @@ -281,7 +281,7 @@ for bps in 8 16 24 ; do if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then for opt in 0 1 2 4 5 6 8 ; do for extras in '' '-p' '-e' ; do - if ([ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ]) && (([ "$bps" -eq 16 ] && [ "$f" -lt 15 ]) || [ "$FLAC__TEST_LEVEL" -gt 1 ]) ; then + if [ -z "$extras" -o "$FLAC__TEST_LEVEL" -gt 0 ] && { [ "$bps" -eq 16 -a "$f" -lt 15 ] || [ "$FLAC__TEST_LEVEL" -gt 1 ]; } ; then if [ "$f" -lt 10 ] ; then test_corrupted_file sine$bps-$f 1 $bps "-$opt $extras $disable" else |