Mercurial > hg > sonic-annotator
comparison tests/test-rdf-destinations.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 infile1=$mypath/audio/3clicks8.wav | |
7 infile2=$mypath/audio/6clicks8.wav | |
8 | |
9 outfile1=$mypath/audio/3clicks8.n3 | |
10 outfile2=$mypath/audio/6clicks8.n3 | |
11 | |
12 outfile3=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 | |
13 outfile4=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 | |
14 outfile5=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 | |
15 outfile6=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 | |
16 | |
17 testplug=vamp:vamp-example-plugins:percussiononsets | |
18 tmpttl=$mypath/tmp_1_$$.ttl | |
19 | |
20 trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6" 0 | |
21 | |
22 fail() { | |
23 echo "Test failed: $1" | |
24 exit 1 | |
25 } | |
26 | |
27 transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets | |
28 | |
29 check_rdf() { | |
30 test -f $1 || \ | |
31 fail "Fails to write output to expected location $1 for $2" | |
32 rapper -i turtle $1 >/dev/null 2>&1 || \ | |
33 fail "Fails to produce parseable RDF/TTL for $2" | |
34 rapper -i turtle -c $1 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || \ | |
35 fail "RDF output contains no triples (?) for $2" | |
36 rm -f $1 | |
37 } | |
38 | |
39 | |
40 ctx="onsets transform, one audio file, default RDF writer destination" | |
41 | |
42 rm -f $outfile1 | |
43 | |
44 $r -t $transformpfx-onsets.n3 -w rdf $infile1 2>/dev/null || \ | |
45 fail "Fails to run with $ctx" | |
46 | |
47 check_rdf $outfile1 "$ctx" | |
48 | |
49 | |
50 ctx="onsets and df transforms, one audio file, default RDF writer destination" | |
51 | |
52 rm -f $outfile1 | |
53 | |
54 $r -t $transformpfx-onsets.n3 -t $transformpfx-detectionfunction.n3 -w rdf $infile1 2>/dev/null || \ | |
55 fail "Fails to run with $ctx" | |
56 | |
57 check_rdf $outfile1 "$ctx" | |
58 | |
59 | |
60 ctx="onsets transform, two audio files, default RDF writer destination" | |
61 | |
62 rm -f $outfile1 | |
63 rm -f $outfile2 | |
64 | |
65 $r -t $transformpfx-onsets.n3 -w rdf $infile1 $infile2 2>/dev/null || \ | |
66 fail "Fails to run with $ctx" | |
67 | |
68 check_rdf $outfile1 "$ctx" | |
69 check_rdf $outfile2 "$ctx" | |
70 | |
71 | |
72 ctx="onsets transform, two audio files, one-file RDF writer" | |
73 | |
74 $r -t $transformpfx-onsets.n3 -w rdf --rdf-one-file $tmpttl $infile1 $infile2 2>/dev/null || \ | |
75 fail "Fails to run with $ctx" | |
76 | |
77 check_rdf $tmpttl "$ctx" | |
78 | |
79 | |
80 ctx="onsets transform, two audio files, stdout RDF writer" | |
81 | |
82 $r -t $transformpfx-onsets.n3 -w rdf --rdf-stdout $infile1 $infile2 2>/dev/null >$tmpttl || \ | |
83 fail "Fails to run with $ctx" | |
84 | |
85 check_rdf $tmpttl "$ctx" | |
86 | |
87 | |
88 ctx="onsets transform, one audio file, many-files RDF writer" | |
89 | |
90 rm -f $outfile3 | |
91 | |
92 $r -t $transformpfx-onsets.n3 -w rdf --rdf-many-files $infile1 2>/dev/null || \ | |
93 fail "Fails to run with $ctx" | |
94 | |
95 check_rdf $outfile3 "$ctx" | |
96 | |
97 | |
98 ctx="onsets transform, two audio files, many-files RDF writer" | |
99 | |
100 rm -f $outfile3 | |
101 rm -f $outfile5 | |
102 | |
103 $r -t $transformpfx-onsets.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ | |
104 fail "Fails to run with $ctx" | |
105 | |
106 check_rdf $outfile3 "$ctx" | |
107 check_rdf $outfile5 "$ctx" | |
108 | |
109 | |
110 ctx="onsets and df transforms, two audio files, many-files RDF writer" | |
111 | |
112 rm -f $outfile3 | |
113 rm -f $outfile4 | |
114 rm -f $outfile5 | |
115 rm -f $outfile6 | |
116 | |
117 $r -t $transformpfx-onsets.n3 -t $transformpfx-detectionfunction.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ | |
118 fail "Fails to run with $ctx" | |
119 | |
120 check_rdf $outfile3 "$ctx" | |
121 check_rdf $outfile4 "$ctx" | |
122 check_rdf $outfile5 "$ctx" | |
123 check_rdf $outfile6 "$ctx" | |
124 | |
125 | |
126 ctx="existing output file and no --rdf-force" | |
127 | |
128 touch $outfile1 | |
129 | |
130 $r -t $transformpfx-onsets.n3 -w rdf $infile1 2>/dev/null && \ | |
131 fail "Fails by completing successfully when output file already exists (should refuse and bail out)" | |
132 | |
133 | |
134 ctx="existing output file and --rdf-force" | |
135 | |
136 touch $outfile1 | |
137 | |
138 $r -t $transformpfx-onsets.n3 -w rdf --rdf-force $infile1 2>/dev/null || \ | |
139 fail "Fails to run with $ctx" | |
140 | |
141 check_rdf $outfile1 "$ctx" | |
142 | |
143 | |
144 exit 0 |