summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile62
-rw-r--r--tests.txt105
-rw-r--r--tmp-session.conf30
3 files changed, 129 insertions, 68 deletions
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:
-
-<annotation name="org.freedesktop.DBus.Description" value="Returns the sum of the values in the input list"/>
-<method name="sum" >
- <arg type="ay" direction="in"/>
- <arg type="u" direction="out"/>
-</method>
-
-<annotation name="org.freedesktop.DBus.Description" value="Returns the sum of the values in the input list"/>
-<method name="sum" >
- <arg type="ai" direction="in"/>
- <arg type="x" direction="out"/>
-</method>
-
-<annotation name="org.freedesktop.DBus.Description" value="Given a map of A => B, should return a map of B => a list of all the As which mapped to B"/>
-<method name="mapping_invert" >
- <arg type="a{ss}" direction="in"/>
- <arg type="a{sas}" direction="out"/>
-</method>
-
-<annotation name="org.freedesktop.DBus.Description" value="This method returns the contents of a struct as separate values"/>
-<method name="destruct" >
- <arg type="(sun)" direction="in"/>
- <arg type="s" direction="out"/>
- <arg type="u" direction="out"/>
- <arg type="n" direction="out"/>
-</method>
-
-<annotation name="org.freedesktop.DBus.Description" value="Given any compound type as a variant, return all the primitive types recursively contained within as an array of variants"/>
-<method name="primitize" >
- <arg type="v" direction="in"/>
- <arg type="av" direction="out"/>
-</method>
-
-<annotation name="org.freedesktop.DBus.Description" value="inverts it's input"/>
-<method name="invert" >
- <arg type="b" direction="in"/>
- <arg type="b" direction="out"/>
-</method>
-
-<annotation name="org.freedesktop.DBus.Description" value="triggers sending of a signal from the supplied object with the given parameter"/>
-<method name="triggersignal" >
- <arg type="o" direction="in"/>
- <arg type="t" direction="in"/>
-</method>
-
-<signal name="triggered">
- <arg type="t"/>
-</signal>
-
-<signal name="trigger">
- <arg type="q"/>
- <arg type="d"/>
-</signal>
-
-<annotation name="org.freedesktop.DBus.Description" value="when the trigger signal is received, this method should be called on the sending service/object."/>
-<method name="signalresponse" >
- <arg type="q" direction="in"/>
- <arg type="d" direction="in"/>
-</method>
-
-
-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:
+ <interface.function> ok
+ <interface.function> ok
+ ....
+ <interface.function> untested
+
+ Client:
+ <interface.function> pass
+ <interface.function> pass
+ ....
+ <interface.function> fail <id1>
+ <interface.function> fail <id2>
+ report <id1>: <text description of failure>
+ report <id2>: <text description of failure>
+
+
+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 @@
+<!-- This configuration file controls the per-user-login-session message bus.
+ Add a session-local.conf and edit that rather than changing this
+ file directly. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <!-- Our well-known bus type, don't change this -->
+ <type>session</type>
+
+ <listen>unix:path=./tmp-session-bus</listen>
+
+ <servicedir>/usr/share/dbus-1/services</servicedir>
+
+ <policy context="default">
+ <!-- Allow everything to be sent -->
+ <allow send_destination="*"/>
+ <!-- Allow everything to be received -->
+ <allow eavesdrop="true"/>
+ <!-- Allow anyone to own anything -->
+ <allow own="*"/>
+ </policy>
+
+ <!-- This is included last so local configuration can override what's
+ in this standard file -->
+ <include ignore_missing="yes">session-local.conf</include>
+
+ <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
+
+</busconfig>