diff tests/test-json-destinations/test-json-destinations.sh @ 197:3b7ec45abd1c

Add mandatory option --json-format to JSON feature writer, in preparation for supporting multiple JSON formats (perhaps) in future
author Chris Cannam
date Tue, 01 Sep 2015 17:05:32 +0100
parents 4ef452f5fefc
children
line wrap: on
line diff
--- a/tests/test-json-destinations/test-json-destinations.sh	Tue Sep 01 15:51:07 2015 +0100
+++ b/tests/test-json-destinations/test-json-destinations.sh	Tue Sep 01 17:05:32 2015 +0100
@@ -23,12 +23,14 @@
 
 transformdir=$mypath/transforms
 
+mandatory="-w json --json-format jams"
+
 
 ctx="onsets transform, one audio file, default JSON writer destination"
 
 rm -f $audiopath/$outfile1
 
-$r -t $transformdir/onsets.n3 -w json $infile1 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory $infile1 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile1 "$ctx"
@@ -40,7 +42,7 @@
 
 cp $infile1 $infile1dot
 
-$r -t $transformdir/onsets.n3 -w json $infile1dot 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory $infile1dot 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile1dot "$ctx"
@@ -52,7 +54,7 @@
 
 rm -f $audiopath/$outfile1
 
-$r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w json $infile1 2>/dev/null || \
+$r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory $infile1 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile1 "$ctx"
@@ -63,7 +65,7 @@
 rm -f $audiopath/$outfile1
 rm -f $audiopath/$outfile2
 
-$r -t $transformdir/onsets.n3 -w json $infile1 $infile2 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory $infile1 $infile2 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile1 "$ctx"
@@ -72,7 +74,7 @@
 
 ctx="onsets transform, two audio files, one-file JSON writer"
 
-$r -t $transformdir/onsets.n3 -w json --json-one-file $tmpjson $infile1 $infile2 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory --json-one-file $tmpjson $infile1 $infile2 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $tmpjson "$ctx"
@@ -80,7 +82,7 @@
 
 ctx="onsets transform, two audio files, stdout JSON writer"
 
-$r -t $transformdir/onsets.n3 -w json --json-stdout $infile1 $infile2 2>/dev/null >$tmpjson || \
+$r -t $transformdir/onsets.n3 $mandatory --json-stdout $infile1 $infile2 2>/dev/null >$tmpjson || \
     fail "Fails to run with $ctx"
 
 check_json $tmpjson "$ctx"
@@ -90,7 +92,7 @@
 
 rm -f $audiopath/$outfile3
 
-$r -t $transformdir/onsets.n3 -w json --json-many-files $infile1 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory --json-many-files $infile1 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile3 "$ctx"
@@ -101,7 +103,7 @@
 rm -f $audiopath/$outfile3
 rm -f $audiopath/$outfile5
 
-$r -t $transformdir/onsets.n3 -w json --json-many-files $infile1 $infile2 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory --json-many-files $infile1 $infile2 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile3 "$ctx"
@@ -115,7 +117,7 @@
 rm -f $audiopath/$outfile5
 rm -f $audiopath/$outfile6
 
-$r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w json --json-many-files $infile1 $infile2 2>/dev/null || \
+$r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory --json-many-files $infile1 $infile2 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile3 "$ctx"
@@ -128,7 +130,7 @@
 
 rm -f ./$outfile1
 
-$r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w json --json-basedir . $infile1 2>/dev/null || \
+$r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory --json-basedir . $infile1 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json ./$outfile1 "$ctx"
@@ -139,7 +141,7 @@
 rm -f ./$outfile3
 rm -f ./$outfile5
 
-$r -t $transformdir/onsets.n3 -w json --json-basedir . --json-many-files $infile1 $infile2 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory --json-basedir . --json-many-files $infile1 $infile2 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json ./$outfile3 "$ctx"
@@ -148,7 +150,7 @@
 
 ctx="nonexistent output base directory"
 
-$r -t $transformdir/onsets.n3 -w json --json-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \
+$r -t $transformdir/onsets.n3 $mandatory --json-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \
     fail "Fails with $ctx by completing successfully (should refuse and bail out)"
 
 
@@ -156,7 +158,7 @@
 
 touch $audiopath/$outfile1
 
-$r -t $transformdir/onsets.n3 -w json $infile1 2>/dev/null && \
+$r -t $transformdir/onsets.n3 $mandatory $infile1 2>/dev/null && \
     fail "Fails by completing successfully when output file already exists (should refuse and bail out)"
 
 
@@ -164,7 +166,7 @@
 
 touch $audiopath/$outfile1
 
-$r -t $transformdir/onsets.n3 -w json --json-force $infile1 2>/dev/null || \
+$r -t $transformdir/onsets.n3 $mandatory --json-force $infile1 2>/dev/null || \
     fail "Fails to run with $ctx"
 
 check_json $audiopath/$outfile1 "$ctx"