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