annotate tests/test-rdf-writer/test-rdf-writer.sh @ 283:7ed00474dfbb piper-nopiper

Need these on OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 30 Nov 2016 10:16:11 +0000
parents 68daabfc4ccc
children
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@119 3 . ../include.sh
Chris@0 4
Chris@119 5 infile=$audiopath/3clicks8.wav
Chris@0 6 tmpttl=$mypath/tmp_1_$$.ttl
Chris@0 7
Chris@191 8 silentfile=$audiopath/20sec-silence.wav
Chris@191 9
Chris@0 10 trap "rm -f $tmpttl" 0
Chris@0 11
Chris@119 12 transformdir=$mypath/transforms
Chris@0 13
Chris@0 14 for rdfarg in "" "--rdf-plain" ; do
Chris@0 15
Chris@0 16 note=""
Chris@0 17 [ -n "$rdfarg" ] && note=" with $rdfarg"
Chris@0 18
Chris@191 19 rm -f "$tmpttl"
Chris@0 20
Chris@191 21 $r -t $transformdir/onsets.n3 -w rdf $infile $rdfarg --rdf-one-file "$tmpttl" 2>/dev/null || \
Chris@0 22 fail "Fails to run with onsets transform and RDF writer$note"
Chris@0 23
Chris@191 24 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
Chris@0 25 fail "Fails to produce parseable RDF/TTL for onsets transform$note"
Chris@0 26
Chris@191 27 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 28 fail "RDF output contains no triples (?) for onsets transform$note"
Chris@0 29
Chris@191 30 rm -f "$tmpttl"
Chris@0 31
Chris@191 32 $r -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file "$tmpttl" 2>/dev/null || \
Chris@0 33 fail "Fails to run with detectionfunction transform and RDF writer$note"
Chris@0 34
Chris@191 35 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
Chris@0 36 fail "Fails to produce parseable RDF/TTL for detectionfunction transform$note"
Chris@0 37
Chris@191 38 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 39 fail "RDF output contains no triples (?) for detectionfunction transform$note"
Chris@0 40
Chris@191 41 rm -f "$tmpttl"
Chris@0 42
Chris@191 43 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file "$tmpttl" 2>/dev/null || \
Chris@0 44 fail "Fails to run with detectionfunction and onsets transforms together and RDF writer$note"
Chris@0 45
Chris@191 46 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
Chris@0 47 fail "Fails to produce parseable RDF/TTL for detectionfunction and onsets transforms together$note"
Chris@0 48
Chris@191 49 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 50 fail "RDF output contains no triples (?) for detectionfunction and onsets transforms together$note"
Chris@0 51
Chris@191 52 # And the various structures emitted by the Vamp test plugin
Chris@191 53 for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do
Chris@191 54
Chris@191 55 $r -d "$testplug:$output" -w rdf --rdf-one-file "$tmpttl" --rdf-force "$silentfile" 2>/dev/null || \
Chris@191 56 fail "Failed to run for plugin $testplug with output $output"
Chris@191 57
Chris@191 58 rapper -i turtle "$tmpttl" >/dev/null 2>&1 || \
Chris@191 59 fail "Fails to produce parseable RDF/TTL for test plugin output $output"
Chris@191 60
Chris@191 61 rapper -i turtle -c "$tmpttl" 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@191 62 fail "RDF output contains no triples (?) for test plugin output $output"
Chris@191 63 done
Chris@0 64 done
Chris@0 65
Chris@188 66 # Check the output encoding -- should be valid UTF-8 always
Chris@188 67
Chris@188 68 for code in ucs-2 iso-8859-1; do
Chris@198 69 $r -t $transformdir/onsets.n3 -w rdf --rdf-stdout $audiopath/id3v2-$code.mp3 2>/dev/null | iconv --from-code=utf-8 --to-code=utf-8 >/dev/null ||
Chris@198 70 fail "RDF/Turtle output from $code input is not valid utf-8 according to iconv"
Chris@188 71 done
Chris@188 72
Chris@0 73 exit 0