blob: a00e7d1cc682aa29ad5439f3741032a3c91bc97f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
#!/bin/sh -e
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2004-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
. ./common.sh
PATH=../src/flac:$PATH
PATH=../src/metaflac:$PATH
PATH=../src/test_seeking:$PATH
PATH=../src/test_streams:$PATH
PATH=../objs/$BUILD/bin:$PATH
if [ -z "$FLAC__TEST_LEVEL" ] ; then
FLAC__TEST_LEVEL=1
fi
flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
metaflac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"
run_flac ()
{
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
flac${EXE} --no-error-on-compression-fail $*
fi
}
run_metaflac ()
{
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
metaflac${EXE} $*
fi
}
run_test_seeking ()
{
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
test_seeking${EXE} $*
fi
}
echo $ECHO_N "Checking for --ogg support in flac ... " $ECHO_C
if flac${EXE} --ogg --no-error-on-compression-fail --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then
has_ogg=yes;
else
has_ogg=no;
fi
echo ${has_ogg}
echo "Generating streams..."
if [ ! -f noise.raw ] ; then
test_streams || die "ERROR during test_streams"
fi
echo "generating FLAC files for seeking:"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S- --output-name=tiny.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 -S- --output-name=small.flac noise.raw || die "ERROR generating FLAC file"
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_seek_count=100
if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
small_seek_count=10000
else
small_seek_count=100
fi
for suffix in '' '-s' ; do
echo "testing tiny$suffix.flac:"
if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
die "ERROR: during test_seeking"
fi
echo "testing small$suffix.flac:"
if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
die "ERROR: during test_seeking"
fi
echo "removing sample count from tiny$suffix.flac and small$suffix.flac:"
if run_metaflac --no-filename --set-total-samples=0 tiny$suffix.flac small$suffix.flac ; then : ; else
die "ERROR: during metaflac"
fi
echo "testing tiny$suffix.flac with total_samples=0:"
if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
die "ERROR: during test_seeking"
fi
echo "testing small$suffix.flac with total_samples=0:"
if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
die "ERROR: during test_seeking"
fi
done
if [ $has_ogg = "yes" ] ; then
echo "generating Ogg FLAC files for seeking:"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 --output-name=tiny.oga --ogg noise8m32.raw || die "ERROR generating Ogg FLAC file"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 --output-name=small.oga --ogg noise.raw || die "ERROR generating Ogg FLAC file"
# seek tables are not used in Ogg FLAC
echo "testing tiny.oga:"
if run_test_seeking tiny.oga $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
die "ERROR: during test_seeking"
fi
echo "testing small.oga:"
if run_test_seeking small.oga $small_seek_count $small_samples noise.raw ; then : ; else
die "ERROR: during test_seeking"
fi
fi
rm -f tiny.flac tiny.oga small.flac small.oga tiny-s.flac small-s.flac
|