Mercurial > hg > sonic-annotator
comparison tests/include.sh @ 119:7a31201dc42d test-reorg
Split out tests into individual directories, with simpler naming therein
author | Chris Cannam |
---|---|
date | Wed, 08 Oct 2014 15:08:57 +0100 |
parents | tests/test-include.sh@0fe5abb56a6e |
children | e6379b2e1c5c |
comparison
equal
deleted
inserted
replaced
118:0fe5abb56a6e | 119:7a31201dc42d |
---|---|
1 | |
2 mypath=`dirname $0` | |
3 | |
4 testdir=$mypath/.. | |
5 r=$testdir/../sonic-annotator | |
6 | |
7 audiopath=$testdir/audio | |
8 | |
9 percplug=vamp:vamp-example-plugins:percussiononsets | |
10 testplug=vamp:vamp-test-plugin:vamp-test-plugin | |
11 | |
12 fail() { | |
13 echo "Test failed: $1" | |
14 exit 1 | |
15 } | |
16 | |
17 csvcompare() { | |
18 # permit some fuzz in final few digits | |
19 a="$1" | |
20 b="$2" | |
21 perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$a" > "${a}__" | |
22 perl -p -e 's/(\d+\.\d{6})\d+/$1/' "$b" > "${b}__" | |
23 cmp -s "${a}__" "${b}__" | |
24 rv=$? | |
25 rm "${a}__" "${b}__" | |
26 return $rv | |
27 } | |
28 | |
29 csvcompare_ignorefirst() { | |
30 # a bit like the above, but ignoring first column (and without temp files) | |
31 out=`cat "$1" "$2" | cut -d, -f2- | perl -p -e 's/(\d+\.\d{6})\d+/$1/' | sort | uniq -c | grep -v ' 2 '` | |
32 return `[ -z "$out" ]` | |
33 } | |
34 | |
35 faildiff() { | |
36 echo "Test failed: $1" | |
37 if [ -n "$2" -a -n "$3" ]; then | |
38 echo "Output follows:" | |
39 echo "--" | |
40 cat $2 | |
41 echo "--" | |
42 echo "Expected output follows:" | |
43 echo "--" | |
44 cat $3 | |
45 echo "--" | |
46 echo "Diff:" | |
47 echo "--" | |
48 sdiff -w78 $2 $3 | |
49 echo "--" | |
50 fi | |
51 exit 1 | |
52 } | |
53 | |
54 |