Skip to content

Commit

Permalink
tests: Start dbus-monitor for the portal tests if required
Browse files Browse the repository at this point in the history
Same as in the pytest suite, start dbus-monitor on our test session bus
if XDP_DBUS_MONITOR is set in the environment.
  • Loading branch information
whot committed Nov 6, 2023
1 parent 4c945cc commit 127cfdd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test-portals.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ global_setup (void)
session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
g_assert_no_error (error);

if (g_getenv ("XDP_DBUS_MONITOR"))
{
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
g_subprocess_launcher_setenv (launcher, "DBUS_SESSION_BUS_ADDRESS", g_test_dbus_get_bus_address (dbus), TRUE);
g_subprocess_launcher_take_stdout_fd (launcher, xdup (STDERR_FILENO));
argv[0] = "dbus-monitor";
argv[1] = NULL;
subprocess = g_subprocess_launcher_spawnv (launcher, argv, &error);
g_assert_no_error (error);
g_test_message ("Launched %s with pid %s\n", argv[0],
g_subprocess_get_identifier (subprocess));
test_procs = g_list_append (test_procs, g_steal_pointer (&subprocess));
}

/* start portal backends */
name_appeared = FALSE;
watch = g_bus_watch_name_on_connection (session_bus,
Expand Down

0 comments on commit 127cfdd

Please sign in to comment.