annotate test/run-test-plugin-regression.sh @ 490:703da7b180e8

Update CHANGELOG
author Chris Cannam
date Fri, 24 Feb 2017 15:14:54 +0000
parents cd8414edfd32
children
rev   line source
Chris@438 1 #!/bin/bash
Chris@438 2
Chris@438 3 set -eu
Chris@438 4
Chris@438 5 MYDIR=$(dirname "$0")
Chris@438 6
Chris@438 7 TEST_PLUGIN_DIR="$MYDIR/../../vamp-test-plugin"
Chris@438 8 HOST_DIR="$MYDIR/../host"
Chris@438 9 HOST="$HOST_DIR/vamp-simple-host"
Chris@452 10 TEST_FILE="$MYDIR/testsignal.wav"
Chris@438 11
Chris@438 12 mkdir -p "$MYDIR/obtained"
Chris@438 13 mkdir -p "$MYDIR/failures"
Chris@438 14
Chris@438 15 echo "Rebuilding SDK and simple host..." 1>&2
Chris@438 16 ( cd "$MYDIR/.." && ./configure && make clean && make )
Chris@438 17
Chris@438 18 if [ ! -d "$TEST_PLUGIN_DIR" ]; then
Chris@438 19 echo "Can't find test plugin dir at $TEST_PLUGIN_DIR" 1>&2
Chris@438 20 exit 1
Chris@438 21 fi
Chris@438 22
Chris@438 23 if [ ! -x "$HOST" ]; then
Chris@438 24 echo "Can't find host at $HOST" 1>&2
Chris@438 25 exit 1
Chris@438 26 fi
Chris@438 27
Chris@438 28 echo "Rebuilding test plugin..." 1>&2
Chris@438 29 ( cd "$TEST_PLUGIN_DIR" && make -f Makefile.linux clean && make -f Makefile.linux )
Chris@438 30
Chris@438 31 export VAMP_PATH="$TEST_PLUGIN_DIR"
Chris@438 32
Chris@438 33 # check that the two expected test plugin ids are present:
Chris@438 34
Chris@438 35 ids=$("$HOST" --list-ids)
Chris@438 36
Chris@438 37 expected="vamp:vamp-test-plugin:vamp-test-plugin
Chris@438 38 vamp:vamp-test-plugin:vamp-test-plugin-freq"
Chris@438 39
Chris@438 40 if [ "$ids" != "$expected" ]; then
Chris@438 41 echo "Unexpected id list: $ids" 1>&2
Chris@438 42 echo "Expected: $expected" 1>&2
Chris@438 43 exit 1
Chris@438 44 fi
Chris@438 45
Chris@438 46 some_failed=nope
Chris@438 47 echo
Chris@438 48
Chris@438 49 for test in $("$HOST" --list-outputs | sed 's/^vamp://') ; do
Chris@438 50
Chris@438 51 filename="$(echo "$test.txt" | sed 's/^[^:]*://' | sed 's/:/_/g')"
Chris@438 52 expected="$MYDIR/expected/$filename"
Chris@438 53 obtained="$MYDIR/obtained/$filename"
Chris@438 54 failure="$MYDIR/failures/$filename"
Chris@438 55
Chris@438 56 rm -f "$failure"
Chris@438 57 echo "=== $test" > "$obtained"
Chris@438 58 "$HOST" "$test" "$TEST_FILE" >> "$obtained" 2>/dev/null
Chris@438 59
Chris@438 60 if cmp -s "$expected" "$obtained" ; then
Chris@438 61 echo "$test: ok"
Chris@438 62 else
Chris@438 63 sdiff "$expected" "$obtained" > "$failure" || true # avoid exit-on-failure
Chris@438 64 echo "*** $test: FAILED, see $failure for diff"
Chris@438 65 some_failed=yup
Chris@438 66 fi
Chris@438 67
Chris@438 68 done
Chris@438 69
Chris@438 70 if [ "$some_failed" != "nope" ]; then
Chris@438 71 echo; echo "*** Some tests failed!"; echo
Chris@438 72 fi
Chris@438 73