Chris@118: Chris@118: mypath=`dirname $0` Chris@119: Chris@119: testdir=$mypath/.. Chris@119: r=$testdir/../sonic-annotator Chris@119: Chris@119: audiopath=$testdir/audio Chris@118: Chris@118: percplug=vamp:vamp-example-plugins:percussiononsets Chris@118: testplug=vamp:vamp-test-plugin:vamp-test-plugin Chris@30: Chris@30: fail() { Chris@30: echo "Test failed: $1" Chris@30: exit 1 Chris@30: } Chris@30: Chris@30: csvcompare() { Chris@30: # permit some fuzz in final few digits Chris@30: a="$1" Chris@30: b="$2" Chris@30: perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$a" > "${a}__" Chris@30: perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$b" > "${b}__" Chris@30: cmp -s "${a}__" "${b}__" Chris@30: rv=$? Chris@30: rm "${a}__" "${b}__" Chris@30: return $rv Chris@30: } Chris@30: Chris@75: csvcompare_ignorefirst() { Chris@75: # a bit like the above, but ignoring first column (and without temp files) Chris@75: out=`cat "$1" "$2" | cut -d, -f2- | perl -p -e 's/(\d+\.\d{6})\d+/$1/' | sort | uniq -c | grep -v ' 2 '` Chris@75: return `[ -z "$out" ]` Chris@75: } Chris@75: Chris@108: faildiff() { Chris@108: echo "Test failed: $1" Chris@108: if [ -n "$2" -a -n "$3" ]; then Chris@108: echo "Output follows:" Chris@108: echo "--" Chris@108: cat $2 Chris@108: echo "--" Chris@108: echo "Expected output follows:" Chris@108: echo "--" Chris@108: cat $3 Chris@108: echo "--" Chris@108: echo "Diff:" Chris@108: echo "--" Chris@108: sdiff -w78 $2 $3 Chris@108: echo "--" Chris@108: fi Chris@108: exit 1 Chris@108: } Chris@75: Chris@108: