Commit Graph

42 Commits

Author SHA1 Message Date
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Tobias Nygren
0d0db60959 gio/gtestdbus.c: don't use non-standard %m printf modifier
https://bugzilla.gnome.org/show_bug.cgi?id=756706
2016-02-19 11:29:32 +00:00
Simon McVittie
32492c6ab0 GDBus: try XDG_RUNTIME_DIR/bus before resorting to dbus-launch
This is the right thing to do for the "a session is a user-session"
model implemented in dbus 1.9.14, which is described in
<http://lists.freedesktop.org/archives/dbus/2015-January/016522.html>.

It also resembles sd-bus' behaviour, although sd-bus will only try
kdbus and XDG_RUNTIME_DIR/bus, and never runs dbus-launch.

On systems following the more traditional "a session is a login-session"
model, X_R_D/bus won't exist, so it is harmless to check for it before
falling back to X11 autolaunching. Again, this matches the behaviour
of current libdbus and sd-bus versions.

Now that we do this, g_test_dbus_unset() needs to clear XDG_RUNTIME_DIR
as well as everything else.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=747941
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
2015-06-09 18:17:16 +01:00
Simon McVittie
4865538ce3 GTestDBus: use g_printerr() for status message
This avoids any possibility of interfering with test syntax (such as
TAP) on stdout. TAP specifically does not parse stderr.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-05-11 20:24:30 +01:00
Philip Withnall
d80adeaa96 gtestdbus: Don’t close stdout for dbus-daemon
The stdout FD passed to dbus-daemon is propagated to all its child
processes, such as service activated processes. If we close the FD after
reading the bus address from the daemon, any child process which
subsequently writes to stdout (e.g. for logging) will get a SIGPIPE and
explode.

Instead of closing the stdout FD immediately after dbus-daemon has
spawned, keep it open until the daemon is killed.

https://bugzilla.gnome.org/show_bug.cgi?id=732019
2014-06-22 13:02:18 +01:00
Chun-wei Fan
c2a828772b gio/gtestdbus.c: Fix write_config_file() for Windows
Windows does not like g_unlink() to be called on files whose file
descriptor is still open, so doing that would cause a permission
denied error.  Since the fd is not used in that function after
acquiring the temp file, close it earlier before
g_file_set_contents(), so that it can complete successfully.

This fixes a number of GTK+ tests on Windows.

https://bugzilla.gnome.org/show_bug.cgi?id=719344
2014-05-12 22:14:05 +08:00
Matthias Clasen
cb588d4532 Convert external links to markdown syntax 2014-02-05 21:23:28 -05:00
Matthias Clasen
0cc20b7e0b Don't use <filename> in docs
Switch to simpler markdown, `foo`.
2014-02-05 20:17:46 -05:00
Matthias Clasen
111803030d Don't use <envar> in docs
Switch to simpler markdown, `foo`.
2014-02-05 19:32:41 -05:00
Matthias Clasen
6566f746f6 Drop use of xinclude in GTestDBus docs 2014-02-01 20:41:47 -05:00
Matthias Clasen
4ab94a2683 gtestdbus: Use markdown for sections 2014-02-01 10:48:36 -05:00
Matthias Clasen
cade4d6f19 Fix the docs build 2014-01-31 22:14:01 -05:00
Matthias Clasen
17f51583a8 Docs: Convert examples to |[ ]| 2014-01-31 21:56:33 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Philip Withnall
c07eccd9c2 gtestdbus: Add a note about thread safety to the documentation
https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-12-06 09:41:56 +00:00
Philip Withnall
9d4cd9c5ae gtestdbus: Minor documentation fixes
https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-11-29 08:11:13 +00:00
Philip Withnall
46c1aea0e7 gtestdbus: Fix non-const use of const variables
The argv array should be declared as const.

https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-11-29 08:11:13 +00:00
Philip Withnall
598a9c5028 gtestdbus: Fix variable shadowing
Shut up, GCC.

https://bugzilla.gnome.org/show_bug.cgi?id=712148
2013-11-29 08:11:13 +00:00
Stef Walter
baf92d09d6 gtestdbus: Properly close server connections
Otherwise g_test_dbus_down() following a g_test_dbus_stop()
will hang until it times out.

https://bugzilla.gnome.org/show_bug.cgi?id=711807
2013-11-23 17:37:58 -05:00
Stef Walter
797959f05a gtestdbus: Don't destroy GSource twice
https://bugzilla.gnome.org/show_bug.cgi?id=711806
2013-11-23 13:47:29 -05:00
Dan Winship
158dde0507 Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.

Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:25:39 -05:00
Stef Walter
419b47e166 gtestdbus: Fix leak of GMainLoop
https://bugzilla.gnome.org/show_bug.cgi?id=711808
2013-11-11 06:55:09 +01:00
Xavier Claessens
06fbdb04d5 GTestDBus: Make sure only DBUS_SESSION_BUS_ADDRESS is set by default
g_test_dbus_unset() now also unset DBUS_STARTER_ADDRESS and
DBUS_STARTER_BUS_TYPE.

https://bugzilla.gnome.org/show_bug.cgi?id=697348
2013-10-29 13:42:14 -04:00
Emmanuele Bassi
54cc43630d Rename the generated private data getter function
As it turns out, we have examples of internal functions called
type_name_get_private() in the wild (especially among older libraries),
so we need to use a name for the per-instance private data getter
function that hopefully won't conflict with anything.
2013-06-24 15:43:04 +01:00
Emmanuele Bassi
32747def4b gio: Use the new private instance data declaration
Use the newly added macros, and remove the explicit calls to
g_type_class_add_private().

https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-06-24 14:18:01 +01:00
Tristan Van Berkom
dd0ea5dcc2 Added examples to GTestDBus documentation 2013-03-21 16:37:21 +09:00
Dan Winship
731b469908 win32: define _WIN32_WINNT globally
Rather than defining _WIN32_WINNT only in a handful of files, define
it in config.h, like we do with _GNU_SOURCE.

(Also remove a "#define WIN32_LEAN_AND_MEAN" that isn't really all
that useful.)

https://bugzilla.gnome.org/show_bug.cgi?id=688109
2012-11-15 14:19:05 -05:00
Colin Walters
6d88a2f822 build: Add missing "static" keyword where it should be used
Otherwise we fail to build with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Will Thompson
a342be7138 gtestdbus: correct documentation typos
https://bugzilla.gnome.org/show_bug.cgi?id=685787
2012-10-11 16:12:47 +01:00
Matthias Clasen
c44f8f5b9f Document g_test_dbus_get_flags 2012-09-23 20:14:27 -04:00
Chun-wei Fan
2954f70d39 Fix build on Visual C++
-glib/gmarkup.c: Use G_VA_COPY() instead of va_copy() as va_copy() may not
 be universally available.
-gio/gtestdbus.c: Include io.h on Windows for close()
2012-08-17 19:22:43 +08:00
Matthias Clasen
b55a2a2005 Don't use GIO in GTestDBus setup
Using GIO here may cause the gvfs module to be loaded, which
in turn gets onto the session bus to talk to gvfsd - not ideal
if you are trying to control the session bus life cycle. Instead,
just use old-fashioned glib file utils.
2012-08-06 12:08:21 -04:00
Colin Walters
d6aa3b3bdd GTestDBus: Don't call into gvfs
https://bugzilla.gnome.org/show_bug.cgi?id=678808
2012-06-26 12:26:05 -04:00
Chun-wei Fan
875854411a Bug 678332-GIO: Fix build on Windows/non-GCC
-gconverterinputstream.c: Avoid GCCism by not using non-standard pointer
 arithmetic on void*, but do a cast to char * as that seems to be what the
 variable was used for.
-gtestdbus.c: Don't include unistd.h unconditionally, and use g_usleep()
 instead of usleep(), as usleep() is not universally available.
2012-06-19 12:04:28 +08:00
Dan Winship
c37273dccb fix warnings 2012-04-30 09:28:42 -04:00
Alexander Larsson
74214e2997 GTestDBus: Allow to specify the dbus-daemon binary
The env var G_TEST_DBUS_DAEMON lets you change dbus-daemon to
whatever you want. This is useful to test with gdbus-daemon
2012-04-20 15:02:48 +02:00
Matthias Clasen
289e3b9143 More beautiful fix
A comma on a line by itself is too ugly to stand.
2012-04-19 17:15:14 -04:00
Alexander Larsson
bb78753a66 Fix non-win32 build error in my recent commit 2012-04-19 20:46:08 +02:00
Alexander Larsson
58e613bfc7 GTestDBus: Make work on win32
Win32 doesn't have things like fork so the existing code has no way
of working. Instead we swap it all out for a custom implementation
on win32.
2012-04-19 18:19:01 +02:00
Xavier Claessens
95bf3d1194 Add GTestDBus object
This is a helper to write unit tests using a private dbus-daemon.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-19 10:06:26 +02:00
David Zeuthen
a6f83d73e5 Revert "Add GTestDBus object"
This reverts commit 1b5f70b5b0.
2012-04-18 13:47:51 -04:00
Xavier Claessens
1b5f70b5b0 Add GTestDBus object
This is a helper to write unit tests using a private dbus-daemon.

session_bus_up/down() are now just wrappers around a GTestDBus singleton.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-18 11:19:13 -04:00