Mercurial > hg > sonic-annotator
comparison tests/test-rdf-destinations/test-rdf-destinations.sh @ 147:1a6eab755c81 midi
Add MIDI destinations tests and fix feature writer bugs resulting from them
author | Chris Cannam |
---|---|
date | Tue, 14 Oct 2014 10:07:02 +0100 |
parents | 7a31201dc42d |
children |
comparison
equal
deleted
inserted
replaced
146:45480b73f4af | 147:1a6eab755c81 |
---|---|
3 . ../include.sh | 3 . ../include.sh |
4 | 4 |
5 infile1=$audiopath/3clicks8.wav | 5 infile1=$audiopath/3clicks8.wav |
6 infile2=$audiopath/6clicks8.wav | 6 infile2=$audiopath/6clicks8.wav |
7 | 7 |
8 outfile1=$audiopath/3clicks8.n3 | 8 infile1dot=$audiopath/3.clicks.8.wav |
9 outfile2=$audiopath/6clicks8.n3 | |
10 | 9 |
11 infile1dot=$audiopath/3.clicks.8.wav | 10 outfile1=3clicks8.n3 |
12 outfile1dot=$audiopath/3.clicks.8.n3 | 11 outfile2=6clicks8.n3 |
13 | 12 |
14 outfile3=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 | 13 outfile3=3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 |
15 outfile4=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 | 14 outfile4=3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 |
16 outfile5=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 | 15 outfile5=6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 |
17 outfile6=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 | 16 outfile6=6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 |
17 | |
18 outfile1dot=3.clicks.8.n3 | |
18 | 19 |
19 tmpttl=$mypath/tmp_1_$$.ttl | 20 tmpttl=$mypath/tmp_1_$$.ttl |
20 | 21 |
21 trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot" 0 | 22 trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot $audiopath/$outfile1 $audiopath/$outfile2 $audiopath/$outfile3 $audiopath/$outfile4 $audiopath/$outfile5 $audiopath/$outfile6 $audiopath/$outfile1dot" 0 |
22 | 23 |
23 transformdir=$mypath/transforms | 24 transformdir=$mypath/transforms |
24 | 25 |
25 check_rdf() { | 26 check_rdf() { |
26 test -f $1 || \ | 27 test -f $1 || \ |
33 } | 34 } |
34 | 35 |
35 | 36 |
36 ctx="onsets transform, one audio file, default RDF writer destination" | 37 ctx="onsets transform, one audio file, default RDF writer destination" |
37 | 38 |
38 rm -f $outfile1 | 39 rm -f $audiopath/$outfile1 |
39 | 40 |
40 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null || \ | 41 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null || \ |
41 fail "Fails to run with $ctx" | 42 fail "Fails to run with $ctx" |
42 | 43 |
43 check_rdf $outfile1 "$ctx" | 44 check_rdf $audiopath/$outfile1 "$ctx" |
44 | 45 |
45 | 46 |
46 ctx="onsets transform, one audio file with dots in filename, default RDF writer destination" | 47 ctx="onsets transform, one audio file with dots in filename, default RDF writer destination" |
47 | 48 |
48 rm -f $outfile1 | 49 rm -f $audiopath/$outfile1 |
49 | 50 |
50 cp $infile1 $infile1dot | 51 cp $infile1 $infile1dot |
51 | 52 |
52 $r -t $transformdir/onsets.n3 -w rdf $infile1dot 2>/dev/null || \ | 53 $r -t $transformdir/onsets.n3 -w rdf $infile1dot 2>/dev/null || \ |
53 fail "Fails to run with $ctx" | 54 fail "Fails to run with $ctx" |
54 | 55 |
55 check_rdf $outfile1dot "$ctx" | 56 check_rdf $audiopath/$outfile1dot "$ctx" |
56 | 57 |
57 rm -f $infile1dot $outfile1dot | 58 rm -f $infile1dot $audiopath/$outfile1dot |
58 | 59 |
59 | 60 |
60 ctx="onsets and df transforms, one audio file, default RDF writer destination" | 61 ctx="onsets and df transforms, one audio file, default RDF writer destination" |
61 | 62 |
62 rm -f $outfile1 | 63 rm -f $audiopath/$outfile1 |
63 | 64 |
64 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile1 2>/dev/null || \ | 65 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile1 2>/dev/null || \ |
65 fail "Fails to run with $ctx" | 66 fail "Fails to run with $ctx" |
66 | 67 |
67 check_rdf $outfile1 "$ctx" | 68 check_rdf $audiopath/$outfile1 "$ctx" |
68 | 69 |
69 | 70 |
70 ctx="onsets transform, two audio files, default RDF writer destination" | 71 ctx="onsets transform, two audio files, default RDF writer destination" |
71 | 72 |
72 rm -f $outfile1 | 73 rm -f $audiopath/$outfile1 |
73 rm -f $outfile2 | 74 rm -f $audiopath/$outfile2 |
74 | 75 |
75 $r -t $transformdir/onsets.n3 -w rdf $infile1 $infile2 2>/dev/null || \ | 76 $r -t $transformdir/onsets.n3 -w rdf $infile1 $infile2 2>/dev/null || \ |
76 fail "Fails to run with $ctx" | 77 fail "Fails to run with $ctx" |
77 | 78 |
78 check_rdf $outfile1 "$ctx" | 79 check_rdf $audiopath/$outfile1 "$ctx" |
79 check_rdf $outfile2 "$ctx" | 80 check_rdf $audiopath/$outfile2 "$ctx" |
80 | 81 |
81 | 82 |
82 ctx="onsets transform, two audio files, one-file RDF writer" | 83 ctx="onsets transform, two audio files, one-file RDF writer" |
83 | 84 |
84 $r -t $transformdir/onsets.n3 -w rdf --rdf-one-file $tmpttl $infile1 $infile2 2>/dev/null || \ | 85 $r -t $transformdir/onsets.n3 -w rdf --rdf-one-file $tmpttl $infile1 $infile2 2>/dev/null || \ |
95 check_rdf $tmpttl "$ctx" | 96 check_rdf $tmpttl "$ctx" |
96 | 97 |
97 | 98 |
98 ctx="onsets transform, one audio file, many-files RDF writer" | 99 ctx="onsets transform, one audio file, many-files RDF writer" |
99 | 100 |
100 rm -f $outfile3 | 101 rm -f $audiopath/$outfile3 |
101 | 102 |
102 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 2>/dev/null || \ | 103 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 2>/dev/null || \ |
103 fail "Fails to run with $ctx" | 104 fail "Fails to run with $ctx" |
104 | 105 |
105 check_rdf $outfile3 "$ctx" | 106 check_rdf $audiopath/$outfile3 "$ctx" |
106 | 107 |
107 | 108 |
108 ctx="onsets transform, two audio files, many-files RDF writer" | 109 ctx="onsets transform, two audio files, many-files RDF writer" |
109 | 110 |
110 rm -f $outfile3 | 111 rm -f $audiopath/$outfile3 |
111 rm -f $outfile5 | 112 rm -f $audiopath/$outfile5 |
112 | 113 |
113 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ | 114 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ |
114 fail "Fails to run with $ctx" | 115 fail "Fails to run with $ctx" |
115 | 116 |
116 check_rdf $outfile3 "$ctx" | 117 check_rdf $audiopath/$outfile3 "$ctx" |
117 check_rdf $outfile5 "$ctx" | 118 check_rdf $audiopath/$outfile5 "$ctx" |
118 | 119 |
119 | 120 |
120 ctx="onsets and df transforms, two audio files, many-files RDF writer" | 121 ctx="onsets and df transforms, two audio files, many-files RDF writer" |
121 | 122 |
122 rm -f $outfile3 | 123 rm -f $audiopath/$outfile3 |
123 rm -f $outfile4 | 124 rm -f $audiopath/$outfile4 |
124 rm -f $outfile5 | 125 rm -f $audiopath/$outfile5 |
125 rm -f $outfile6 | 126 rm -f $audiopath/$outfile6 |
126 | 127 |
127 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ | 128 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ |
128 fail "Fails to run with $ctx" | 129 fail "Fails to run with $ctx" |
129 | 130 |
130 check_rdf $outfile3 "$ctx" | 131 check_rdf $audiopath/$outfile3 "$ctx" |
131 check_rdf $outfile4 "$ctx" | 132 check_rdf $audiopath/$outfile4 "$ctx" |
132 check_rdf $outfile5 "$ctx" | 133 check_rdf $audiopath/$outfile5 "$ctx" |
133 check_rdf $outfile6 "$ctx" | 134 check_rdf $audiopath/$outfile6 "$ctx" |
135 | |
136 | |
137 ctx="output base directory" | |
138 | |
139 rm -f ./$outfile1 | |
140 | |
141 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf --rdf-basedir . $infile1 2>/dev/null || \ | |
142 fail "Fails to run with $ctx" | |
143 | |
144 check_rdf ./$outfile1 "$ctx" | |
145 | |
146 | |
147 ctx="output base directory and many-files" | |
148 | |
149 rm -f ./$outfile3 | |
150 rm -f ./$outfile5 | |
151 | |
152 $r -t $transformdir/onsets.n3 -w rdf --rdf-basedir . --rdf-many-files $infile1 $infile2 2>/dev/null || \ | |
153 fail "Fails to run with $ctx" | |
154 | |
155 check_rdf ./$outfile3 "$ctx" | |
156 check_rdf ./$outfile5 "$ctx" | |
157 | |
158 | |
159 ctx="nonexistent output base directory" | |
160 | |
161 $r -t $transformdir/onsets.n3 -w rdf --rdf-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \ | |
162 fail "Fails with $ctx by completing successfully (should refuse and bail out)" | |
134 | 163 |
135 | 164 |
136 ctx="existing output file and no --rdf-force" | 165 ctx="existing output file and no --rdf-force" |
137 | 166 |
138 touch $outfile1 | 167 touch $audiopath/$outfile1 |
139 | 168 |
140 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null && \ | 169 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null && \ |
141 fail "Fails by completing successfully when output file already exists (should refuse and bail out)" | 170 fail "Fails by completing successfully when output file already exists (should refuse and bail out)" |
142 | 171 |
143 | 172 |
144 ctx="existing output file and --rdf-force" | 173 ctx="existing output file and --rdf-force" |
145 | 174 |
146 touch $outfile1 | 175 touch $audiopath/$outfile1 |
147 | 176 |
148 $r -t $transformdir/onsets.n3 -w rdf --rdf-force $infile1 2>/dev/null || \ | 177 $r -t $transformdir/onsets.n3 -w rdf --rdf-force $infile1 2>/dev/null || \ |
149 fail "Fails to run with $ctx" | 178 fail "Fails to run with $ctx" |
150 | 179 |
151 check_rdf $outfile1 "$ctx" | 180 check_rdf $audiopath/$outfile1 "$ctx" |
152 | 181 |
153 | 182 |
154 exit 0 | 183 exit 0 |