comparison tests/test-rdf-writer.sh @ 0:581b1b150a4d

* copy to sonic-annotator
author Chris Cannam
date Thu, 11 Dec 2008 10:22:33 +0000
parents
children 03a02c1f0a9f
comparison
equal deleted inserted replaced
-1:000000000000 0:581b1b150a4d
1 #!/bin/bash
2
3 mypath=`dirname $0`
4 r=$mypath/../sonic-annotator
5
6 infile=$mypath/audio/3clicks8.wav
7 testplug=vamp:vamp-example-plugins:percussiononsets
8 tmpttl=$mypath/tmp_1_$$.ttl
9
10 trap "rm -f $tmpttl" 0
11
12 fail() {
13 echo "Test failed: $1"
14 exit 1
15 }
16
17 transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets
18
19 for rdfarg in "" "--rdf-plain" ; do
20
21 note=""
22 [ -n "$rdfarg" ] && note=" with $rdfarg"
23
24 rm -f $tmpttl
25
26 $r -t $transformpfx-onsets.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
27 fail "Fails to run with onsets transform and RDF writer$note"
28
29 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
30 fail "Fails to produce parseable RDF/TTL for onsets transform$note"
31
32 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
33 fail "RDF output contains no triples (?) for onsets transform$note"
34
35 rm -f $tmpttl
36
37 $r -t $transformpfx-detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
38 fail "Fails to run with detectionfunction transform and RDF writer$note"
39
40 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
41 fail "Fails to produce parseable RDF/TTL for detectionfunction transform$note"
42
43 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
44 fail "RDF output contains no triples (?) for detectionfunction transform$note"
45
46 rm -f $tmpttl
47
48 $r -t $transformpfx-onsets.n3 -t $transformpfx-detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
49 fail "Fails to run with detectionfunction and onsets transforms together and RDF writer$note"
50
51 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
52 fail "Fails to produce parseable RDF/TTL for detectionfunction and onsets transforms together$note"
53
54 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
55 fail "RDF output contains no triples (?) for detectionfunction and onsets transforms together$note"
56
57 done
58
59 exit 0