From 980479f4d62cba000bcd67dd5935eeee7bde73d4 Mon Sep 17 00:00:00 2001 From: mjj29 Date: Tue, 18 Jul 2006 17:45:40 -0100 Subject: test framework --- Makefile | 62 ++++++++++++++++++++++++++++++++ tests.txt | 105 ++++++++++++++++++++----------------------------------- tmp-session.conf | 30 ++++++++++++++++ 3 files changed, 129 insertions(+), 68 deletions(-) create mode 100644 Makefile create mode 100644 tmp-session.conf diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..21f941a --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +BINDINGS?=java glib python perl qt4 + +all: testall analyzeall + + +analyzeall: + ( for i in $(BINDINGS) ; do \ + echo "Test results for $${i}" ;\ + echo -n " Tested against: " ;\ + echo `ls *$${i}*.*.log | sed 's/\..*$$//;s/-/\n/g' | sort -u` ;\ + echo -n " Passes: " ;\ + echo -ne "\033[32m";\ + cat $${i}*.client.log | grep -c pass ;\ + echo -ne "\033[39m";\ + echo -n " Fails: " ;\ + if grep fail $${i}*.client.log &>/dev/null; then \ + echo -ne "\033[31m";\ + else \ + echo -ne "\033[32m";\ + fi; \ + cat $${i}*.client.log | grep -c fail ;\ + echo -ne "\033[39m";\ + echo -ne "\033[31m";\ + for j in $${i}*.client.log; do \ + for k in `grep fail $$j | cut -d' ' -f 3`; do \ + echo " " `grep "fail $$k" < $$j | cut -d' ' -f1`: `grep "^report $${k}:" < $$j | cut -d: -f2`; \ + done ;\ + done ;\ + echo -ne "\033[39m";\ + echo -n " $${i} failed to test: " ;\ + if grep fail $${i}*.client.log &>/dev/null; then \ + echo -ne "\033[33m";\ + else \ + echo -ne "\033[32m";\ + fi; \ + cat *$${i}.server.log | grep -c untested$$ ;\ + echo -ne "\033[33m";\ + cat *$${i}.server.log | grep untested$$ | cut -d' ' -f1 | sed 's/^/ /' | sort -u;\ + echo -ne "\033[39m";\ + done ) + + +testall: + ( for i in $(BINDINGS) ; do \ + for j in $(BINDINGS) ; do \ + make -s SERV=$$i CLI=$$j check ;\ + done \ + done) + +clean: + -rm -- *log + -rm address + -rm pid + -rm tmp-session-bus + +check: + ( dbus-daemon --config-file=tmp-session.conf --print-pid --print-address=5 --fork >pid 5>address ; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + make -sC $(SERV) cross-test-server > $(SERV)-$(CLI).server.log &\ + make -sC $(CLI) cross-test-client > $(SERV)-$(CLI).client.log ;\ + kill $$(cat pid) ) + diff --git a/tests.txt b/tests.txt index a876aa4..70f07c1 100644 --- a/tests.txt +++ b/tests.txt @@ -1,70 +1,39 @@ -Tests for DBus binding test rig: - -Tests are functions which will perform a particular transformation on the input and return the result. The should be defined as a DBus signature and description of the function. For example: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Clients try and cause these to fail in the most obscure way possible. Servers make sure all of their methods are called each run. Output format: - - - +Tests for D-Bus binding test rig: + +Tests are functions which will perform a particular transformation on the input +and return the result. The should be defined as a D-Bus signature and +description of the function: + +test-introspect.xml + +Clients try and cause these to fail in the most obscure way possible. Servers +make sure all of their methods are called each run. Output format: + + Server: + ok + ok + .... + untested + + Client: + pass + pass + .... + fail + fail + report : + report : + + +Starting clients and servers is done using Makefiles and chaining thereof. Each +binding should provide the following Makefile targets in their respective +top-level dirs: + + cross-test-server - run a server which binds to + org.freedesktop.DBus.Binding.TestServer. Listens and + answers method calls until Exit is called. Then prints + test reports. + cross-test-client - run a client which runs comprehensive tests against + the server, then calls Exit and prints test reports diff --git a/tmp-session.conf b/tmp-session.conf new file mode 100644 index 0000000..7f56570 --- /dev/null +++ b/tmp-session.conf @@ -0,0 +1,30 @@ + + + + + + session + + unix:path=./tmp-session-bus + + /usr/share/dbus-1/services + + + + + + + + + + + + session-local.conf + + contexts/dbus_contexts + + -- cgit v1.2.3