annotate tests/test-rdf-writer.sh @ 58:350f61d5d9be

Small simplification
author Chris Cannam
date Mon, 09 Jan 2012 14:55:17 +0000
parents 94d988cef54e
children 0fe5abb56a6e
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@0 3 mypath=`dirname $0`
Chris@42 4 r=$mypath/../sonic-annotator
Chris@0 5
Chris@0 6 infile=$mypath/audio/3clicks8.wav
Chris@0 7 testplug=vamp:vamp-example-plugins:percussiononsets
Chris@0 8 tmpttl=$mypath/tmp_1_$$.ttl
Chris@0 9
Chris@0 10 trap "rm -f $tmpttl" 0
Chris@0 11
Chris@0 12 fail() {
Chris@0 13 echo "Test failed: $1"
Chris@0 14 exit 1
Chris@0 15 }
Chris@0 16
Chris@0 17 transformpfx=$mypath/transforms/transforms-rdf-writer-percussiononsets
Chris@0 18
Chris@0 19 for rdfarg in "" "--rdf-plain" ; do
Chris@0 20
Chris@0 21 note=""
Chris@0 22 [ -n "$rdfarg" ] && note=" with $rdfarg"
Chris@0 23
Chris@0 24 rm -f $tmpttl
Chris@0 25
Chris@0 26 $r -t $transformpfx-onsets.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
Chris@0 27 fail "Fails to run with onsets transform and RDF writer$note"
Chris@0 28
Chris@0 29 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
Chris@0 30 fail "Fails to produce parseable RDF/TTL for onsets transform$note"
Chris@0 31
Chris@0 32 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 33 fail "RDF output contains no triples (?) for onsets transform$note"
Chris@0 34
Chris@0 35 rm -f $tmpttl
Chris@0 36
Chris@0 37 $r -t $transformpfx-detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
Chris@0 38 fail "Fails to run with detectionfunction transform and RDF writer$note"
Chris@0 39
Chris@0 40 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
Chris@0 41 fail "Fails to produce parseable RDF/TTL for detectionfunction transform$note"
Chris@0 42
Chris@0 43 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 44 fail "RDF output contains no triples (?) for detectionfunction transform$note"
Chris@0 45
Chris@0 46 rm -f $tmpttl
Chris@0 47
Chris@0 48 $r -t $transformpfx-onsets.n3 -t $transformpfx-detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
Chris@0 49 fail "Fails to run with detectionfunction and onsets transforms together and RDF writer$note"
Chris@0 50
Chris@0 51 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
Chris@0 52 fail "Fails to produce parseable RDF/TTL for detectionfunction and onsets transforms together$note"
Chris@0 53
Chris@0 54 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 55 fail "RDF output contains no triples (?) for detectionfunction and onsets transforms together$note"
Chris@0 56
Chris@0 57 done
Chris@0 58
Chris@0 59 exit 0