Merge lp:~mardy/dbus-test-runner/lp1201409 into lp:dbus-test-runner/13.10

Proposed by Alberto Mardegan
Status: Merged
Approved by: Ken VanDine
Approved revision: 64
Merged at revision: 63
Proposed branch: lp:~mardy/dbus-test-runner/lp1201409
Merge into: lp:dbus-test-runner/13.10
Diff against target: 83 lines (+15/-1)
3 files modified
libdbustest/service.c (+10/-1)
libdbustest/service.h (+1/-0)
src/dbus-test-runner.c (+4/-0)
To merge this branch: bzr merge lp:~mardy/dbus-test-runner/lp1201409
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ken VanDine Approve
Review via email: mp+174741@code.launchpad.net

Commit message

Propagate the current environment to activated services

Do not clear the environment when starting dbus-daemon. This means that the
current environment will be available to all the services activated by the
daemon, in the same way that it is available to the processes given to the
dbus-test-runner command line.

Description of the change

Propagate the current environment to activated services

Do not clear the environment when starting dbus-daemon. This means that the
current environment will be available to all the services activated by the
daemon, in the same way that it is available to the processes given to the
dbus-test-runner command line.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

I'm worried what the effects on all the existing packages using this might be. We might get flooded with test failures if tests expect a clean environment. Most tests probably don't, I just don't know.

Revision history for this message
Alberto Mardegan (mardy) wrote :

I think that most users of dbus-test-runner will not use the activation feature, and just specify the processes to run on the command line.
But anyway, if desired I can make this fix conditional, depending on a --keep-env command-line option.

lp:~mardy/dbus-test-runner/lp1201409 updated
64. By Alberto Mardegan

Let the client decide whether to keep the environment

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alberto Mardegan (mardy) wrote :

I added a command line argument to toggle the environment propagation behaviour. :-)

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Thanks

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdbustest/service.c'
2--- libdbustest/service.c 2013-02-21 17:33:04 +0000
3+++ libdbustest/service.c 2013-07-15 13:35:30 +0000
4@@ -58,6 +58,7 @@
5 gchar * dbus_configfile;
6
7 gboolean first_time;
8+ gboolean keep_env;
9
10 DbusTestWatchdog * watchdog;
11 guint watchdog_source;
12@@ -111,6 +112,7 @@
13 self->priv->dbus_configfile = g_strdup(DEFAULT_SESSION_CONF);
14
15 self->priv->first_time = TRUE;
16+ self->priv->keep_env = FALSE;
17
18 self->priv->watchdog = g_object_new(DBUS_TEST_TYPE_WATCHDOG, NULL);
19 self->priv->watchdog_source = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT,
20@@ -413,7 +415,7 @@
21 gchar * dbus_startup[] = {service->priv->dbus_daemon, "--config-file", service->priv->dbus_configfile, "--print-address", NULL};
22 g_spawn_async_with_pipes(g_get_current_dir(),
23 dbus_startup, /* argv */
24- blank, /* envp */
25+ service->priv->keep_env ? NULL : blank, /* envp */
26 G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, /* flags */
27 (GSpawnChildSetupFunc) dbus_child_setup, /* child setup func */
28 NULL, /* child setup data */
29@@ -613,6 +615,13 @@
30 }
31
32 void
33+dbus_test_service_set_keep_environment (DbusTestService * service, gboolean keep_env)
34+{
35+ g_return_if_fail(DBUS_TEST_IS_SERVICE(service));
36+ service->priv->keep_env = keep_env;
37+}
38+
39+void
40 dbus_test_service_stop (DbusTestService * service)
41 {
42 g_return_if_fail(DBUS_TEST_IS_SERVICE(service));
43
44=== modified file 'libdbustest/service.h'
45--- libdbustest/service.h 2012-04-22 18:22:22 +0000
46+++ libdbustest/service.h 2013-07-15 13:35:30 +0000
47@@ -68,6 +68,7 @@
48
49 void dbus_test_service_set_daemon (DbusTestService * service, const gchar * daemon);
50 void dbus_test_service_set_conf_file (DbusTestService * service, const gchar * conffile);
51+void dbus_test_service_set_keep_environment (DbusTestService * service, gboolean keep_env);
52
53 G_END_DECLS
54
55
56=== modified file 'src/dbus-test-runner.c'
57--- src/dbus-test-runner.c 2013-02-21 17:33:04 +0000
58+++ src/dbus-test-runner.c 2013-07-15 13:35:30 +0000
59@@ -24,6 +24,7 @@
60 #include <libdbustest/dbus-test.h>
61
62 static gint max_wait = 30;
63+static gboolean keep_env = FALSE;
64 static DbusTestProcess * last_task = NULL;
65 static DbusTestService * service = NULL;
66 static gboolean timeout = FALSE;
67@@ -161,6 +162,7 @@
68 {"bustle-monitor", 0, 0, G_OPTION_ARG_FILENAME, &bustle_cmd, "Path to the Bustle DBus Monitor to use. Defaults to 'bustle-dbus-monitor'.", "executable"},
69 {"bustle-data", 'b', 0, G_OPTION_ARG_FILENAME, &bustle_datafile, "A file to write out data from the bustle logger to.", "data_file"},
70 {"max-wait", 'm', 0, G_OPTION_ARG_INT, &max_wait, "The maximum amount of time the test runner will wait for the test to complete. Default is 30 seconds.", "seconds"},
71+ {"keep-env", 0, 0, G_OPTION_ARG_NONE, &keep_env, "Whether to propagate the execution environment to the dbus-server and all the services activated by it. By default the environment is cleared.", NULL },
72 { NULL, 0, 0, 0, NULL, NULL, NULL }
73 };
74
75@@ -225,6 +227,8 @@
76 g_timeout_add_seconds(max_wait, max_wait_hit, NULL);
77 }
78
79+ dbus_test_service_set_keep_environment(service, keep_env);
80+
81 /* These should all be in the service now */
82 if (last_task != NULL) {
83 g_object_unref(last_task);

Subscribers

People subscribed via source and target branches