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