Author: mvidner
Date: Thu Jun 25 17:18:11 2009
New Revision: 57749
URL: http://svn.opensuse.org/viewcvs/yast?rev=57749&view=rev
Log:
Added a test case for bnc#516492 (empty dict -> empty list).
Separated the server setup from the test cases.
Added:
trunk/core/dbus/namespace_service/testsuite/t2 (with props)
trunk/core/dbus/namespace_service/testsuite/test_all (with props)
trunk/core/dbus/namespace_service/testsuite/test_server (with props)
Modified:
trunk/core/dbus/namespace_service/testsuite/Makefile.am
trunk/core/dbus/namespace_service/testsuite/modules/TEST.ycp
trunk/core/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test
trunk/core/dbus/namespace_service/testsuite/t1
Modified: trunk/core/dbus/namespace_service/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/Makefile.am?rev=57749&r1=57748&r2=57749&view=diff
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/Makefile.am (original)
+++ trunk/core/dbus/namespace_service/testsuite/Makefile.am Thu Jun 25 17:18:11 2009
@@ -1,8 +1,8 @@
# adhoc testing, TODO use a decent framework (dejagnu does not qualify)
-TESTS = t1
+TESTS = test_all
SUBDIRS = modules
-EXTRA_DIST = $(wildcard *.test) t1
+EXTRA_DIST = $(wildcard *.test) test_all test_server t1 t2
CLEANFILES = $(wildcard *.test.reply)
Modified: trunk/core/dbus/namespace_service/testsuite/modules/TEST.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/modules/TEST.ycp?rev=57749&r1=57748&r2=57749&view=diff
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/modules/TEST.ycp (original)
+++ trunk/core/dbus/namespace_service/testsuite/modules/TEST.ycp Thu Jun 25 17:18:11 2009
@@ -78,4 +78,7 @@
global define void Void()
{return;}
+global define any ParamMap(map m)
+{return m;}
+
}
Modified: trunk/core/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test?rev=57749&r1=57748&r2=57749&view=diff
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test (original)
+++ trunk/core/dbus/namespace_service/testsuite/org.freedesktop.DBus.Introspectable.Introspect.test Thu Jun 25 17:18:11 2009
@@ -28,6 +28,7 @@
<method name='MapStringAny'><arg name='ret' type='a{sv}' direction='out'/></method>
<method name='MapStringListString'><arg name='ret' type='a{sas}' direction='out'/></method>
<method name='MapStringString'><arg name='ret' type='a{ss}' direction='out'/></method>
+ <method name='ParamMap'><arg name='ret' type='v' direction='out'/><arg name='param' type='a{sv}' direction='in'/></method>
<method name='String'><arg name='ret' type='s' direction='out'/></method>
<method name='Symbol'><arg name='ret' type='s' direction='out'/></method>
<method name='Void'></method>
@@ -53,6 +54,7 @@
<method name='MapStringAny'><arg name='ret' type='(bsv)' direction='out'/></method>
<method name='MapStringListString'><arg name='ret' type='(bsv)' direction='out'/></method>
<method name='MapStringString'><arg name='ret' type='(bsv)' direction='out'/></method>
+ <method name='ParamMap'><arg name='ret' type='(bsv)' direction='out'/><arg name='param' type='(bsv)' direction='in'/></method>
<method name='String'><arg name='ret' type='(bsv)' direction='out'/></method>
<method name='Symbol'><arg name='ret' type='(bsv)' direction='out'/></method>
<method name='Void'></method>
Modified: trunk/core/dbus/namespace_service/testsuite/t1
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/t1?rev=57749&r1=57748&r2=57749&view=diff
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/t1 (original)
+++ trunk/core/dbus/namespace_service/testsuite/t1 Thu Jun 25 17:18:11 2009
@@ -11,22 +11,6 @@
# TODO: more tests, probably in python or whatever so that
# the responses can be inspected better
-# This launches the bus daemon,
-# exports DBUS_SESSION_BUS_ADDRESS and sets DBUS_SESSION_BUS_PID
-eval $(dbus-launch --sh-syntax)
-# Clean up at exit. This will also kill the server.
-trap "kill $DBUS_SESSION_BUS_PID" EXIT TERM INT
-
-echo -n "Hey, server, get on da bus... "
-
-# load the modules from the current directory
-export Y2DIR=.
-
-# start the server, preload TEST.ycp module
-PRG="../src/yast_modules_dbus_server --disable-timer --test TEST"
-$PRG & sleep 3
-echo "off we go!"
-
SEND0="dbus-send --session --dest=org.opensuse.YaST.modules"
CALL="$SEND0 --type=method_call"
@@ -47,5 +31,3 @@
exit 1
fi
done
-
-
Added: trunk/core/dbus/namespace_service/testsuite/t2
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/t2?rev=57749&view=auto
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/t2 (added)
+++ trunk/core/dbus/namespace_service/testsuite/t2 Thu Jun 25 17:18:11 2009
@@ -0,0 +1,27 @@
+#! /usr/bin/python
+# test passing an empty map as an argument, bnc#516492
+import dbus
+T_o = dbus.SessionBus().get_object('org.opensuse.YaST.modules',
+ '/org/opensuse/YaST/modules/TEST')
+
+# A) explicit typing
+YT = dbus.Interface(T_o, 'org.opensuse.YaST.YCPValues')
+yp = (False, "map", dbus.Dictionary(signature="sv", variant_level=1))
+yrp = YT.ParamMap(yp)
+print yrp
+assert yrp[0] == False
+assert yrp[1] == "map"
+rp = yrp[2]
+assert isinstance(rp, dict)
+assert len(rp.values()) == 0
+
+# B) implicit typing
+T = dbus.Interface(T_o, 'org.opensuse.YaST.Values')
+# p = {} # ValueError: Unable to guess signature from an empty dict
+p = dbus.Dictionary(signature="sv")
+rp = T.ParamMap(p)
+print rp
+assert isinstance(rp, dict)
+assert len(rp.values()) == 0
+
+# T.NoSuchMethod() # TODO it does not throw!
Added: trunk/core/dbus/namespace_service/testsuite/test_all
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/test_all?rev=57749&view=auto
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/test_all (added)
+++ trunk/core/dbus/namespace_service/testsuite/test_all Thu Jun 25 17:18:11 2009
@@ -0,0 +1,14 @@
+#! /bin/sh
+# run all applicable test cases with proper setup
+# $0
+# $0 ./a_single_testcase
+: ${CASES:=$@}
+# : ${CASES:=./t?} # t2 fails. also, it requires python
+ : ${CASES:=./t1}
+
+# load the modules from the current directory
+export Y2DIR=.
+./test_server \
+ ../src/yast_modules_dbus_server --disable-timer --test TEST \
+ -- \
+ $CASES
Added: trunk/core/dbus/namespace_service/testsuite/test_server
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/dbus/namespace_service/testsuite/test_server?rev=57749&view=auto
==============================================================================
--- trunk/core/dbus/namespace_service/testsuite/test_server (added)
+++ trunk/core/dbus/namespace_service/testsuite/test_server Thu Jun 25 17:18:11 2009
@@ -0,0 +1,30 @@
+#! /bin/sh
+# A wrapper for DBus tests
+# Sets up a private session bus and calls all its arguments in turn
+# exiting on first failure
+# $0 server [arg1 arg2...] -- test1 test2...
+set -o errexit
+
+while [ "$1" != "--" ]; do
+ SERVER="$SERVER $1"
+ shift
+done
+shift # --
+
+# This launches the bus daemon,
+# exports DBUS_SESSION_BUS_ADDRESS and sets DBUS_SESSION_BUS_PID
+# FIXME dbus-launch is in dbus-1-x11, an unnecessary dependency
+eval $(dbus-launch --sh-syntax)
+# Clean up at exit. This will also kill the server.
+trap "kill $DBUS_SESSION_BUS_PID" EXIT TERM INT
+
+echo -n "Hey, server, get on da bus... "
+# start the server
+$SERVER & sleep 3
+echo "off we go!"
+
+while [ -n "$1" ]; do
+ echo Running $1
+ $1
+ shift
+done
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org