Update NEWS
[dbus-python-phuang.git] / test / run-test.sh
blob94da991b53997f4c557bbac91467d6f148ef80f6
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 dbus-monitor > "$DBUS_TOP_BUILDDIR"/test/monitor.log &
42 echo "running test-standalone.py"
43 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-standalone.py || die "test-standalone.py failed"
45 echo "running test-unusable-main-loop.py"
46 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-unusable-main-loop.py || die "... failed"
48 #echo "running the examples"
50 #$PYTHON "$DBUS_TOP_SRCDIR"/examples/example-service.py &
51 #$PYTHON "$DBUS_TOP_SRCDIR"/examples/example-signal-emitter.py &
52 #$PYTHON "$DBUS_TOP_SRCDIR"/examples/list-system-services.py --session ||
53 # die "list-system-services.py --session failed!"
54 #$PYTHON "$DBUS_TOP_SRCDIR"/examples/example-async-client.py ||
55 # die "example-async-client failed!"
56 #$PYTHON "$DBUS_TOP_SRCDIR"/examples/example-client.py --exit-service ||
57 # die "example-client failed!"
58 #$PYTHON "$DBUS_TOP_SRCDIR"/examples/example-signal-recipient.py --exit-service ||
59 # die "example-signal-recipient failed!"
61 echo "running cross-test (for better diagnostics use mjj29's dbus-test)"
63 ${MAKE:-make} -s cross-test-server > "$DBUS_TOP_BUILDDIR"/test/cross-server.log&
64 sleep 1
65 ${MAKE:-make} -s cross-test-client > "$DBUS_TOP_BUILDDIR"/test/cross-client.log
67 if grep . "$DBUS_TOP_BUILDDIR"/test/cross-client.log >/dev/null; then
68 : # OK
69 else
70 die "cross-test client produced no output"
72 if grep . "$DBUS_TOP_BUILDDIR"/test/cross-server.log >/dev/null; then
73 : # OK
74 else
75 die "cross-test server produced no output"
78 if grep fail "$DBUS_TOP_BUILDDIR"/test/cross-client.log; then
79 die "^^^ Cross-test client reports failures, see test/cross-client.log"
80 else
81 echo " - cross-test client reported no failures"
83 if grep untested "$DBUS_TOP_BUILDDIR"/test/cross-server.log; then
84 die "^^^ Cross-test server reports incomplete test coverage"
85 else
86 echo " - cross-test server reported no untested functions"
89 echo "running test-client.py"
90 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-client.py || die "test-client.py failed"
91 echo "running test-signals.py"
92 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-signals.py || die "test-signals.py failed"
94 echo "running test-p2p.py"
95 $PYTHON "$DBUS_TOP_SRCDIR"/test/test-p2p.py || die "... failed"
97 rm -f "$DBUS_TOP_BUILDDIR"/test/test-service.log
98 rm -f "$DBUS_TOP_BUILDDIR"/test/cross-client.log
99 rm -f "$DBUS_TOP_BUILDDIR"/test/cross-server.log
100 rm -f "$DBUS_TOP_BUILDDIR"/test/monitor.log
101 exit 0