comparison test/regression.sh @ 45:0fec1c76c92b

Very simplistic regression test
author Chris Cannam
date Tue, 09 Jul 2019 12:34:25 +0100
parents
children 1623751c4549
comparison
equal deleted inserted replaced
44:dcfae9ef87de 45:0fec1c76c92b
1 #!/bin/bash
2
3 set -eu
4
5 mydir=$(dirname "$0")
6
7 source_url=https://code.soundsoftware.ac.uk/attachments/download/1698/Zweieck-Duell.ogg
8
9 testfile="$mydir/input.ogg"
10 outfile="$mydir/output.csv"
11 expfile="$mydir/expected.csv"
12
13 if sonic-annotator -v >/dev/null ; then
14 :
15 else
16 echo "Failed to find required binary sonic-annotator"
17 exit 1
18 fi
19
20 if oggdec -h >/dev/null ; then
21 :
22 else
23 echo "Failed to find required binary oggdec"
24 exit 1
25 fi
26
27 if rubberband -h 2>&1 | grep Particular >/dev/null ; then
28 :
29 else
30 echo "Failed to find required binary rubberband"
31 exit 1
32 fi
33
34 if wget --version >/dev/null ; then
35 wget -O "$testfile" "$source_url"
36 else
37 curl -o "$testfile" "$source_url"
38 fi
39
40 wavfile=${testfile%%.ogg}.wav
41 lowfile=${testfile%%.ogg}-low.wav
42
43 oggdec -o "$wavfile" "$testfile"
44
45 rubberband -p -2.34 "$wavfile" "$lowfile"
46
47 VAMP_PATH="$mydir/.." \
48 sonic-annotator \
49 -d vamp:tuning-difference:tuning-difference \
50 -w csv \
51 --csv-omit-filename \
52 --csv-one-file "$outfile" \
53 --csv-force \
54 --multiplex \
55 "$testfile" \
56 "$lowfile"
57
58 if cmp "$outfile" "$expfile" ; then
59 echo
60 echo PASS
61 exit 0
62 else
63 echo
64 echo "*** FAIL: Result does not match expected output. Diff follows:"
65 echo
66 sdiff -w 60 "$outfile" "$expfile"
67 exit 1
68 fi
69
70