Mercurial > hg > sonic-annotator
annotate tests/include.sh @ 139:a4bee1a374b4 midi
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 13 Oct 2014 11:43:24 +0100 |
parents | 2260947be4aa ee56e3e9eeb5 |
children | 64a7faf9a122 |
rev | line source |
---|---|
Chris@118 | 1 |
Chris@118 | 2 mypath=`dirname $0` |
Chris@119 | 3 |
Chris@138 | 4 version=1.1-hg |
Chris@138 | 5 nextversion=1.1 |
Chris@138 | 6 |
Chris@119 | 7 testdir=$mypath/.. |
Chris@119 | 8 r=$testdir/../sonic-annotator |
Chris@119 | 9 |
Chris@119 | 10 audiopath=$testdir/audio |
Chris@118 | 11 |
Chris@118 | 12 percplug=vamp:vamp-example-plugins:percussiononsets |
Chris@126 | 13 amplplug=vamp:vamp-example-plugins:amplitudefollower |
Chris@118 | 14 testplug=vamp:vamp-test-plugin:vamp-test-plugin |
Chris@30 | 15 |
Chris@30 | 16 fail() { |
Chris@30 | 17 echo "Test failed: $1" |
Chris@30 | 18 exit 1 |
Chris@30 | 19 } |
Chris@30 | 20 |
Chris@30 | 21 csvcompare() { |
Chris@30 | 22 # permit some fuzz in final few digits |
Chris@30 | 23 a="$1" |
Chris@30 | 24 b="$2" |
Chris@30 | 25 perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$a" > "${a}__" |
Chris@30 | 26 perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$b" > "${b}__" |
Chris@30 | 27 cmp -s "${a}__" "${b}__" |
Chris@30 | 28 rv=$? |
Chris@30 | 29 rm "${a}__" "${b}__" |
Chris@30 | 30 return $rv |
Chris@30 | 31 } |
Chris@30 | 32 |
Chris@75 | 33 csvcompare_ignorefirst() { |
Chris@75 | 34 # a bit like the above, but ignoring first column (and without temp files) |
Chris@75 | 35 out=`cat "$1" "$2" | cut -d, -f2- | perl -p -e 's/(\d+\.\d{6})\d+/$1/' | sort | uniq -c | grep -v ' 2 '` |
Chris@75 | 36 return `[ -z "$out" ]` |
Chris@75 | 37 } |
Chris@75 | 38 |
Chris@108 | 39 faildiff() { |
Chris@108 | 40 echo "Test failed: $1" |
Chris@108 | 41 if [ -n "$2" -a -n "$3" ]; then |
Chris@108 | 42 echo "Output follows:" |
Chris@108 | 43 echo "--" |
Chris@108 | 44 cat $2 |
Chris@108 | 45 echo "--" |
Chris@108 | 46 echo "Expected output follows:" |
Chris@108 | 47 echo "--" |
Chris@108 | 48 cat $3 |
Chris@108 | 49 echo "--" |
Chris@108 | 50 echo "Diff:" |
Chris@108 | 51 echo "--" |
Chris@108 | 52 sdiff -w78 $2 $3 |
Chris@108 | 53 echo "--" |
Chris@108 | 54 fi |
Chris@108 | 55 exit 1 |
Chris@108 | 56 } |
Chris@75 | 57 |
Chris@108 | 58 |