Files
RedBear-OS/local/recipes/libs/glib/source/gio/tests/socket-address.c
T
vasilito cee25393d8 fix: boot process improvements — dependency cycle, INIT_NOTIFY, probing loop, and log spam fixes
- Fix P15-8-init-cycle-detection.patch: replace visiting+error with seen+silent-skip
  to eliminate 11 false-positive 'dependency cycle detected' errors on shared deps
- Fix P0-daemon-fix-init-notify-unwrap.patch: remove eprintln! for missing
  INIT_NOTIFY (expected for oneshot_async services, ~7 daemons affected)
- Fix driver-manager hotplug loop: add PERMANENTLY_SKIPPED static set shared
  between hotplug handler and DriverConfig::probe() to stop infinite re-probing
  of Fatal/NotSupported/deferred-exhausted device+driver pairs (e.g. ided)
- Fix driver-manager log_timeline: suppress repeated EPIPE/ENOENT errors with
  AtomicI32 dedup and AtomicBool one-shot guards for boot timeline JSON
- Add driver-manager SIGTERM handler, ACPI bus registration, --status mode,
  driver reap loop, graceful shutdown, and reduced deferred retries (30→3)
2026-05-17 12:34:02 +03:00

120 lines
4.4 KiB
C

#include <gio/gunixsocketaddress.h>
static void
test_unix_socket_address_construct (void)
{
GUnixSocketAddress *a;
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS, NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_PATH);
g_object_unref (a);
/* Try passing some default values for the arguments explicitly and
* make sure it makes no difference.
*/
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS, "address-type", G_UNIX_SOCKET_ADDRESS_PATH, NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_PATH);
g_object_unref (a);
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS, "abstract", FALSE, NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_PATH);
g_object_unref (a);
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
"abstract", FALSE,
"address-type", G_UNIX_SOCKET_ADDRESS_PATH,
NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_PATH);
g_object_unref (a);
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
"address-type", G_UNIX_SOCKET_ADDRESS_PATH,
"abstract", FALSE,
NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_PATH);
g_object_unref (a);
/* Try explicitly setting abstract to TRUE */
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
"abstract", TRUE,
NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED);
g_object_unref (a);
/* Try explicitly setting a different kind of address */
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
"address-type", G_UNIX_SOCKET_ADDRESS_ANONYMOUS,
NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_ANONYMOUS);
g_object_unref (a);
/* Now try explicitly setting a different type of address after
* setting abstract to FALSE.
*/
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
"abstract", FALSE,
"address-type", G_UNIX_SOCKET_ADDRESS_ANONYMOUS,
NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_ANONYMOUS);
g_object_unref (a);
/* And the other way around */
a = g_object_new (G_TYPE_UNIX_SOCKET_ADDRESS,
"address-type", G_UNIX_SOCKET_ADDRESS_ANONYMOUS,
"abstract", FALSE,
NULL);
g_assert_cmpint (g_unix_socket_address_get_address_type (a), ==, G_UNIX_SOCKET_ADDRESS_ANONYMOUS);
g_object_unref (a);
}
static void
test_unix_socket_address_to_string (void)
{
GSocketAddress *addr = NULL;
gchar *str = NULL;
/* ADDRESS_PATH. */
addr = g_unix_socket_address_new_with_type ("/some/path", -1,
G_UNIX_SOCKET_ADDRESS_PATH);
str = g_socket_connectable_to_string (G_SOCKET_CONNECTABLE (addr));
g_assert_cmpstr (str, ==, "/some/path");
g_free (str);
g_object_unref (addr);
/* ADDRESS_ANONYMOUS. */
addr = g_unix_socket_address_new_with_type ("", 0,
G_UNIX_SOCKET_ADDRESS_ANONYMOUS);
str = g_socket_connectable_to_string (G_SOCKET_CONNECTABLE (addr));
g_assert_cmpstr (str, ==, "anonymous");
g_free (str);
g_object_unref (addr);
/* ADDRESS_ABSTRACT. */
addr = g_unix_socket_address_new_with_type ("abstract-path\0", 17,
G_UNIX_SOCKET_ADDRESS_ABSTRACT);
str = g_socket_connectable_to_string (G_SOCKET_CONNECTABLE (addr));
g_assert_cmpstr (str, ==, "abstract-path\\x00\\xe2\\x9c\\x8b");
g_free (str);
g_object_unref (addr);
/* ADDRESS_ABSTRACT_PADDED. */
addr = g_unix_socket_address_new_with_type ("abstract-path\0", 17,
G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED);
str = g_socket_connectable_to_string (G_SOCKET_CONNECTABLE (addr));
g_assert_cmpstr (str, ==, "abstract-path\\x00\\xe2\\x9c\\x8b");
g_free (str);
g_object_unref (addr);
}
int
main (int argc,
char **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/socket/address/unix/construct", test_unix_socket_address_construct);
g_test_add_func ("/socket/address/unix/to-string", test_unix_socket_address_to_string);
return g_test_run ();
}