File: testfuncs.sh.in

package info (click to toggle)
sphinxbase 0.8%2B5prealpha%2B1-21
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 10,672 kB
  • sloc: ansic: 28,813; sh: 11,829; makefile: 699; python: 338; perl: 121; yacc: 93; lex: 50
file content (60 lines) | stat: -rw-r--r-- 1,164 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Utility functions and parameters for regression tests

# Predefined directories you may need
# Stupid broken RedHat 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" $@
}

debug_program() {
    program="$1"
    shift
    $builddir/libtool --mode=execute gdb --args "$builddir/src/$program" $@
}

memcheck_program() {
    program="$1"
    shift
    $builddir/libtool --mode=execute valgrind --leak-check=full "$builddir/src/$program" $@
}

pass() {
    title="$1"
    echo "$title PASSED"
}

fail() {
    title="$1"
    echo "$title FAILED"
    failures="$failures,$title"
}

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/,/ /g'
	exit 1
    fi
}