initial import
[flac.git] / test / test_bins.sh
1 #!/bin/sh
2
3 LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/lib:$LD_LIBRARY_PATH
4 export LD_LIBRARY_PATH
5 PATH=../src/flac:../obj/bin:$PATH
6 BINS_PATH=../../test_files/bins
7
8 test_file ()
9 {
10         name=$1
11         channels=$2
12         bps=$3
13         encode_options="$4"
14
15         echo -n "$name: encode..."
16         cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options $name.bin"
17         echo "### ENCODE $name #######################################################" >> ./streams.log
18         echo "###    cmd=$cmd" >> ./streams.log
19         if $cmd 2>>./streams.log ; then : ; else
20                 echo "ERROR during encode of $name" 1>&2
21                 exit 1
22         fi
23         echo -n "decode..."
24         cmd="flac -s -fb -d -fr $name.flac";
25         echo "### DECODE $name #######################################################" >> ./streams.log
26         echo "###    cmd=$cmd" >> ./streams.log
27         if $cmd 2>>./streams.log ; then : ; else
28                 echo "ERROR during decode of $name" 1>&2
29                 exit 1
30         fi
31         ls -1l $name.bin >> ./streams.log
32         ls -1l $name.flac >> ./streams.log
33         ls -1l $name.raw >> ./streams.log
34         echo -n "compare..."
35         if cmp $name.bin $name.raw ; then : ; else
36                 echo "ERROR during compare of $name" 1>&2
37                 exit 1
38         fi
39         echo OK
40 }
41
42 echo "Testing bins..."
43 for f in b00 b01 b02 b03 ; do
44         for opt in 0 1 2 4 5 6 8 ; do
45                 for extras in '' '-p' '-e' ; do
46                         for blocksize in '' '-b 32' '-b 32768' '-b 65535' ; do
47                                 for channels in 1 2 4 8 ; do
48                                         for bps in 8 16 24 ; do
49                                                 test_file $BINS_PATH/$f $channels $bps "-$opt $extras $blocksize"
50                                         done
51                                 done
52                         done
53                 done
54         done
55 done