comparison tests/test-rdf-destinations/test-rdf-destinations.sh @ 122:eb0f3a2029b8

Merge from test-reorg branch
author Chris Cannam
date Wed, 08 Oct 2014 15:38:48 +0100
parents 7a31201dc42d
children 1a6eab755c81
comparison
equal deleted inserted replaced
117:5be4995f4029 122:eb0f3a2029b8
1 #!/bin/bash
2
3 . ../include.sh
4
5 infile1=$audiopath/3clicks8.wav
6 infile2=$audiopath/6clicks8.wav
7
8 outfile1=$audiopath/3clicks8.n3
9 outfile2=$audiopath/6clicks8.n3
10
11 infile1dot=$audiopath/3.clicks.8.wav
12 outfile1dot=$audiopath/3.clicks.8.n3
13
14 outfile3=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3
15 outfile4=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3
16 outfile5=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3
17 outfile6=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3
18
19 tmpttl=$mypath/tmp_1_$$.ttl
20
21 trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot" 0
22
23 transformdir=$mypath/transforms
24
25 check_rdf() {
26 test -f $1 || \
27 fail "Fails to write output to expected location $1 for $2"
28 rapper -i turtle $1 >/dev/null 2>&1 || \
29 fail "Fails to produce parseable RDF/TTL for $2"
30 rapper -i turtle -c $1 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || \
31 fail "RDF output contains no triples (?) for $2"
32 rm -f $1
33 }
34
35
36 ctx="onsets transform, one audio file, default RDF writer destination"
37
38 rm -f $outfile1
39
40 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null || \
41 fail "Fails to run with $ctx"
42
43 check_rdf $outfile1 "$ctx"
44
45
46 ctx="onsets transform, one audio file with dots in filename, default RDF writer destination"
47
48 rm -f $outfile1
49
50 cp $infile1 $infile1dot
51
52 $r -t $transformdir/onsets.n3 -w rdf $infile1dot 2>/dev/null || \
53 fail "Fails to run with $ctx"
54
55 check_rdf $outfile1dot "$ctx"
56
57 rm -f $infile1dot $outfile1dot
58
59
60 ctx="onsets and df transforms, one audio file, default RDF writer destination"
61
62 rm -f $outfile1
63
64 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile1 2>/dev/null || \
65 fail "Fails to run with $ctx"
66
67 check_rdf $outfile1 "$ctx"
68
69
70 ctx="onsets transform, two audio files, default RDF writer destination"
71
72 rm -f $outfile1
73 rm -f $outfile2
74
75 $r -t $transformdir/onsets.n3 -w rdf $infile1 $infile2 2>/dev/null || \
76 fail "Fails to run with $ctx"
77
78 check_rdf $outfile1 "$ctx"
79 check_rdf $outfile2 "$ctx"
80
81
82 ctx="onsets transform, two audio files, one-file RDF writer"
83
84 $r -t $transformdir/onsets.n3 -w rdf --rdf-one-file $tmpttl $infile1 $infile2 2>/dev/null || \
85 fail "Fails to run with $ctx"
86
87 check_rdf $tmpttl "$ctx"
88
89
90 ctx="onsets transform, two audio files, stdout RDF writer"
91
92 $r -t $transformdir/onsets.n3 -w rdf --rdf-stdout $infile1 $infile2 2>/dev/null >$tmpttl || \
93 fail "Fails to run with $ctx"
94
95 check_rdf $tmpttl "$ctx"
96
97
98 ctx="onsets transform, one audio file, many-files RDF writer"
99
100 rm -f $outfile3
101
102 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 2>/dev/null || \
103 fail "Fails to run with $ctx"
104
105 check_rdf $outfile3 "$ctx"
106
107
108 ctx="onsets transform, two audio files, many-files RDF writer"
109
110 rm -f $outfile3
111 rm -f $outfile5
112
113 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \
114 fail "Fails to run with $ctx"
115
116 check_rdf $outfile3 "$ctx"
117 check_rdf $outfile5 "$ctx"
118
119
120 ctx="onsets and df transforms, two audio files, many-files RDF writer"
121
122 rm -f $outfile3
123 rm -f $outfile4
124 rm -f $outfile5
125 rm -f $outfile6
126
127 $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
130 check_rdf $outfile3 "$ctx"
131 check_rdf $outfile4 "$ctx"
132 check_rdf $outfile5 "$ctx"
133 check_rdf $outfile6 "$ctx"
134
135
136 ctx="existing output file and no --rdf-force"
137
138 touch $outfile1
139
140 $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)"
142
143
144 ctx="existing output file and --rdf-force"
145
146 touch $outfile1
147
148 $r -t $transformdir/onsets.n3 -w rdf --rdf-force $infile1 2>/dev/null || \
149 fail "Fails to run with $ctx"
150
151 check_rdf $outfile1 "$ctx"
152
153
154 exit 0