annotate tests/test-transforms-basic.sh @ 115:95de6db296a1

Merge from multiplex branch
author Chris Cannam
date Fri, 03 Oct 2014 15:07:19 +0100
parents 8b4924a9a072
children 0fe5abb56a6e
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@0 3 mypath=`dirname $0`
Chris@42 4 r=$mypath/../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@28 13 . test-include.sh
Chris@0 14
Chris@0 15 $r --skeleton $testplug > $tmpfile1 2>/dev/null || \
Chris@0 16 fail "Fails to run with --skeleton $testplug"
Chris@0 17
Chris@0 18 $r -t $tmpfile1 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
Chris@0 19 fail "Fails to run with -t $tmpfile -w csv --csv-stdout $infile"
Chris@0 20
Chris@28 21 csvcompare $tmpfile2 $mypath/expected/transforms-basic-skeleton-1.csv || \
Chris@0 22 fail "Output mismatch for transforms-basic-skeleton-1.csv"
Chris@0 23
Chris@0 24 for suffix in \
Chris@0 25 -no-parameters-default-output \
Chris@0 26 -no-parameters \
Chris@0 27 "" \
Chris@96 28 -start-and-duration \
Chris@0 29 -set-parameters \
Chris@0 30 -set-step-and-block-size \
Chris@0 31 -set-sample-rate \
Chris@51 32 -df-windowtype-default \
Chris@51 33 -df-windowtype-hanning \
Chris@51 34 -df-windowtype-hamming \
Chris@96 35 -df-start-and-duration \
Chris@55 36 -multiple-outputs \
Chris@99 37 -multiple-outputs-start-and-duration \
Chris@0 38 ; do
Chris@0 39
Chris@0 40 for type in xml n3 ; do
Chris@0 41
Chris@0 42 transform=$mypath/transforms/transforms-basic-percussiononsets$suffix.$type
Chris@0 43 expected=$mypath/expected/transforms-basic-percussiononsets$suffix.csv
Chris@0 44
Chris@55 45 if [ ! -f $transform ]; then
Chris@55 46 if [ $type = "xml" ]; then
Chris@55 47 continue # not everything can be expressed in the XML
Chris@55 48 # format, e.g. the multiple output test can't
Chris@55 49 fi
Chris@55 50 fi
Chris@55 51
Chris@0 52 test -f $transform || \
Chris@51 53 fail "Internal error: no transforms file for suffix $suffix (looking for $transform)"
Chris@0 54
Chris@0 55 test -f $expected || \
Chris@51 56 fail "Internal error: no expected output file for suffix $suffix (looking for $expected)"
Chris@0 57
Chris@0 58 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
Chris@0 59 fail "Fails to run transform $transform"
Chris@0 60
Chris@28 61 csvcompare $tmpfile2 $expected || \
Chris@108 62 faildiff "Output mismatch for transform $transform" $tmpfile2 $expected
Chris@0 63 done
Chris@0 64 done
Chris@0 65
Chris@0 66 exit 0
Chris@0 67