annotate test/run-test-plugin-regression.sh @ 441:3204d711cf4b

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