changeset 118:0fe5abb56a6e test-reorg

Pull more stuff up into include file
author Chris Cannam
date Wed, 08 Oct 2014 14:20:45 +0100
parents 5be4995f4029
children 7a31201dc42d
files tests/test-as-advertised.sh tests/test-audioformat.sh tests/test-csv-destinations.sh tests/test-helpfulflags.sh tests/test-include.sh tests/test-multiple-audio.sh tests/test-rdf-destinations.sh tests/test-rdf-writer.sh tests/test-summaries.sh tests/test-transforms-basic.sh tests/test-vamp-test-plugin.sh
diffstat 11 files changed, 31 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- 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:' | \
--- 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" ; \
--- 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() {
--- 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
--- 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"
--- 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
--- 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() {
--- 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
--- 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
--- 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 \
--- 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 || \