comparison tests/test-audioformat/test-audioformat.sh @ 119:7a31201dc42d test-reorg

Split out tests into individual directories, with simpler naming therein
author Chris Cannam
date Wed, 08 Oct 2014 15:08:57 +0100
parents tests/test-audioformat.sh@0fe5abb56a6e
children e6379b2e1c5c
comparison
equal deleted inserted replaced
118:0fe5abb56a6e 119:7a31201dc42d
1 #!/bin/bash
2
3 . ../include.sh
4
5 inbase=$audiopath/3clicks
6 tmpfile1=$mypath/tmp_1_$$
7 tmpfile2=$mypath/tmp_2_$$
8
9 trap "rm -f $tmpfile1 $tmpfile2" 0
10
11 for extension in wav ogg mp3 ; do
12
13 transform=$mypath/transforms/percussiononsets.n3
14 expected=$mypath/expected/percussiononsets-$extension.csv
15
16 test -f $transform || \
17 fail "Internal error: no transforms file"
18
19 test -f $expected || \
20 fail "Internal error: no expected output file for extension $extension"
21
22 infile=$inbase.$extension
23 if [ "$extension" = "wav" ]; then infile=${inbase}8.$extension; fi
24
25 test -f $infile || \
26 fail "Internal error: no input audio file for extension $extension"
27
28 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
29 fail "Fails to run transform $transform against audio file $infile"
30
31 if [ "$extension" = "wav" ]; then
32 csvcompare $tmpfile2 $expected || \
33 faildiff "Output mismatch for transform $transform with audio file $infile" $tmpfile2 $expected
34 else
35 csvcompare $tmpfile2 $expected || \
36 ( echo "NOTE: Output mismatch for transform $transform with audio file $infile" ; \
37 echo "This may be the result of differences in the audio file decoder, so I am not" ; \
38 echo "failing the test, but I recommend that you check the results." )
39 fi
40 done
41
42 exit 0