annotate tests/test-transforms-basic.sh @ 8:f98b58fb294f

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