To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / test / run-test-plugin-regression.sh

History | View | Annotate | Download (1.69 KB)

1
#!/bin/bash
2

    
3
set -eu
4

    
5
MYDIR=$(dirname "$0")
6

    
7
TEST_PLUGIN_DIR="$MYDIR/../../vamp-test-plugin"
8
HOST_DIR="$MYDIR/../host"
9
HOST="$HOST_DIR/vamp-simple-host"
10
TEST_FILE="$MYDIR/testsignal.wav"
11

    
12
mkdir -p "$MYDIR/obtained"
13
mkdir -p "$MYDIR/failures"
14

    
15
echo "Rebuilding SDK and simple host..." 1>&2
16
( cd "$MYDIR/.." && ./configure && make clean && make )
17

    
18
if [ ! -d "$TEST_PLUGIN_DIR" ]; then
19
    echo "Can't find test plugin dir at $TEST_PLUGIN_DIR" 1>&2
20
    exit 1
21
fi
22

    
23
if [ ! -x "$HOST" ]; then
24
    echo "Can't find host at $HOST" 1>&2
25
    exit 1
26
fi
27

    
28
echo "Rebuilding test plugin..." 1>&2
29
( cd "$TEST_PLUGIN_DIR" && make -f Makefile.linux clean && make -f Makefile.linux )
30

    
31
export VAMP_PATH="$TEST_PLUGIN_DIR"
32

    
33
# check that the two expected test plugin ids are present:
34

    
35
ids=$("$HOST" --list-ids)
36

    
37
expected="vamp:vamp-test-plugin:vamp-test-plugin
38
vamp:vamp-test-plugin:vamp-test-plugin-freq"
39

    
40
if [ "$ids" != "$expected" ]; then
41
    echo "Unexpected id list: $ids" 1>&2
42
    echo "Expected: $expected" 1>&2
43
    exit 1
44
fi
45

    
46
some_failed=nope
47
echo
48

    
49
for test in $("$HOST" --list-outputs | sed 's/^vamp://') ; do
50

    
51
    filename="$(echo "$test.txt" | sed 's/^[^:]*://' | sed 's/:/_/g')"
52
    expected="$MYDIR/expected/$filename"
53
    obtained="$MYDIR/obtained/$filename"
54
    failure="$MYDIR/failures/$filename"
55

    
56
    rm -f "$failure"
57
    echo "=== $test" > "$obtained"
58
    "$HOST" "$test" "$TEST_FILE" >> "$obtained" 2>/dev/null
59
    
60
    if cmp -s "$expected" "$obtained" ; then
61
	echo "$test: ok"
62
    else
63
	sdiff "$expected" "$obtained" > "$failure" || true # avoid exit-on-failure
64
	echo "*** $test: FAILED, see $failure for diff"
65
	some_failed=yup
66
    fi
67
    
68
done
69

    
70
if [ "$some_failed" != "nope" ]; then
71
    echo; echo "*** Some tests failed!"; echo
72
fi
73