summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-09-26 17:37:20 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-09-28 19:00:56 +0100
commite9f0378bbf3cd4b355c81fd9e42d6530250d1484 (patch)
treec148cafb8040370b9ef7d9452b5b7924d2b8ba17 /test
parent2f2618294d342e72ffd791289e565782413fac67 (diff)
downloaddbus-e9f0378bbf3cd4b355c81fd9e42d6530250d1484.tar.gz
Merge tests' cmake and autotools bus configuration
In Unix, the tests listened on both debug-pipe (which is a socketpair, or a TCP emulation of socketpair on Windows) and a Unix socket. In the Windows port, the tests were hard-coded to listen on a particular port, which allowed the dispatch test to connect to that port, as long as no two tests ran simultaneously (which I don't think was ever guaranteed - make -j can violate this). That's valid out-of-process, and also fully-specified, so they only needed one <listen> directive, so the CMake input only had one. To make the tests work under CMake on Unix, there was a hack: the string substituted for the content of the <listen> directive contained </listen><listen> to get the other address in, which is pretty nasty. Instead of doing that, I've made both build systems, on both Unix and Windows, use both debug-pipe and a more normal transport (Unix or TCP). debug-pipe has a Windows implementation and it's used in dbus-spawn-win.c, so it'd better work. The use of debug-pipe is now hard-coded rather than being a configure parameter (there's no reason to vary it in different builds), and I used TEST_LISTEN as the name of the Unix/TCP address, because it's a "vague" address (no specific Unix path, no TCP port), that you can listen on but not connect to. This in turn means that we can merge the Autoconf .in and CMake .cmake files, similar to Bug #41033. You might wonder why I've kept debug-pipe. I did try to get rid of it, but it turns out that the tests in dispatch.c rely on dbus_connection_open_private() not blocking, and normal socket connections block on connect(). Until we fix that by adding an async version of dbus_connection_open_private(), it won't be safe to have a test like dispatch.c that "talks to itself", unless it uses a transport as trivial as debug-pipe in which neither end has to block on the other. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41222
Diffstat (limited to 'test')
-rw-r--r--test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake16
-rw-r--r--test/data/valid-config-files-system/debug-allow-all-fail.conf.in2
-rw-r--r--test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake16
-rw-r--r--test/data/valid-config-files-system/debug-allow-all-pass.conf.in2
-rw-r--r--test/data/valid-config-files/debug-allow-all-sha1.conf.cmake15
-rw-r--r--test/data/valid-config-files/debug-allow-all-sha1.conf.in2
-rw-r--r--test/data/valid-config-files/debug-allow-all.conf.cmake14
-rw-r--r--test/data/valid-config-files/debug-allow-all.conf.in2
8 files changed, 4 insertions, 65 deletions
diff --git a/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake b/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake
deleted file mode 100644
index 854bfe9c..00000000
--- a/test/data/valid-config-files-system/debug-allow-all-fail.conf.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <listen>@TEST_LISTEN@</listen>
- <type>system</type>
- <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
- <servicedir>@DBUS_TEST_DATA@/invalid-service-files-system</servicedir>
- <policy context="default">
- <allow send_interface="*"/>
- <allow receive_interface="*"/>
- <allow own="*"/>
- <allow user="*"/>
- </policy>
-</busconfig>
diff --git a/test/data/valid-config-files-system/debug-allow-all-fail.conf.in b/test/data/valid-config-files-system/debug-allow-all-fail.conf.in
index a61244b6..bab178f6 100644
--- a/test/data/valid-config-files-system/debug-allow-all-fail.conf.in
+++ b/test/data/valid-config-files-system/debug-allow-all-fail.conf.in
@@ -4,7 +4,7 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<listen>debug-pipe:name=test-server</listen>
- <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen>
+ <listen>@TEST_LISTEN@</listen>
<type>system</type>
<servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
<servicedir>@DBUS_TEST_DATA@/invalid-service-files-system</servicedir>
diff --git a/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake b/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake
deleted file mode 100644
index 1ac5c205..00000000
--- a/test/data/valid-config-files-system/debug-allow-all-pass.conf.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <listen>@TEST_LISTEN@</listen>
- <type>system</type>
- <servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
- <servicedir>@DBUS_TEST_DATA@/valid-service-files-system</servicedir>
- <policy context="default">
- <allow send_interface="*"/>
- <allow receive_interface="*"/>
- <allow own="*"/>
- <allow user="*"/>
- </policy>
-</busconfig>
diff --git a/test/data/valid-config-files-system/debug-allow-all-pass.conf.in b/test/data/valid-config-files-system/debug-allow-all-pass.conf.in
index 6105d841..38366730 100644
--- a/test/data/valid-config-files-system/debug-allow-all-pass.conf.in
+++ b/test/data/valid-config-files-system/debug-allow-all-pass.conf.in
@@ -4,7 +4,7 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<listen>debug-pipe:name=test-server</listen>
- <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen>
+ <listen>@TEST_LISTEN@</listen>
<type>system</type>
<servicehelper>@TEST_LAUNCH_HELPER_BINARY@</servicehelper>
<servicedir>@DBUS_TEST_DATA@/valid-service-files-system</servicedir>
diff --git a/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake b/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake
deleted file mode 100644
index 0c66f2ae..00000000
--- a/test/data/valid-config-files/debug-allow-all-sha1.conf.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-<!-- Bus that listens on a debug pipe and requires SHA1 auth, used to test SHA1 -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <listen>@TEST_LISTEN@</listen>
- <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir>
- <auth>DBUS_COOKIE_SHA1</auth>
- <policy context="default">
- <allow send_interface="*"/>
- <allow receive_interface="*"/>
- <allow own="*"/>
- <allow user="*"/>
- </policy>
-</busconfig>
diff --git a/test/data/valid-config-files/debug-allow-all-sha1.conf.in b/test/data/valid-config-files/debug-allow-all-sha1.conf.in
index ba68f453..8baee7db 100644
--- a/test/data/valid-config-files/debug-allow-all-sha1.conf.in
+++ b/test/data/valid-config-files/debug-allow-all-sha1.conf.in
@@ -4,7 +4,7 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<listen>debug-pipe:name=test-server</listen>
- <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen>
+ <listen>@TEST_LISTEN@</listen>
<servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir>
<auth>DBUS_COOKIE_SHA1</auth>
<policy context="default">
diff --git a/test/data/valid-config-files/debug-allow-all.conf.cmake b/test/data/valid-config-files/debug-allow-all.conf.cmake
deleted file mode 100644
index adc3aa59..00000000
--- a/test/data/valid-config-files/debug-allow-all.conf.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-<!-- Bus that listens on a debug pipe and doesn't create any restrictions -->
-
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <listen>@TEST_LISTEN@</listen>
- <servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir>
- <policy context="default">
- <allow send_interface="*"/>
- <allow receive_interface="*"/>
- <allow own="*"/>
- <allow user="*"/>
- </policy>
-</busconfig>
diff --git a/test/data/valid-config-files/debug-allow-all.conf.in b/test/data/valid-config-files/debug-allow-all.conf.in
index a086976b..00df20d5 100644
--- a/test/data/valid-config-files/debug-allow-all.conf.in
+++ b/test/data/valid-config-files/debug-allow-all.conf.in
@@ -4,7 +4,7 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<listen>debug-pipe:name=test-server</listen>
- <listen>unix:tmpdir=@TEST_SOCKET_DIR@</listen>
+ <listen>@TEST_LISTEN@</listen>
<servicedir>@DBUS_TEST_DATA@/valid-service-files</servicedir>
<policy context="default">
<allow send_interface="*"/>