# HG changeset patch # User Chris Cannam # Date 1412774445 -3600 # Node ID 0fe5abb56a6e5c1f76d7d95423e853359ad8927c # Parent 5be4995f4029aef64897dc49cce9691f84c73571 Pull more stuff up into include file diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-as-advertised.sh --- a/tests/test-as-advertised.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-as-advertised.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,20 +1,13 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile=$mypath/audio/3clicks8.wav -testplug=vamp:vamp-example-plugins:percussiononsets tmpdir=$mypath/tmp_1_$$.dir tmpwav=$tmpdir/test.wav trap "rm -rf $tmpdir" 0 -fail() { - echo "Test failed: $1" - exit 1 -} - types=`\ $r --help 2>&1 | \ grep 'Supported writer types are:' | \ diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-audioformat.sh --- a/tests/test-audioformat.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-audioformat.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,17 +1,13 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh 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 @@ -34,7 +30,7 @@ if [ "$extension" = "wav" ]; then csvcompare $tmpfile2 $expected || \ - fail "Output mismatch for transform $transform with audio file $infile" + faildiff "Output mismatch for transform $transform with audio file $infile" $tmpfile2 $expected else csvcompare $tmpfile2 $expected || \ ( echo "NOTE: Output mismatch for transform $transform with audio file $infile" ; \ diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-csv-destinations.sh --- a/tests/test-csv-destinations.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-csv-destinations.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,7 +1,6 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile1=$mypath/audio/3clicks8.wav infile2=$mypath/audio/6clicks8.wav @@ -15,16 +14,10 @@ outfile3=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.csv outfile4=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.csv -testplug=vamp:vamp-example-plugins:percussiononsets tmpcsv=$mypath/tmp_1_$$.csv trap "rm -f $tmpcsv $outfile1 $outfile2 $outfile3 $outfile4 $infile1dot $outfile1dot" 0 -fail() { - echo "Test failed: $1" - exit 1 -} - transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets check_csv() { diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-helpfulflags.sh --- a/tests/test-helpfulflags.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-helpfulflags.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,15 +1,6 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator - -testplug=vamp:vamp-example-plugins:percussiononsets -testplug2=vamp:vamp-test-plugin:vamp-test-plugin - -fail() { - echo "Test failed: $1" - exit 1 -} +. test-include.sh $r >/dev/null 2>&1 && \ fail "Return code 0 when run without args (should be a failure code)" @@ -23,22 +14,22 @@ $r --list >/dev/null 2>&1 || \ fail "Fails to run with --list" +$r --list 2>/dev/null | grep -q $percplug || \ + fail "Fails to print $percplug in plugin list (if you haven't got it, install it -- it's needed for other tests)" + $r --list 2>/dev/null | grep -q $testplug || \ fail "Fails to print $testplug in plugin list (if you haven't got it, install it -- it's needed for other tests)" -$r --list 2>/dev/null | grep -q $testplug2 || \ - fail "Fails to print $testplug2 in plugin list (if you haven't got it, install it -- it's needed for other tests)" +$r --skeleton $percplug >/dev/null || \ + fail "Fails to run with --skeleton $percplug" -$r --skeleton $testplug >/dev/null || \ - fail "Fails to run with --skeleton $testplug" +$r -s $percplug >/dev/null || \ + fail "Fails to run with -s $percplug" -$r -s $testplug >/dev/null || \ - fail "Fails to run with -s $testplug" +$r --skeleton $percplug >/dev/null || \ + fail "Fails to run with --skeleton $percplug" -$r --skeleton $testplug >/dev/null || \ - fail "Fails to run with --skeleton $testplug" - -$r --skeleton $testplug | rapper -i turtle - test >/dev/null 2>&1 || \ - fail "Invalid XML skeleton produced with --skeleton $testplug" +$r --skeleton $percplug | rapper -i turtle - test >/dev/null 2>&1 || \ + fail "Invalid XML skeleton produced with --skeleton $percplug" exit 0 diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-include.sh --- a/tests/test-include.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-include.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,3 +1,9 @@ + +mypath=`dirname $0` +r=$mypath/../sonic-annotator + +percplug=vamp:vamp-example-plugins:percussiononsets +testplug=vamp:vamp-test-plugin:vamp-test-plugin fail() { echo "Test failed: $1" diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-multiple-audio.sh --- a/tests/test-multiple-audio.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-multiple-audio.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,14 +1,11 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh tmpfile=$mypath/tmp_1_$$ trap "rm -f $tmpfile" 0 -. test-include.sh - transform=$mypath/transforms/transforms-summaries-percussiononsets-detectionfunction.n3 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-rdf-destinations.sh --- a/tests/test-rdf-destinations.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-rdf-destinations.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,7 +1,6 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile1=$mypath/audio/3clicks8.wav infile2=$mypath/audio/6clicks8.wav @@ -17,16 +16,10 @@ outfile5=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 outfile6=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 -testplug=vamp:vamp-example-plugins:percussiononsets tmpttl=$mypath/tmp_1_$$.ttl trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot" 0 -fail() { - echo "Test failed: $1" - exit 1 -} - transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets check_rdf() { diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-rdf-writer.sh --- a/tests/test-rdf-writer.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-rdf-writer.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,19 +1,12 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile=$mypath/audio/3clicks8.wav -testplug=vamp:vamp-example-plugins:percussiononsets tmpttl=$mypath/tmp_1_$$.ttl trap "rm -f $tmpttl" 0 -fail() { - echo "Test failed: $1" - exit 1 -} - transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets for rdfarg in "" "--rdf-plain" ; do diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-summaries.sh --- a/tests/test-summaries.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-summaries.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,7 +1,6 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile=$mypath/audio/3clicks8.wav infile2=$mypath/audio/6clicks8.wav @@ -13,8 +12,6 @@ trap "rm -f $tmpfile $tmpcanonical $expcanonical $tmpcmp1 $tmpcmp2" 0 -. test-include.sh - compare() { a=$1 b=$2 diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-transforms-basic.sh --- a/tests/test-transforms-basic.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-transforms-basic.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,25 +1,21 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile=$mypath/audio/3clicks8.wav -testplug=vamp:vamp-example-plugins:percussiononsets tmpfile1=$mypath/tmp_1_$$ tmpfile2=$mypath/tmp_2_$$ trap "rm -f $tmpfile1 $tmpfile2" 0 -. test-include.sh - -$r --skeleton $testplug > $tmpfile1 2>/dev/null || \ - fail "Fails to run with --skeleton $testplug" +$r --skeleton $percplug > $tmpfile1 2>/dev/null || \ + fail "Fails to run with --skeleton $percplug" $r -t $tmpfile1 -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \ fail "Fails to run with -t $tmpfile -w csv --csv-stdout $infile" csvcompare $tmpfile2 $mypath/expected/transforms-basic-skeleton-1.csv || \ - fail "Output mismatch for transforms-basic-skeleton-1.csv" + faildiff "Output mismatch for transforms-basic-skeleton-1.csv" $tmpfile2 $mypath/expected/transforms-basic-skeleton-1.csv for suffix in \ -no-parameters-default-output \ diff -r 5be4995f4029 -r 0fe5abb56a6e tests/test-vamp-test-plugin.sh --- a/tests/test-vamp-test-plugin.sh Wed Oct 08 13:14:39 2014 +0100 +++ b/tests/test-vamp-test-plugin.sh Wed Oct 08 14:20:45 2014 +0100 @@ -1,21 +1,12 @@ #!/bin/bash -mypath=`dirname $0` -r=$mypath/../sonic-annotator +. test-include.sh infile=$mypath/audio/20sec-silence.wav -testplug=vamp:vamp-test-plugin:vamp-test-plugin tmpcsv=$mypath/tmp_1_$$.csv trap "rm -f $tmpcsv" 0 -. test-include.sh - -fail() { - echo "Test failed: $1" - exit 1 -} - for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do $r -d "$testplug:$output" -w csv --csv-one-file "$tmpcsv" --csv-force "$infile" 2>/dev/null || \