view tests/test-audioformat.sh @ 59:52b9d58edb78

Ensure expected output (as well as test output) gets canonicalised before comparison. The test in question still fails -- I think now only because of plugin output ordering changes (prior to svcore rev f3fd2988fc9b it also had picked up some incorrect output feature types)
author Chris Cannam
date Mon, 09 Jan 2012 16:30:44 +0000
parents 94d988cef54e
children 0fe5abb56a6e
line wrap: on
line source
#!/bin/bash

mypath=`dirname $0`
r=$mypath/../sonic-annotator

inbase=$mypath/audio/3clicks
testplug=vamp:vamp-example-plugins:percussiononsets
tmpfile1=$mypath/tmp_1_$$
tmpfile2=$mypath/tmp_2_$$

trap "rm -f $tmpfile1 $tmpfile2" 0

. test-include.sh

for extension in wav ogg mp3 ; do

    transform=$mypath/transforms/transforms-audioformat-percussiononsets.n3 
    expected=$mypath/expected/transforms-audioformat-percussiononsets-$extension.csv

    test -f $transform || \
	fail "Internal error: no transforms file for suffix $suffix"

    test -f $expected || \
	fail "Internal error: no expected output file for suffix $suffix"

    infile=$inbase.$extension
    if [ "$extension" = "wav" ]; then infile=${inbase}8.$extension; fi

    test -f $infile || \
	fail "Internal error: no input audio file for extension $extension"

    $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
	fail "Fails to run transform $transform against audio file $infile"

    if [ "$extension" = "wav" ]; then
	csvcompare $tmpfile2 $expected || \
	    fail "Output mismatch for transform $transform with audio file $infile"
    else
	csvcompare $tmpfile2 $expected || \
	    ( echo "NOTE: Output mismatch for transform $transform with audio file $infile" ; \
	      echo "This may be the result of differences in the audio file decoder, so I am not" ; \
	      echo "failing the test, but I recommend that you check the results." )
    fi
done

exit 0