Erik de Castro Lopo | 1a7c3fa | 2014-11-27 13:03:13 +1100 | [diff] [blame] | 1 | #!/bin/sh -e |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 2 | |
| 3 | # FLAC - Free Lossless Audio Codec |
Erik de Castro Lopo | b1982fb | 2013-05-25 17:11:19 +1000 | [diff] [blame] | 4 | # Copyright (C) 2001-2009 Josh Coalson |
Erik de Castro Lopo | 6a5fe43 | 2016-12-05 06:35:39 +1100 | [diff] [blame] | 5 | # Copyright (C) 2011-2016 Xiph.Org Foundation |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 6 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 7 | # This file is part the FLAC project. FLAC is comprised of several |
Ulrich Klauer | cd4ddab | 2013-05-26 22:53:43 +0200 | [diff] [blame] | 8 | # components distributed under different licenses. The codec libraries |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 9 | # are distributed under Xiph.Org's BSD-like license (see the file |
| 10 | # COPYING.Xiph in this distribution). All other programs, libraries, and |
| 11 | # plugins are distributed under the GPL (see COPYING.GPL). The documentation |
| 12 | # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the |
| 13 | # FLAC distribution contains at the top the terms under which it may be |
| 14 | # distributed. |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 15 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 16 | # Since this particular file is relevant to all components of FLAC, |
| 17 | # it may be distributed under the Xiph.Org license, which is the least |
| 18 | # restrictive of those mentioned above. See the file COPYING.Xiph in this |
| 19 | # distribution. |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 20 | |
Erik de Castro Lopo | 1a7c3fa | 2014-11-27 13:03:13 +1100 | [diff] [blame] | 21 | . ./common.sh |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 22 | |
Josh Coalson | b43d3cb | 2004-11-09 01:28:05 +0000 | [diff] [blame] | 23 | PATH=../src/test_grabbag/cuesheet:$PATH |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 24 | PATH=../src/test_grabbag/picture:$PATH |
Erik de Castro Lopo | 85d5c53 | 2013-01-02 22:37:42 +1100 | [diff] [blame] | 25 | PATH=../objs/$BUILD/bin:$PATH |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 26 | |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 27 | test_cuesheet -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_cuesheet executable" |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 28 | test_picture -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_picture executable" |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 29 | |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 30 | run_test_cuesheet () |
| 31 | { |
Josh Coalson | de9091e | 2006-05-25 02:48:22 +0000 | [diff] [blame] | 32 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Martijn van Beurden | f6585b0 | 2013-04-21 23:12:16 +0200 | [diff] [blame] | 33 | echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_cuesheet $*" >>test_grabbag.valgrind.log |
Erik de Castro Lopo | a9712a2 | 2013-09-16 19:55:11 +1000 | [diff] [blame] | 34 | valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_cuesheet${EXE} $* 4>>test_grabbag.valgrind.log |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 35 | else |
Erik de Castro Lopo | a9712a2 | 2013-09-16 19:55:11 +1000 | [diff] [blame] | 36 | test_cuesheet${EXE} $* |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 37 | fi |
| 38 | } |
| 39 | |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 40 | run_test_picture () |
| 41 | { |
| 42 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Martijn van Beurden | f6585b0 | 2013-04-21 23:12:16 +0200 | [diff] [blame] | 43 | echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_picture $*" >>test_grabbag.valgrind.log |
Erik de Castro Lopo | a9712a2 | 2013-09-16 19:55:11 +1000 | [diff] [blame] | 44 | valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_picture${EXE} $* 4>>test_grabbag.valgrind.log |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 45 | else |
Erik de Castro Lopo | a9712a2 | 2013-09-16 19:55:11 +1000 | [diff] [blame] | 46 | test_picture${EXE} $* |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 47 | fi |
| 48 | } |
| 49 | |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 50 | ######################################################################## |
| 51 | # |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 52 | # test_picture |
| 53 | # |
| 54 | ######################################################################## |
| 55 | |
| 56 | log=picture.log |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 57 | picture_dir=${top_srcdir}/test/pictures |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 58 | |
| 59 | echo "Running test_picture..." |
| 60 | |
| 61 | rm -f $log |
| 62 | |
| 63 | run_test_picture $picture_dir >> $log 2>&1 |
| 64 | |
| 65 | if [ $is_win = yes ] ; then |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 66 | diff -w ${top_srcdir}/test/picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff" |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 67 | else |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 68 | diff ${top_srcdir}/test/picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff" |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 69 | fi |
| 70 | |
| 71 | echo "PASSED (results are in $log)" |
| 72 | |
| 73 | ######################################################################## |
| 74 | # |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 75 | # test_cuesheet |
| 76 | # |
| 77 | ######################################################################## |
| 78 | |
| 79 | log=cuesheet.log |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 80 | bad_cuesheets=${top_srcdir}/test/cuesheets/bad.*.cue |
| 81 | good_cuesheets=${top_srcdir}/test/cuesheets/good.*.cue |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 82 | good_leadout=`expr 80 \* 60 \* 44100` |
| 83 | bad_leadout=`expr $good_leadout + 1` |
| 84 | |
Josh Coalson | ea86912 | 2006-11-17 07:46:09 +0000 | [diff] [blame] | 85 | echo "Running test_cuesheet..." |
| 86 | |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 87 | rm -f $log |
| 88 | |
| 89 | # |
| 90 | # negative tests |
| 91 | # |
| 92 | for cuesheet in $bad_cuesheets ; do |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 93 | echo "NEGATIVE $cuesheet" | sed "s|${top_srcdir}/test/||" >> $log 2>&1 |
Martijn van Beurden | 163b734 | 2014-03-03 14:17:56 +0100 | [diff] [blame] | 94 | run_test_cuesheet $cuesheet $good_leadout 44100 cdda >> $log 2>&1 || exit_code=$? |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 95 | if [ "$exit_code" = 255 ] ; then |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 96 | die "Error: test script is broken" |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 97 | fi |
| 98 | cuesheet_pass1=${cuesheet}.1 |
| 99 | cuesheet_pass2=${cuesheet}.2 |
| 100 | rm -f $cuesheet_pass1 $cuesheet_pass2 |
| 101 | done |
| 102 | |
| 103 | # |
luz.paz | 01eb197 | 2018-05-22 10:17:53 -0400 | [diff] [blame] | 104 | # positive tests |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 105 | # |
| 106 | for cuesheet in $good_cuesheets ; do |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 107 | echo "POSITIVE $cuesheet" | sed "s|${top_srcdir}/test/||" >> $log 2>&1 |
Josh Coalson | c9ed238 | 2009-01-07 07:03:17 +0000 | [diff] [blame] | 108 | run_test_cuesheet $cuesheet $good_leadout 44100 cdda >> $log 2>&1 |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 109 | exit_code=$? |
| 110 | if [ "$exit_code" = 255 ] ; then |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 111 | die "Error: test script is broken" |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 112 | elif [ "$exit_code" != 0 ] ; then |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 113 | die "Error: good cuesheet is broken" |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 114 | fi |
Erik de Castro Lopo | 29db3fb | 2015-02-23 19:42:30 +1100 | [diff] [blame] | 115 | cuesheet_out=$(echo $cuesheet | sed "s|${top_srcdir}/test/||") |
| 116 | cuesheet_pass1=${cuesheet_out}.1 |
| 117 | cuesheet_pass2=${cuesheet_out}.2 |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 118 | diff $cuesheet_pass1 $cuesheet_pass2 >> $log 2>&1 || die "Error: pass1 and pass2 output differ" |
Josh Coalson | cb908a6 | 2002-11-23 02:21:48 +0000 | [diff] [blame] | 119 | rm -f $cuesheet_pass1 $cuesheet_pass2 |
| 120 | done |
| 121 | |
Josh Coalson | 8f6bdf2 | 2006-10-03 01:03:12 +0000 | [diff] [blame] | 122 | if [ $is_win = yes ] ; then |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 123 | diff -w ${top_srcdir}/test/cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff" |
Josh Coalson | 8f6bdf2 | 2006-10-03 01:03:12 +0000 | [diff] [blame] | 124 | else |
Erik de Castro Lopo | 7c3cd3d | 2015-02-15 14:31:30 +1100 | [diff] [blame] | 125 | diff ${top_srcdir}/test/cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff" |
Josh Coalson | 8f6bdf2 | 2006-10-03 01:03:12 +0000 | [diff] [blame] | 126 | fi |
Josh Coalson | c3cc5b4 | 2002-12-13 05:36:34 +0000 | [diff] [blame] | 127 | |
| 128 | echo "PASSED (results are in $log)" |