comparison tests/test-rdf-writer/test-rdf-writer.sh @ 191:4ef452f5fefc

Add (failing) test for JSON output format (fails for grid output)
author Chris Cannam
date Wed, 22 Jul 2015 14:25:14 +0100
parents cbbf8a838b47
children 68daabfc4ccc
comparison
equal deleted inserted replaced
190:2d2253469ca4 191:4ef452f5fefc
2 2
3 . ../include.sh 3 . ../include.sh
4 4
5 infile=$audiopath/3clicks8.wav 5 infile=$audiopath/3clicks8.wav
6 tmpttl=$mypath/tmp_1_$$.ttl 6 tmpttl=$mypath/tmp_1_$$.ttl
7
8 silentfile=$audiopath/20sec-silence.wav
7 9
8 trap "rm -f $tmpttl" 0 10 trap "rm -f $tmpttl" 0
9 11
10 transformdir=$mypath/transforms 12 transformdir=$mypath/transforms
11 13
12 for rdfarg in "" "--rdf-plain" ; do 14 for rdfarg in "" "--rdf-plain" ; do
13 15
14 note="" 16 note=""
15 [ -n "$rdfarg" ] && note=" with $rdfarg" 17 [ -n "$rdfarg" ] && note=" with $rdfarg"
16 18
17 rm -f $tmpttl 19 rm -f "$tmpttl"
18 20
19 $r -t $transformdir/onsets.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \ 21 $r -t $transformdir/onsets.n3 -w rdf $infile $rdfarg --rdf-one-file "$tmpttl" 2>/dev/null || \
20 fail "Fails to run with onsets transform and RDF writer$note" 22 fail "Fails to run with onsets transform and RDF writer$note"
21 23
22 rapper -i turtle $tmpttl >/dev/null 2>&1 || \ 24 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
23 fail "Fails to produce parseable RDF/TTL for onsets transform$note" 25 fail "Fails to produce parseable RDF/TTL for onsets transform$note"
24 26
25 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || 27 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
26 fail "RDF output contains no triples (?) for onsets transform$note" 28 fail "RDF output contains no triples (?) for onsets transform$note"
27 29
28 rm -f $tmpttl 30 rm -f "$tmpttl"
29 31
30 $r -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \ 32 $r -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file "$tmpttl" 2>/dev/null || \
31 fail "Fails to run with detectionfunction transform and RDF writer$note" 33 fail "Fails to run with detectionfunction transform and RDF writer$note"
32 34
33 rapper -i turtle $tmpttl >/dev/null 2>&1 || \ 35 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
34 fail "Fails to produce parseable RDF/TTL for detectionfunction transform$note" 36 fail "Fails to produce parseable RDF/TTL for detectionfunction transform$note"
35 37
36 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || 38 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
37 fail "RDF output contains no triples (?) for detectionfunction transform$note" 39 fail "RDF output contains no triples (?) for detectionfunction transform$note"
38 40
39 rm -f $tmpttl 41 rm -f "$tmpttl"
40 42
41 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \ 43 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file "$tmpttl" 2>/dev/null || \
42 fail "Fails to run with detectionfunction and onsets transforms together and RDF writer$note" 44 fail "Fails to run with detectionfunction and onsets transforms together and RDF writer$note"
43 45
44 rapper -i turtle $tmpttl >/dev/null 2>&1 || \ 46 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
45 fail "Fails to produce parseable RDF/TTL for detectionfunction and onsets transforms together$note" 47 fail "Fails to produce parseable RDF/TTL for detectionfunction and onsets transforms together$note"
46 48
47 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || 49 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
48 fail "RDF output contains no triples (?) for detectionfunction and onsets transforms together$note" 50 fail "RDF output contains no triples (?) for detectionfunction and onsets transforms together$note"
49 51
52 # And the various structures emitted by the Vamp test plugin
53 for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do
54
55 $r -d "$testplug:$output" -w rdf --rdf-one-file "$tmpttl" --rdf-force "$silentfile" 2>/dev/null || \
56 fail "Failed to run for plugin $testplug with output $output"
57
58 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
59 fail "Fails to produce parseable RDF/TTL for test plugin output $output"
60
61 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
62 fail "RDF output contains no triples (?) for test plugin output $output"
63 done
50 done 64 done
51 65
52 # Check the output encoding -- should be valid UTF-8 always 66 # Check the output encoding -- should be valid UTF-8 always
53 67
54 for code in ucs-2 iso-8859-1; do 68 for code in ucs-2 iso-8859-1; do