Chris@438: #!/bin/bash Chris@438: Chris@438: set -eu Chris@438: Chris@438: MYDIR=$(dirname "$0") Chris@438: Chris@438: TEST_PLUGIN_DIR="$MYDIR/../../vamp-test-plugin" Chris@438: HOST_DIR="$MYDIR/../host" Chris@438: HOST="$HOST_DIR/vamp-simple-host" Chris@452: TEST_FILE="$MYDIR/testsignal.wav" Chris@438: Chris@438: mkdir -p "$MYDIR/obtained" Chris@438: mkdir -p "$MYDIR/failures" Chris@438: Chris@438: echo "Rebuilding SDK and simple host..." 1>&2 Chris@438: ( cd "$MYDIR/.." && ./configure && make clean && make ) Chris@438: Chris@438: if [ ! -d "$TEST_PLUGIN_DIR" ]; then Chris@438: echo "Can't find test plugin dir at $TEST_PLUGIN_DIR" 1>&2 Chris@438: exit 1 Chris@438: fi Chris@438: Chris@438: if [ ! -x "$HOST" ]; then Chris@438: echo "Can't find host at $HOST" 1>&2 Chris@438: exit 1 Chris@438: fi Chris@438: Chris@438: echo "Rebuilding test plugin..." 1>&2 Chris@438: ( cd "$TEST_PLUGIN_DIR" && make -f Makefile.linux clean && make -f Makefile.linux ) Chris@438: Chris@438: export VAMP_PATH="$TEST_PLUGIN_DIR" Chris@438: Chris@438: # check that the two expected test plugin ids are present: Chris@438: Chris@438: ids=$("$HOST" --list-ids) Chris@438: Chris@438: expected="vamp:vamp-test-plugin:vamp-test-plugin Chris@438: vamp:vamp-test-plugin:vamp-test-plugin-freq" Chris@438: Chris@438: if [ "$ids" != "$expected" ]; then Chris@438: echo "Unexpected id list: $ids" 1>&2 Chris@438: echo "Expected: $expected" 1>&2 Chris@438: exit 1 Chris@438: fi Chris@438: Chris@438: some_failed=nope Chris@438: echo Chris@438: Chris@438: for test in $("$HOST" --list-outputs | sed 's/^vamp://') ; do Chris@438: Chris@438: filename="$(echo "$test.txt" | sed 's/^[^:]*://' | sed 's/:/_/g')" Chris@438: expected="$MYDIR/expected/$filename" Chris@438: obtained="$MYDIR/obtained/$filename" Chris@438: failure="$MYDIR/failures/$filename" Chris@438: Chris@438: rm -f "$failure" Chris@438: echo "=== $test" > "$obtained" Chris@438: "$HOST" "$test" "$TEST_FILE" >> "$obtained" 2>/dev/null Chris@438: Chris@438: if cmp -s "$expected" "$obtained" ; then Chris@438: echo "$test: ok" Chris@438: else Chris@438: sdiff "$expected" "$obtained" > "$failure" || true # avoid exit-on-failure Chris@438: echo "*** $test: FAILED, see $failure for diff" Chris@438: some_failed=yup Chris@438: fi Chris@438: Chris@438: done Chris@438: Chris@438: if [ "$some_failed" != "nope" ]; then Chris@438: echo; echo "*** Some tests failed!"; echo Chris@438: fi Chris@438: