annotate tests/include.sh @ 121:5200446bbc6b test-reorg

Check for multiple transforms. But one of these tests fails, so we'd better go back to development branch and sort out why!
author Chris Cannam
date Wed, 08 Oct 2014 15:38:34 +0100
parents 7a31201dc42d
children e6379b2e1c5c
rev   line source
Chris@118 1
Chris@118 2 mypath=`dirname $0`
Chris@119 3
Chris@119 4 testdir=$mypath/..
Chris@119 5 r=$testdir/../sonic-annotator
Chris@119 6
Chris@119 7 audiopath=$testdir/audio
Chris@118 8
Chris@118 9 percplug=vamp:vamp-example-plugins:percussiononsets
Chris@118 10 testplug=vamp:vamp-test-plugin:vamp-test-plugin
Chris@30 11
Chris@30 12 fail() {
Chris@30 13 echo "Test failed: $1"
Chris@30 14 exit 1
Chris@30 15 }
Chris@30 16
Chris@30 17 csvcompare() {
Chris@30 18 # permit some fuzz in final few digits
Chris@30 19 a="$1"
Chris@30 20 b="$2"
Chris@30 21 perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$a" > "${a}__"
Chris@30 22 perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$b" > "${b}__"
Chris@30 23 cmp -s "${a}__" "${b}__"
Chris@30 24 rv=$?
Chris@30 25 rm "${a}__" "${b}__"
Chris@30 26 return $rv
Chris@30 27 }
Chris@30 28
Chris@75 29 csvcompare_ignorefirst() {
Chris@75 30 # a bit like the above, but ignoring first column (and without temp files)
Chris@75 31 out=`cat "$1" "$2" | cut -d, -f2- | perl -p -e 's/(\d+\.\d{6})\d+/$1/' | sort | uniq -c | grep -v ' 2 '`
Chris@75 32 return `[ -z "$out" ]`
Chris@75 33 }
Chris@75 34
Chris@108 35 faildiff() {
Chris@108 36 echo "Test failed: $1"
Chris@108 37 if [ -n "$2" -a -n "$3" ]; then
Chris@108 38 echo "Output follows:"
Chris@108 39 echo "--"
Chris@108 40 cat $2
Chris@108 41 echo "--"
Chris@108 42 echo "Expected output follows:"
Chris@108 43 echo "--"
Chris@108 44 cat $3
Chris@108 45 echo "--"
Chris@108 46 echo "Diff:"
Chris@108 47 echo "--"
Chris@108 48 sdiff -w78 $2 $3
Chris@108 49 echo "--"
Chris@108 50 fi
Chris@108 51 exit 1
Chris@108 52 }
Chris@75 53
Chris@108 54