annotate tests/test-helpfulflags.sh @ 21:9a4e410bda7a

* Add --force option, and throw/catch exceptions for failure cases rather than exiting directly
author Chris Cannam
date Tue, 07 Jul 2009 10:34:27 +0000
parents 03a02c1f0a9f
children 94d988cef54e
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@0 3 mypath=`dirname $0`
Chris@3 4 r=$mypath/../runner/sonic-annotator
Chris@0 5
Chris@0 6 testplug=vamp:vamp-example-plugins:percussiononsets
Chris@0 7
Chris@0 8 fail() {
Chris@0 9 echo "Test failed: $1"
Chris@0 10 exit 1
Chris@0 11 }
Chris@0 12
Chris@0 13 $r >/dev/null 2>&1 && \
Chris@0 14 fail "Return code 0 when run without args (should be a failure code)"
Chris@0 15
Chris@0 16 $r 2>&1 >/dev/null | grep -q "for help" || \
Chris@0 17 fail "Improper response when run without args"
Chris@0 18
Chris@0 19 $r --help 2>&1 | grep -q Copy || \
Chris@0 20 fail "Expected help not printed when run with --help"
Chris@0 21
Chris@0 22 $r --list >/dev/null 2>&1 || \
Chris@0 23 fail "Fails to run with --list"
Chris@0 24
Chris@0 25 $r --list 2>/dev/null | grep -q $testplug || \
Chris@0 26 fail "Fails to print $testplug in plugin list (if you haven't got it, install it -- it's needed for other tests)"
Chris@0 27
Chris@0 28 $r --skeleton $testplug >/dev/null || \
Chris@0 29 fail "Fails to run with --skeleton $testplug"
Chris@0 30
Chris@0 31 $r -s $testplug >/dev/null || \
Chris@0 32 fail "Fails to run with -s $testplug"
Chris@0 33
Chris@0 34 $r --skeleton $testplug >/dev/null || \
Chris@0 35 fail "Fails to run with --skeleton $testplug"
Chris@0 36
Chris@0 37 $r --skeleton $testplug | rapper -i turtle - test >/dev/null 2>&1 || \
Chris@0 38 fail "Invalid XML skeleton produced with --skeleton $testplug"
Chris@0 39
Chris@0 40 exit 0