annotate tests/test-rdf-destinations.sh @ 118:0fe5abb56a6e test-reorg

Pull more stuff up into include file
author Chris Cannam
date Wed, 08 Oct 2014 14:20:45 +0100
parents aa521baace07
children
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@118 3 . test-include.sh
Chris@0 4
Chris@0 5 infile1=$mypath/audio/3clicks8.wav
Chris@0 6 infile2=$mypath/audio/6clicks8.wav
Chris@0 7
Chris@0 8 outfile1=$mypath/audio/3clicks8.n3
Chris@0 9 outfile2=$mypath/audio/6clicks8.n3
Chris@0 10
Chris@44 11 infile1dot=$mypath/audio/3.clicks.8.wav
Chris@44 12 outfile1dot=$mypath/audio/3.clicks.8.n3
Chris@44 13
Chris@0 14 outfile3=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3
Chris@0 15 outfile4=$mypath/audio/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3
Chris@0 16 outfile5=$mypath/audio/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3
Chris@0 17 outfile6=$mypath/audio/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@0 23 transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets
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@0 40 $r -t $transformpfx-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@44 52 $r -t $transformpfx-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@0 64 $r -t $transformpfx-onsets.n3 -t $transformpfx-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@0 75 $r -t $transformpfx-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@0 84 $r -t $transformpfx-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@0 92 $r -t $transformpfx-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@0 102 $r -t $transformpfx-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@0 113 $r -t $transformpfx-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@0 127 $r -t $transformpfx-onsets.n3 -t $transformpfx-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@0 140 $r -t $transformpfx-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@0 148 $r -t $transformpfx-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