annotate tests/test-as-advertised/test-as-advertised.sh @ 195:3f7c65f26559

Fixes from last merge
author Chris Cannam
date Wed, 26 Aug 2015 21:46:52 +0100
parents b3d73c08b6ce
children 3b7ec45abd1c
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 tmpdir=$mypath/tmp_1_$$.dir
Chris@0 7 tmpwav=$tmpdir/test.wav
Chris@0 8
Chris@0 9 trap "rm -rf $tmpdir" 0
Chris@0 10
Chris@144 11 types=`$r --list-writers`
Chris@0 12 [ -n "$types" ] || \
Chris@144 13 fail "Fails to report list of writers"
Chris@0 14
Chris@119 15 onsets=$mypath/transforms/percussiononsets-onsets.n3
Chris@119 16 df=$mypath/transforms/percussiononsets-detectionfunction.n3
Chris@0 17
Chris@0 18 adbdir=$tmpdir/audiodb-test
Chris@0 19
Chris@0 20 for type in $types; do
Chris@0 21
Chris@0 22 mkdir -p $tmpdir
Chris@0 23 cp $infile $tmpwav
Chris@0 24
Chris@0 25 # Some of these are special cases:
Chris@0 26 #
Chris@0 27 # * The "default" writer type always prints to stdout instead of
Chris@0 28 # to a file.
Chris@0 29 #
Chris@0 30 # * The "audiodb" writer will not print any output for features
Chris@0 31 # that have no values (but are only point events). I don't know
Chris@0 32 # how reasonable that is, but it's clearly intentional. It also
Chris@0 33 # writes to a subdirectory $basedir/$catid/$trackid.$output
Chris@0 34
Chris@0 35 case $type in
Chris@0 36 audiodb)
Chris@144 37 mkdir -p $adbdir
Chris@0 38 $r -t $df -w $type $tmpwav --audiodb-basedir $tmpdir --audiodb-catid `basename $adbdir` 2>/dev/null || \
Chris@0 39 fail "Fails to run with reader type \"$type\" and default options"
Chris@0 40 ;;
Chris@0 41 default)
Chris@0 42 $r -t $onsets -w $type $tmpwav > $tmpdir/test.out 2>/dev/null || \
Chris@0 43 fail "Fails to run with reader type \"$type\" and default options"
Chris@0 44 ;;
Chris@0 45 *)
Chris@0 46 $r -t $onsets -w $type $tmpwav 2>/dev/null || \
Chris@0 47 fail "Fails to run with reader type \"$type\" and default options"
Chris@0 48 ;;
Chris@0 49 esac
Chris@0 50 newfiles=`ls $tmpdir | fgrep -v .wav`
Chris@0 51 if [ "$type" = audiodb ]; then newfiles=`ls $adbdir`; fi
Chris@0 52
Chris@0 53 [ -n "$newfiles" ] || \
Chris@0 54 fail "Fails to create output file for reader \"$type\" with default options"
Chris@0 55
Chris@0 56 case `echo $newfiles | wc -w` in
Chris@0 57 [2-9])
Chris@0 58 if [ "$type" != audiodb ]; then
Chris@0 59 fail "Produces more than one output file for reader \"$type\" with default options"
Chris@0 60 fi
Chris@0 61 ;;
Chris@0 62 1)
Chris@0 63 if [ "$type" = audiodb ]; then
Chris@0 64 fail "Produces only one output file for reader \"$type\" with default options (expected two)"
Chris@0 65 fi
Chris@0 66 ;;
Chris@0 67 esac
Chris@0 68
Chris@0 69 rm -r $tmpdir
Chris@0 70 done
Chris@0 71
Chris@119 72 exit 0
Chris@119 73