diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2013-03-04 21:24:51 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2013-03-04 21:24:58 +1100 |
commit | 0432b9649071814ee462743528ad4f2bcc68408c (patch) | |
tree | ab6efd2fd0c93fc4cff1a7018dfbf2c79e838679 /test/test_compression.sh | |
parent | 538ce85eaed7a4a741c2ff96b477f2cfc81ad814 (diff) | |
download | flac-0432b9649071814ee462743528ad4f2bcc68408c.tar.gz |
test/test_compression.sh : Use wc instead of stat to get file size.
The stat program has different command line parameters depend on
whether its the GNU or BSD version. Sitch to 'wc -c' instead which
seems more portable.
Plus other minor improvements.
Diffstat (limited to 'test/test_compression.sh')
-rwxr-xr-x | test/test_compression.sh | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/test/test_compression.sh b/test/test_compression.sh index ed2302b6..2fc9ebc5 100755 --- a/test/test_compression.sh +++ b/test/test_compression.sh @@ -27,24 +27,25 @@ LD_LIBRARY_PATH=`pwd`/../objs/$BUILD/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH PATH=`pwd`/../src/flac:$PATH -echo "Using FLAC binary :" `which flac` +echo "Using FLAC binary :" $(which flac) date=`date "+%Y%m%dT%H%M%S"` fname="comp${date}.flac" -last_size=0 last_k=0 -for k in `seq 1 8` ; do +last_size=$(wc -c < noisy-sine.wav) + +echo "Original file size ${last_size} bytes." + +for k in $(seq 1 8) ; do flac -${k} --silent noisy-sine.wav -o ${fname} - size=`stat --format="%s" ${fname}` + size=$(wc -c < ${fname}) echo "Compression level ${k}, file size ${size} bytes." - if test $k -gt 1 ; then - if test $last_size -lt $size ; then - echo "Error : Compression $last_k size $last_size >= compression $k size $size." - exit 1 - fi + if test ${last_size} -lt ${size} ; then + echo "Error : Compression ${last_k} size $last_size >= compression $k size $size." + exit 1 fi - last_size=$size - last_k=$k - rm -f $fname + last_size=${size} + last_k=${k} + rm -f ${fname} done |