Chris@1
|
1 #!/bin/sh
|
Chris@1
|
2
|
Chris@1
|
3 # FLAC - Free Lossless Audio Codec
|
Chris@1
|
4 # Copyright (C) 2001,2002,2003,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=../src/share/grabbag/.libs:$LD_LIBRARY_PATH
|
Chris@1
|
34 LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
|
Chris@1
|
35 LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
|
Chris@1
|
36 export LD_LIBRARY_PATH
|
Chris@1
|
37 PATH=../src/test_grabbag/cuesheet:$PATH
|
Chris@1
|
38 PATH=../src/test_grabbag/picture:$PATH
|
Chris@1
|
39 PATH=../obj/$BUILD/bin:$PATH
|
Chris@1
|
40
|
Chris@1
|
41 test_cuesheet -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_cuesheet executable"
|
Chris@1
|
42 test_picture -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_picture executable"
|
Chris@1
|
43
|
Chris@1
|
44 run_test_cuesheet ()
|
Chris@1
|
45 {
|
Chris@1
|
46 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
|
Chris@1
|
47 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 test_cuesheet $*" >>test_grabbag.valgrind.log
|
Chris@1
|
48 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 test_cuesheet $* 4>>test_grabbag.valgrind.log
|
Chris@1
|
49 else
|
Chris@1
|
50 test_cuesheet $*
|
Chris@1
|
51 fi
|
Chris@1
|
52 }
|
Chris@1
|
53
|
Chris@1
|
54 run_test_picture ()
|
Chris@1
|
55 {
|
Chris@1
|
56 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
|
Chris@1
|
57 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 test_picture $*" >>test_grabbag.valgrind.log
|
Chris@1
|
58 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 test_picture $* 4>>test_grabbag.valgrind.log
|
Chris@1
|
59 else
|
Chris@1
|
60 test_picture $*
|
Chris@1
|
61 fi
|
Chris@1
|
62 }
|
Chris@1
|
63
|
Chris@1
|
64 if [ `env | grep -ic '^comspec='` != 0 ] ; then
|
Chris@1
|
65 is_win=yes
|
Chris@1
|
66 else
|
Chris@1
|
67 is_win=no
|
Chris@1
|
68 fi
|
Chris@1
|
69
|
Chris@1
|
70 ########################################################################
|
Chris@1
|
71 #
|
Chris@1
|
72 # test_picture
|
Chris@1
|
73 #
|
Chris@1
|
74 ########################################################################
|
Chris@1
|
75
|
Chris@1
|
76 log=picture.log
|
Chris@1
|
77 picture_dir=pictures
|
Chris@1
|
78
|
Chris@1
|
79 echo "Running test_picture..."
|
Chris@1
|
80
|
Chris@1
|
81 rm -f $log
|
Chris@1
|
82
|
Chris@1
|
83 run_test_picture $picture_dir >> $log 2>&1
|
Chris@1
|
84
|
Chris@1
|
85 if [ $is_win = yes ] ; then
|
Chris@1
|
86 diff -w picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff"
|
Chris@1
|
87 else
|
Chris@1
|
88 diff picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff"
|
Chris@1
|
89 fi
|
Chris@1
|
90
|
Chris@1
|
91 echo "PASSED (results are in $log)"
|
Chris@1
|
92
|
Chris@1
|
93 ########################################################################
|
Chris@1
|
94 #
|
Chris@1
|
95 # test_cuesheet
|
Chris@1
|
96 #
|
Chris@1
|
97 ########################################################################
|
Chris@1
|
98
|
Chris@1
|
99 log=cuesheet.log
|
Chris@1
|
100 bad_cuesheets=cuesheets/bad.*.cue
|
Chris@1
|
101 good_cuesheets=cuesheets/good.*.cue
|
Chris@1
|
102 good_leadout=`expr 80 \* 60 \* 44100`
|
Chris@1
|
103 bad_leadout=`expr $good_leadout + 1`
|
Chris@1
|
104
|
Chris@1
|
105 echo "Running test_cuesheet..."
|
Chris@1
|
106
|
Chris@1
|
107 rm -f $log
|
Chris@1
|
108
|
Chris@1
|
109 #
|
Chris@1
|
110 # negative tests
|
Chris@1
|
111 #
|
Chris@1
|
112 for cuesheet in $bad_cuesheets ; do
|
Chris@1
|
113 echo "NEGATIVE $cuesheet" >> $log 2>&1
|
Chris@1
|
114 run_test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
|
Chris@1
|
115 exit_code=$?
|
Chris@1
|
116 if [ "$exit_code" = 255 ] ; then
|
Chris@1
|
117 die "Error: test script is broken"
|
Chris@1
|
118 fi
|
Chris@1
|
119 cuesheet_pass1=${cuesheet}.1
|
Chris@1
|
120 cuesheet_pass2=${cuesheet}.2
|
Chris@1
|
121 rm -f $cuesheet_pass1 $cuesheet_pass2
|
Chris@1
|
122 done
|
Chris@1
|
123
|
Chris@1
|
124 #
|
Chris@1
|
125 # positve tests
|
Chris@1
|
126 #
|
Chris@1
|
127 for cuesheet in $good_cuesheets ; do
|
Chris@1
|
128 echo "POSITIVE $cuesheet" >> $log 2>&1
|
Chris@1
|
129 run_test_cuesheet $cuesheet $good_leadout cdda >> $log 2>&1
|
Chris@1
|
130 exit_code=$?
|
Chris@1
|
131 if [ "$exit_code" = 255 ] ; then
|
Chris@1
|
132 die "Error: test script is broken"
|
Chris@1
|
133 elif [ "$exit_code" != 0 ] ; then
|
Chris@1
|
134 die "Error: good cuesheet is broken"
|
Chris@1
|
135 fi
|
Chris@1
|
136 cuesheet_pass1=${cuesheet}.1
|
Chris@1
|
137 cuesheet_pass2=${cuesheet}.2
|
Chris@1
|
138 diff $cuesheet_pass1 $cuesheet_pass2 >> $log 2>&1 || die "Error: pass1 and pass2 output differ"
|
Chris@1
|
139 rm -f $cuesheet_pass1 $cuesheet_pass2
|
Chris@1
|
140 done
|
Chris@1
|
141
|
Chris@1
|
142 if [ $is_win = yes ] ; then
|
Chris@1
|
143 diff -w cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff"
|
Chris@1
|
144 else
|
Chris@1
|
145 diff cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff"
|
Chris@1
|
146 fi
|
Chris@1
|
147
|
Chris@1
|
148 echo "PASSED (results are in $log)"
|