Remove trailing whitespace in C source
[dbus-python-phuang.git] / test / run-test.sh
blob6058afa9dffe2e89fdd79efe4dd26d1d454fc521
1 #! /bin/bash
3 export DBUS_FATAL_WARNINGS=1
4 ulimit -c unlimited
6 function die()
8 if ! test -z "$DBUS_SESSION_BUS_PID" ; then
9 echo "killing message bus $DBUS_SESSION_BUS_PID" >&2
10 kill -9 "$DBUS_SESSION_BUS_PID"
12 echo "$SCRIPTNAME: $*" >&2
13 exit 1
16 if test -z "$PYTHON"; then
17 echo "Warning: \$PYTHON not set, assuming 'python'" >&2
18 export PYTHON=python
21 if test -z "$DBUS_TOP_SRCDIR" ; then
22 die "Must set DBUS_TOP_SRCDIR"
25 if test -z "$DBUS_TOP_BUILDDIR" ; then
26 die "Must set DBUS_TOP_BUILDDIR"
29 SCRIPTNAME=$0
31 ## so the tests can complain if you fail to use the script to launch them
32 export DBUS_TEST_PYTHON_RUN_TEST_SCRIPT=1
33 # Rerun ourselves with tmp session bus if we're not already
34 if test -z "$DBUS_TEST_PYTHON_IN_RUN_TEST"; then
35 DBUS_TEST_PYTHON_IN_RUN_TEST=1
36 export DBUS_TEST_PYTHON_IN_RUN_TEST
37 exec "$DBUS_TOP_SRCDIR"/test/run-with-tmp-session-bus.sh $SCRIPTNAME
38 fi
40 echo "running test-standalone.py"
41 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-standalone.py || die "test-standalone.py failed"
43 echo "running test-unusable-main-loop.py"
44 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-unusable-main-loop.py || die "... failed"
46 echo "running the examples"
48 $PYTHON "$DBUS_TOP_SRCDIR"/examples/example-service.py &
49 $PYTHON "$DBUS_TOP_SRCDIR"/examples/example-signal-emitter.py &
50 $PYTHON "$DBUS_TOP_SRCDIR"/examples/list-system-services.py --session ||
51 die "list-system-services.py --session failed!"
52 $PYTHON "$DBUS_TOP_SRCDIR"/examples/example-async-client.py ||
53 die "example-async-client failed!"
54 $PYTHON "$DBUS_TOP_SRCDIR"/examples/example-client.py --exit-service ||
55 die "example-client failed!"
56 $PYTHON "$DBUS_TOP_SRCDIR"/examples/example-signal-recipient.py --exit-service ||
57 die "example-signal-recipient failed!"
59 echo "running cross-test (for better diagnostics use mjj29's dbus-test)"
61 ${MAKE:-make} -s cross-test-server > "$DBUS_TOP_BUILDDIR"/test/cross-server.log&
62 sleep 1
63 ${MAKE:-make} -s cross-test-client > "$DBUS_TOP_BUILDDIR"/test/cross-client.log
65 if grep . "$DBUS_TOP_BUILDDIR"/test/cross-client.log >/dev/null; then
66 : # OK
67 else
68 die "cross-test client produced no output"
70 if grep . "$DBUS_TOP_BUILDDIR"/test/cross-server.log >/dev/null; then
71 : # OK
72 else
73 die "cross-test server produced no output"
76 if grep fail "$DBUS_TOP_BUILDDIR"/test/cross-client.log; then
77 die "^^^ Cross-test client reports failures, see test/cross-client.log"
78 else
79 echo " - cross-test client reported no failures"
81 if grep untested "$DBUS_TOP_BUILDDIR"/test/cross-server.log; then
82 die "^^^ Cross-test server reports incomplete test coverage"
83 else
84 echo " - cross-test server reported no untested functions"
87 echo "running test-client.py"
88 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-client.py || die "test-client.py failed"
89 echo "running test-signals.py"
90 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-signals.py || die "test-signals.py failed"
92 rm -f "$DBUS_TOP_BUILDDIR"/test/test-service.log
93 rm -f "$DBUS_TOP_BUILDDIR"/test/cross-client.log
94 rm -f "$DBUS_TOP_BUILDDIR"/test/cross-server.log
95 exit 0