test/test_compression.sh : Fix for OSX.

On Mac OSX, the 'wc -c' command returns a number with leading whitespace
which then results in a syntax error when the shell parser expects a
number when it really has a string containing a number. The easy fix is
to use string interpolation.

Closes: https://sourceforge.net/p/flac/bugs/420/
Reported-by: Mark Harris <mark.hsj@gmail.com>
This commit is contained in:
Erik de Castro Lopo
2014-11-26 16:20:06 +11:00
parent ff8a74aa70
commit b147b73eab

View File

@@ -36,10 +36,12 @@ for k in 0 1 2 3 4 5 6 7 8 ; do
size=$(wc -c < ${fname})
echo "Compression level ${k}, file size ${size} bytes."
if test ${last_size} -lt ${size} ; then
echo "Error : Compression ${last_k} size $last_size >= compression $k size $size."
echo "Error : Compression ${last_k} size ${last_size} >= compression ${k} size ${size}."
exit 1
fi
let last_size=${size}+10
# Need this string interpolation because OSX's 'wc -c' returns a number with
# leading whitespace.
let last_size="${size}+10"
last_k=${k}
rm -f ${fname}
done