annotate tests/test-rdf-destinations/test-rdf-destinations.sh @ 163:f4f770b4356b

Add plugin_version to transform RDF serialisation (if non-empty)
author Chris Cannam
date Wed, 15 Oct 2014 13:06:27 +0100
parents 1a6eab755c81
children
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@119 3 . ../include.sh
Chris@0 4
Chris@119 5 infile1=$audiopath/3clicks8.wav
Chris@119 6 infile2=$audiopath/6clicks8.wav
Chris@0 7
Chris@147 8 infile1dot=$audiopath/3.clicks.8.wav
Chris@0 9
Chris@147 10 outfile1=3clicks8.n3
Chris@147 11 outfile2=6clicks8.n3
Chris@44 12
Chris@147 13 outfile3=3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3
Chris@147 14 outfile4=3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3
Chris@147 15 outfile5=6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3
Chris@147 16 outfile6=6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3
Chris@147 17
Chris@147 18 outfile1dot=3.clicks.8.n3
Chris@0 19
Chris@0 20 tmpttl=$mypath/tmp_1_$$.ttl
Chris@0 21
Chris@147 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
Chris@0 23
Chris@119 24 transformdir=$mypath/transforms
Chris@0 25
Chris@0 26 check_rdf() {
Chris@0 27 test -f $1 || \
Chris@0 28 fail "Fails to write output to expected location $1 for $2"
Chris@0 29 rapper -i turtle $1 >/dev/null 2>&1 || \
Chris@0 30 fail "Fails to produce parseable RDF/TTL for $2"
Chris@0 31 rapper -i turtle -c $1 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || \
Chris@0 32 fail "RDF output contains no triples (?) for $2"
Chris@0 33 rm -f $1
Chris@0 34 }
Chris@0 35
Chris@0 36
Chris@0 37 ctx="onsets transform, one audio file, default RDF writer destination"
Chris@0 38
Chris@147 39 rm -f $audiopath/$outfile1
Chris@0 40
Chris@119 41 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null || \
Chris@0 42 fail "Fails to run with $ctx"
Chris@0 43
Chris@147 44 check_rdf $audiopath/$outfile1 "$ctx"
Chris@0 45
Chris@0 46
Chris@44 47 ctx="onsets transform, one audio file with dots in filename, default RDF writer destination"
Chris@44 48
Chris@147 49 rm -f $audiopath/$outfile1
Chris@44 50
Chris@44 51 cp $infile1 $infile1dot
Chris@44 52
Chris@119 53 $r -t $transformdir/onsets.n3 -w rdf $infile1dot 2>/dev/null || \
Chris@44 54 fail "Fails to run with $ctx"
Chris@44 55
Chris@147 56 check_rdf $audiopath/$outfile1dot "$ctx"
Chris@44 57
Chris@147 58 rm -f $infile1dot $audiopath/$outfile1dot
Chris@44 59
Chris@44 60
Chris@0 61 ctx="onsets and df transforms, one audio file, default RDF writer destination"
Chris@0 62
Chris@147 63 rm -f $audiopath/$outfile1
Chris@0 64
Chris@119 65 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile1 2>/dev/null || \
Chris@0 66 fail "Fails to run with $ctx"
Chris@0 67
Chris@147 68 check_rdf $audiopath/$outfile1 "$ctx"
Chris@0 69
Chris@0 70
Chris@0 71 ctx="onsets transform, two audio files, default RDF writer destination"
Chris@0 72
Chris@147 73 rm -f $audiopath/$outfile1
Chris@147 74 rm -f $audiopath/$outfile2
Chris@0 75
Chris@119 76 $r -t $transformdir/onsets.n3 -w rdf $infile1 $infile2 2>/dev/null || \
Chris@0 77 fail "Fails to run with $ctx"
Chris@0 78
Chris@147 79 check_rdf $audiopath/$outfile1 "$ctx"
Chris@147 80 check_rdf $audiopath/$outfile2 "$ctx"
Chris@0 81
Chris@0 82
Chris@0 83 ctx="onsets transform, two audio files, one-file RDF writer"
Chris@0 84
Chris@119 85 $r -t $transformdir/onsets.n3 -w rdf --rdf-one-file $tmpttl $infile1 $infile2 2>/dev/null || \
Chris@0 86 fail "Fails to run with $ctx"
Chris@0 87
Chris@0 88 check_rdf $tmpttl "$ctx"
Chris@0 89
Chris@0 90
Chris@0 91 ctx="onsets transform, two audio files, stdout RDF writer"
Chris@0 92
Chris@119 93 $r -t $transformdir/onsets.n3 -w rdf --rdf-stdout $infile1 $infile2 2>/dev/null >$tmpttl || \
Chris@0 94 fail "Fails to run with $ctx"
Chris@0 95
Chris@0 96 check_rdf $tmpttl "$ctx"
Chris@0 97
Chris@0 98
Chris@0 99 ctx="onsets transform, one audio file, many-files RDF writer"
Chris@0 100
Chris@147 101 rm -f $audiopath/$outfile3
Chris@0 102
Chris@119 103 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 2>/dev/null || \
Chris@0 104 fail "Fails to run with $ctx"
Chris@0 105
Chris@147 106 check_rdf $audiopath/$outfile3 "$ctx"
Chris@0 107
Chris@0 108
Chris@0 109 ctx="onsets transform, two audio files, many-files RDF writer"
Chris@0 110
Chris@147 111 rm -f $audiopath/$outfile3
Chris@147 112 rm -f $audiopath/$outfile5
Chris@0 113
Chris@119 114 $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \
Chris@0 115 fail "Fails to run with $ctx"
Chris@0 116
Chris@147 117 check_rdf $audiopath/$outfile3 "$ctx"
Chris@147 118 check_rdf $audiopath/$outfile5 "$ctx"
Chris@0 119
Chris@0 120
Chris@0 121 ctx="onsets and df transforms, two audio files, many-files RDF writer"
Chris@0 122
Chris@147 123 rm -f $audiopath/$outfile3
Chris@147 124 rm -f $audiopath/$outfile4
Chris@147 125 rm -f $audiopath/$outfile5
Chris@147 126 rm -f $audiopath/$outfile6
Chris@0 127
Chris@119 128 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \
Chris@0 129 fail "Fails to run with $ctx"
Chris@0 130
Chris@147 131 check_rdf $audiopath/$outfile3 "$ctx"
Chris@147 132 check_rdf $audiopath/$outfile4 "$ctx"
Chris@147 133 check_rdf $audiopath/$outfile5 "$ctx"
Chris@147 134 check_rdf $audiopath/$outfile6 "$ctx"
Chris@147 135
Chris@147 136
Chris@147 137 ctx="output base directory"
Chris@147 138
Chris@147 139 rm -f ./$outfile1
Chris@147 140
Chris@147 141 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf --rdf-basedir . $infile1 2>/dev/null || \
Chris@147 142 fail "Fails to run with $ctx"
Chris@147 143
Chris@147 144 check_rdf ./$outfile1 "$ctx"
Chris@147 145
Chris@147 146
Chris@147 147 ctx="output base directory and many-files"
Chris@147 148
Chris@147 149 rm -f ./$outfile3
Chris@147 150 rm -f ./$outfile5
Chris@147 151
Chris@147 152 $r -t $transformdir/onsets.n3 -w rdf --rdf-basedir . --rdf-many-files $infile1 $infile2 2>/dev/null || \
Chris@147 153 fail "Fails to run with $ctx"
Chris@147 154
Chris@147 155 check_rdf ./$outfile3 "$ctx"
Chris@147 156 check_rdf ./$outfile5 "$ctx"
Chris@147 157
Chris@147 158
Chris@147 159 ctx="nonexistent output base directory"
Chris@147 160
Chris@147 161 $r -t $transformdir/onsets.n3 -w rdf --rdf-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \
Chris@147 162 fail "Fails with $ctx by completing successfully (should refuse and bail out)"
Chris@0 163
Chris@0 164
Chris@0 165 ctx="existing output file and no --rdf-force"
Chris@0 166
Chris@147 167 touch $audiopath/$outfile1
Chris@0 168
Chris@119 169 $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null && \
Chris@0 170 fail "Fails by completing successfully when output file already exists (should refuse and bail out)"
Chris@0 171
Chris@0 172
Chris@0 173 ctx="existing output file and --rdf-force"
Chris@0 174
Chris@147 175 touch $audiopath/$outfile1
Chris@0 176
Chris@119 177 $r -t $transformdir/onsets.n3 -w rdf --rdf-force $infile1 2>/dev/null || \
Chris@0 178 fail "Fails to run with $ctx"
Chris@0 179
Chris@147 180 check_rdf $audiopath/$outfile1 "$ctx"
Chris@0 181
Chris@0 182
Chris@0 183 exit 0