rhubarb-lip-sync/rhubarb/lib/sphinxbase-rev13216/test/unit/testfuncs.sh.in

59 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2015-10-19 19:45:08 +00:00
# Utility functions and parameters for regression tests
# Predefined directories you may need
# Stupid broken CMU Facilities autoconf doesn't do @abs_top_srcdir@
builddir=../"@top_builddir@"
sourcedir=../"@top_srcdir@"
tests=$sourcedir/test
# Automatically report failures on exit
failures=""
trap "report_failures" 0
run_program() {
program="$1"
shift
$builddir/libtool --mode=execute "$builddir/src/$program/$program" $@
}
pass() {
title="$1"
echo "$title PASSED"
}
fail() {
title="$1"
echo "$title FAILED"
failures="$failures,$title"
}
assert() {
title="$1"
shift
if $@ >/dev/null 2>&1; then
pass "$title"
else
fail "$title"
fi
}
compare_table() {
title="$1"
shift
if perl "$tests/compare_table.pl" $@ | grep SUCCESS >/dev/null 2>&1; then
pass "$title"
else
fail "$title"
fi
}
report_failures() {
if test x"$failures" = x; then
echo "All sub-tests passed"
exit 0
else
echo "Sub-tests failed:$failures" | sed -e 's/,/\n/g'
exit 1
fi
}