Initial import to Tizen
[profile/ivi/sphinxbase.git] / test / regression / testfuncs_cygwin.sh
1 # Utility functions and parameters for regression tests
2
3 # Predefined directories you may need
4 : ${CONFIGURATION:=Debug}
5 builddir="../../bin/$CONFIGURATION"
6 sourcedir="../.."
7 tests=$sourcedir/test
8
9 # Automatically report failures on exit
10 failures=""
11 trap "report_failures" 0
12
13 run_program() {
14     program=`basename $1`
15     shift
16     "$builddir/$program" $@
17 }
18
19 debug_program() {
20     program=`basename $1`
21     shift
22     gdb --args "$builddir/$program" $@
23 }
24
25 memcheck_program() {
26     program=`basename $1`
27     shift
28     valgrind --leak-check=full "$builddir/$program" $@
29 }
30
31 pass() {
32     title="$1"
33     echo "$title PASSED"
34 }
35
36 fail() {
37     title="$1"
38     echo "$title FAILED"
39     failures="$failures,$title"
40 }
41
42 compare_table() {
43     title="$1"
44     shift
45     if perl "$tests/compare_table.pl" $@ | grep SUCCESS >/dev/null 2>&1; then
46         pass "$title"
47     else
48         fail "$title"
49     fi 
50 }
51
52 report_failures() {
53     if test x"$failures" = x; then
54         echo "All sub-tests passed"
55         exit 0
56     else
57         echo "Sub-tests failed:$failures" | sed -e 's/,/ /g'
58         exit 1
59     fi
60 }