mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-11-04 01:58:54 +01:00 
			
		
		
		
	tests: skip tests that requires dbus-daemon when its missing
dbus may not be built yet during bootstrap, because it needs glib to build. Ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
This commit is contained in:
		
				
					committed by
					
						
						Philip Withnall
					
				
			
			
				
	
			
			
			
						parent
						
							6a262b0c03
						
					
				
				
					commit
					7322a925e2
				
			@@ -49,6 +49,19 @@ test_launch_for_app_info (GAppInfo *appinfo)
 | 
			
		||||
  g_free (uri);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
skip_missing_dbus_daemon (void)
 | 
			
		||||
{
 | 
			
		||||
  gchar *path = g_find_program_in_path ("dbus-daemon");
 | 
			
		||||
  if (path == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_test_skip ("dbus-daemon is required to run this test");
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
  g_free (path);
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
test_launch (void)
 | 
			
		||||
{
 | 
			
		||||
@@ -56,6 +69,9 @@ test_launch (void)
 | 
			
		||||
  GAppInfo *appinfo;
 | 
			
		||||
  const gchar *path;
 | 
			
		||||
 | 
			
		||||
  if (skip_missing_dbus_daemon ())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
 | 
			
		||||
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
 | 
			
		||||
  g_test_dbus_up (bus);
 | 
			
		||||
@@ -96,6 +112,9 @@ test_launch_no_app_id (void)
 | 
			
		||||
  gchar *exec_line_variants[2];
 | 
			
		||||
  gsize i;
 | 
			
		||||
 | 
			
		||||
  if (skip_missing_dbus_daemon ())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  exec_line_variants[0] = g_strdup_printf (
 | 
			
		||||
      "Exec=%s/appinfo-test --option %%U %%i --name %%c --filename %%k %%m %%%%",
 | 
			
		||||
      g_test_get_dir (G_TEST_BUILT));
 | 
			
		||||
@@ -356,6 +375,9 @@ test_launch_context_signals (void)
 | 
			
		||||
  gboolean success;
 | 
			
		||||
  gchar *cmdline;
 | 
			
		||||
 | 
			
		||||
  if (skip_missing_dbus_daemon ())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
 | 
			
		||||
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
 | 
			
		||||
  g_test_dbus_up (bus);
 | 
			
		||||
 
 | 
			
		||||
@@ -593,6 +593,19 @@ wait_for_file (const gchar *want_this,
 | 
			
		||||
  unlink (or_this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static gboolean
 | 
			
		||||
skip_missing_dbus_daemon (void)
 | 
			
		||||
{
 | 
			
		||||
  gchar *path = g_find_program_in_path ("dbus-daemon");
 | 
			
		||||
  if (path == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      g_test_skip ("dbus-daemon is required to run this test");
 | 
			
		||||
      return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
  g_free (path);
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
test_actions (void)
 | 
			
		||||
{
 | 
			
		||||
@@ -606,6 +619,9 @@ test_actions (void)
 | 
			
		||||
  gchar *tweak_path;
 | 
			
		||||
  gchar *twiddle_path;
 | 
			
		||||
 | 
			
		||||
  if (skip_missing_dbus_daemon ())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  /* Set up a test session bus to keep D-Bus traffic off the real session bus. */
 | 
			
		||||
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
 | 
			
		||||
  g_test_dbus_up (bus);
 | 
			
		||||
@@ -1833,6 +1849,9 @@ test_launch_fail_dbus (void)
 | 
			
		||||
  GAsyncResult *result = NULL;
 | 
			
		||||
  GError *error = NULL;
 | 
			
		||||
 | 
			
		||||
  if (skip_missing_dbus_daemon ())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  /* Set up a test session bus to ensure that launching the app happens using
 | 
			
		||||
   * D-Bus rather than spawning. */
 | 
			
		||||
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user