annotate tests/test-rdf-destinations/test-rdf-destinations.sh @ 146:45480b73f4af midi

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