gtestdbus: Use markdown for sections

This commit is contained in:
Matthias Clasen
2014-02-01 10:48:36 -05:00
parent eb69bc6aa4
commit 4ab94a2683

View File

@@ -321,29 +321,26 @@ _g_test_watcher_remove_pid (GPid pid)
* A helper class for testing code which uses D-Bus without touching the user's * A helper class for testing code which uses D-Bus without touching the user's
* session bus. * session bus.
* *
* Note that #GTestDBus modifies the users environment, calling setenv(). This * Note that #GTestDBus modifies the users environment, calling setenv().
* is not thread-safe, so all #GTestDBus calls should be completed before * This is not thread-safe, so all #GTestDBus calls should be completed before
* threads are spawned, or should have appropriate locking to ensure no access * threads are spawned, or should have appropriate locking to ensure no access
* conflicts to environment variables shared between #GTestDBus and other * conflicts to environment variables shared between #GTestDBus and other
* threads. * threads.
* *
* <refsect2 id="gio-D-Bus-Test-Scaffolding"> * ## Creating unit tests using GTestDBus
* <title>Creating unit tests using GTestDBus</title> *
* <para>
* Testing of D-Bus services can be tricky because normally we only ever run * Testing of D-Bus services can be tricky because normally we only ever run
* D-Bus services over an existing instance of the D-Bus daemon thus we * D-Bus services over an existing instance of the D-Bus daemon thus we
* usually don't activate D-Bus services that are not yet installed into the * usually don't activate D-Bus services that are not yet installed into the
* target system. The #GTestDBus object makes this easier for us by taking care * target system. The #GTestDBus object makes this easier for us by taking care
* of the lower level tasks such as running a private D-Bus daemon and looking * of the lower level tasks such as running a private D-Bus daemon and looking
* up uninstalled services in customizable locations, typically in your source code tree. * up uninstalled services in customizable locations, typically in your source
* </para> * code tree.
* <para> *
* The first thing you will need is a separate service description file for the * The first thing you will need is a separate service description file for the
* D-Bus daemon. Typically a <filename>services</filename> subdirectory of * D-Bus daemon. Typically a <filename>services</filename> subdirectory of
* your <filename>tests</filename> directory * your <filename>tests</filename> directory is a good place to put this file.
* is a good place to put this file. *
* </para>
* <para>
* The service file should list your service along with an absolute path to the * The service file should list your service along with an absolute path to the
* uninstalled service executable in your source tree. Using autotools we would * uninstalled service executable in your source tree. Using autotools we would
* achieve this by adding a file such as <filename>my-server.service.in</filename> * achieve this by adding a file such as <filename>my-server.service.in</filename>
@@ -360,20 +357,16 @@ _g_test_watcher_remove_pid (GPid pid)
* |[ * |[
* -DTEST_SERVICES=\""$(abs_top_builddir)/tests/services"\" * -DTEST_SERVICES=\""$(abs_top_builddir)/tests/services"\"
* ]| * ]|
* </para>
* <para>
* Once you have a service definition file which is local to your source tree, * Once you have a service definition file which is local to your source tree,
* you can proceed to set up a GTest fixture using the #GTestDBus scaffolding. * you can proceed to set up a GTest fixture using the #GTestDBus scaffolding.
* <example> *
* <title>Test Fixture for D-Bus services</title> * Here is an example of a test fixture for D-Bus services:
* <programlisting> * <programlisting>
* <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-test-fixture.c"> * <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-test-fixture.c">
* <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback> * <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
* </xi:include> * </xi:include>
* </programlisting> * </programlisting>
* </example> *
* </para>
* <para>
* Note that these examples only deal with isolating the D-Bus aspect of your * Note that these examples only deal with isolating the D-Bus aspect of your
* service. To successfully run isolated unit tests on your service you may need * service. To successfully run isolated unit tests on your service you may need
* some additional modifications to your test case fixture. For example; if your * some additional modifications to your test case fixture. For example; if your
@@ -381,16 +374,14 @@ _g_test_watcher_remove_pid (GPid pid)
* not load the schema in the ordinary installed location (chances are that your service * not load the schema in the ordinary installed location (chances are that your service
* and schema files are not yet installed, or worse; there is an older version of the * and schema files are not yet installed, or worse; there is an older version of the
* schema file sitting in the install location). * schema file sitting in the install location).
* </para> *
* <para>
* Most of the time we can work around these obstacles using the environment. Since the * Most of the time we can work around these obstacles using the environment. Since the
* environment is inherited by the D-Bus daemon created by #GTestDBus and then in turn * environment is inherited by the D-Bus daemon created by #GTestDBus and then in turn
* inherited by any services the D-Bus daemon activates, using the setup routine for your * inherited by any services the D-Bus daemon activates, using the setup routine for your
* fixture is a practical place to help sandbox your runtime environment. For the rather * fixture is a practical place to help sandbox your runtime environment. For the rather
* typical GSettings case we can work around this by setting <envar>GSETTINGS_SCHEMA_DIR</envar> to the * typical GSettings case we can work around this by setting <envar>GSETTINGS_SCHEMA_DIR</envar> to the
* in tree directory holding your schemas in the above fixture_setup() routine. * in tree directory holding your schemas in the above fixture_setup() routine.
* </para> *
* <para>
* The GSettings schemas need to be locally pre-compiled for this to work. This can be achieved * The GSettings schemas need to be locally pre-compiled for this to work. This can be achieved
* by compiling the schemas locally as a step before running test cases, an autotools setup might * by compiling the schemas locally as a step before running test cases, an autotools setup might
* do the following in the directory holding schemas: * do the following in the directory holding schemas:
@@ -400,8 +391,6 @@ _g_test_watcher_remove_pid (GPid pid)
* *
* CLEANFILES += gschemas.compiled * CLEANFILES += gschemas.compiled
* ]| * ]|
* </para>
* </refsect2>
*/ */
typedef struct _GTestDBusClass GTestDBusClass; typedef struct _GTestDBusClass GTestDBusClass;