annotate src/flac-1.2.1/test/test_grabbag.sh @ 88:fe7c3a0b0259

Add some MinGW builds
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 20 Mar 2013 13:49:36 +0000
parents 98c1576536ae
children
rev   line source
cannam@86 1 #!/bin/sh
cannam@86 2
cannam@86 3 # FLAC - Free Lossless Audio Codec
cannam@86 4 # Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
cannam@86 5 #
cannam@86 6 # This file is part the FLAC project. FLAC is comprised of several
cannam@86 7 # components distributed under difference licenses. The codec libraries
cannam@86 8 # are distributed under Xiph.Org's BSD-like license (see the file
cannam@86 9 # COPYING.Xiph in this distribution). All other programs, libraries, and
cannam@86 10 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
cannam@86 11 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
cannam@86 12 # FLAC distribution contains at the top the terms under which it may be
cannam@86 13 # distributed.
cannam@86 14 #
cannam@86 15 # Since this particular file is relevant to all components of FLAC,
cannam@86 16 # it may be distributed under the Xiph.Org license, which is the least
cannam@86 17 # restrictive of those mentioned above. See the file COPYING.Xiph in this
cannam@86 18 # distribution.
cannam@86 19
cannam@86 20 die ()
cannam@86 21 {
cannam@86 22 echo $* 1>&2
cannam@86 23 exit 1
cannam@86 24 }
cannam@86 25
cannam@86 26 if [ x = x"$1" ] ; then
cannam@86 27 BUILD=debug
cannam@86 28 else
cannam@86 29 BUILD="$1"
cannam@86 30 fi
cannam@86 31
cannam@86 32 LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH
cannam@86 33 LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH
cannam@86 34 LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
cannam@86 35 LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
cannam@86 36 export LD_LIBRARY_PATH
cannam@86 37 PATH=../src/test_grabbag/cuesheet:$PATH
cannam@86 38 PATH=../src/test_grabbag/picture:$PATH
cannam@86 39 PATH=../obj/$BUILD/bin:$PATH
cannam@86 40
cannam@86 41 test_cuesheet -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_cuesheet executable"
cannam@86 42 test_picture -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_picture executable"
cannam@86 43
cannam@86 44 run_test_cuesheet ()
cannam@86 45 {
cannam@86 46 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
cannam@86 47 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 test_cuesheet $*" >>test_grabbag.valgrind.log
cannam@86 48 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 test_cuesheet $* 4>>test_grabbag.valgrind.log
cannam@86 49 else
cannam@86 50 test_cuesheet $*
cannam@86 51 fi
cannam@86 52 }
cannam@86 53
cannam@86 54 run_test_picture ()
cannam@86 55 {
cannam@86 56 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
cannam@86 57 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 test_picture $*" >>test_grabbag.valgrind.log
cannam@86 58 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 test_picture $* 4>>test_grabbag.valgrind.log
cannam@86 59 else
cannam@86 60 test_picture $*
cannam@86 61 fi
cannam@86 62 }
cannam@86 63
cannam@86 64 if [ `env | grep -ic '^comspec='` != 0 ] ; then
cannam@86 65 is_win=yes
cannam@86 66 else
cannam@86 67 is_win=no
cannam@86 68 fi
cannam@86 69
cannam@86 70 ########################################################################
cannam@86 71 #
cannam@86 72 # test_picture
cannam@86 73 #
cannam@86 74 ########################################################################
cannam@86 75
cannam@86 76 log=picture.log
cannam@86 77 picture_dir=pictures
cannam@86 78
cannam@86 79 echo "Running test_picture..."
cannam@86 80
cannam@86 81 rm -f $log
cannam@86 82
cannam@86 83 run_test_picture $picture_dir >> $log 2>&1
cannam@86 84
cannam@86 85 if [ $is_win = yes ] ; then
cannam@86 86 diff -w picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff"
cannam@86 87 else
cannam@86 88 diff picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff"
cannam@86 89 fi
cannam@86 90
cannam@86 91 echo "PASSED (results are in $log)"
cannam@86 92
cannam@86 93 ########################################################################
cannam@86 94 #
cannam@86 95 # test_cuesheet
cannam@86 96 #
cannam@86 97 ########################################################################
cannam@86 98
cannam@86 99 log=cuesheet.log
cannam@86 100 bad_cuesheets=cuesheets/bad.*.cue
cannam@86 101 good_cuesheets=cuesheets/good.*.cue
cannam@86 102 good_leadout=`expr 80 \* 60 \* 44100`
cannam@86 103 bad_leadout=`expr $good_leadout + 1`
cannam@86 104
cannam@86 105 echo "Running test_cuesheet..."
cannam@86 106
cannam@86 107 rm -f $log
cannam@86 108
cannam@86 109 #
cannam@86 110 # negative tests
cannam@86 111 #
cannam@86 112 for cuesheet in $bad_cuesheets ; do
cannam@86 113 echo "NEGATIVE $cuesheet" >> $log 2>&1
cannam@86 114 run_test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
cannam@86 115 exit_code=$?
cannam@86 116 if [ "$exit_code" = 255 ] ; then
cannam@86 117 die "Error: test script is broken"
cannam@86 118 fi
cannam@86 119 cuesheet_pass1=${cuesheet}.1
cannam@86 120 cuesheet_pass2=${cuesheet}.2
cannam@86 121 rm -f $cuesheet_pass1 $cuesheet_pass2
cannam@86 122 done
cannam@86 123
cannam@86 124 #
cannam@86 125 # positve tests
cannam@86 126 #
cannam@86 127 for cuesheet in $good_cuesheets ; do
cannam@86 128 echo "POSITIVE $cuesheet" >> $log 2>&1
cannam@86 129 run_test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
cannam@86 130 exit_code=$?
cannam@86 131 if [ "$exit_code" = 255 ] ; then
cannam@86 132 die "Error: test script is broken"
cannam@86 133 elif [ "$exit_code" != 0 ] ; then
cannam@86 134 die "Error: good cuesheet is broken"
cannam@86 135 fi
cannam@86 136 cuesheet_pass1=${cuesheet}.1
cannam@86 137 cuesheet_pass2=${cuesheet}.2
cannam@86 138 diff $cuesheet_pass1 $cuesheet_pass2 >> $log 2>&1 || die "Error: pass1 and pass2 output differ"
cannam@86 139 rm -f $cuesheet_pass1 $cuesheet_pass2
cannam@86 140 done
cannam@86 141
cannam@86 142 if [ $is_win = yes ] ; then
cannam@86 143 diff -w cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff"
cannam@86 144 else
cannam@86 145 diff cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff"
cannam@86 146 fi
cannam@86 147
cannam@86 148 echo "PASSED (results are in $log)"