comparison tests/test-transforms-basic.sh @ 0:581b1b150a4d

* copy to sonic-annotator
author Chris Cannam
date Thu, 11 Dec 2008 10:22:33 +0000
parents
children 03a02c1f0a9f
comparison
equal deleted inserted replaced
-1:000000000000 0:581b1b150a4d
1 #!/bin/bash
2
3 mypath=`dirname $0`
4 r=$mypath/../sonic-annotator
5
6 infile=$mypath/audio/3clicks8.wav
7 testplug=vamp:vamp-example-plugins:percussiononsets
8 tmpfile1=$mypath/tmp_1_$$
9 tmpfile2=$mypath/tmp_2_$$
10
11 trap "rm -f $tmpfile1 $tmpfile2" 0
12
13 fail() {
14 echo "Test failed: $1"
15 exit 1
16 }
17
18 $r --skeleton $testplug > $tmpfile1 2>/dev/null || \
19 fail "Fails to run with --skeleton $testplug"
20
21 $r -t $tmpfile1 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
22 fail "Fails to run with -t $tmpfile -w csv --csv-stdout $infile"
23
24 cmp -s $tmpfile2 $mypath/expected/transforms-basic-skeleton-1.csv || \
25 fail "Output mismatch for transforms-basic-skeleton-1.csv"
26
27 for suffix in \
28 -no-parameters-default-output \
29 -no-parameters \
30 "" \
31 -set-parameters \
32 -set-step-and-block-size \
33 -set-sample-rate \
34 ; do
35
36 for type in xml n3 ; do
37
38 transform=$mypath/transforms/transforms-basic-percussiononsets$suffix.$type
39 expected=$mypath/expected/transforms-basic-percussiononsets$suffix.csv
40
41 test -f $transform || \
42 fail "Internal error: no transforms file for suffix $suffix"
43
44 test -f $expected || \
45 fail "Internal error: no expected output file for suffix $suffix"
46
47 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
48 fail "Fails to run transform $transform"
49
50 cmp -s $tmpfile2 $expected || \
51 fail "Output mismatch for transform $transform"
52 done
53 done
54
55 exit 0
56