diff options
Diffstat (limited to 'dbus/dbus-userdb-util.c')
-rw-r--r-- | dbus/dbus-userdb-util.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/dbus/dbus-userdb-util.c b/dbus/dbus-userdb-util.c index 7bbae0ef..a8608fa6 100644 --- a/dbus/dbus-userdb-util.c +++ b/dbus/dbus-userdb-util.c @@ -399,56 +399,3 @@ _dbus_groups_from_uid (dbus_uid_t uid, return TRUE; } /** @} */ - -#ifdef DBUS_ENABLE_EMBEDDED_TESTS -#include <stdio.h> - -/** - * Unit test for dbus-userdb.c. - * - * @returns #TRUE on success. - */ -dbus_bool_t -_dbus_userdb_test (const char *test_data_dir) -{ - const DBusString *username; - const DBusString *homedir; - dbus_uid_t uid; - unsigned long *group_ids; - int n_group_ids, i; - DBusError error; - - if (!_dbus_username_from_current_process (&username)) - _dbus_test_fatal ("didn't get username"); - - if (!_dbus_homedir_from_current_process (&homedir)) - _dbus_test_fatal ("didn't get homedir"); - - if (!_dbus_get_user_id (username, &uid)) - _dbus_test_fatal ("didn't get uid"); - - if (!_dbus_groups_from_uid (uid, &group_ids, &n_group_ids)) - _dbus_test_fatal ("didn't get groups"); - - _dbus_test_diag (" Current user: %s homedir: %s gids:", - _dbus_string_get_const_data (username), - _dbus_string_get_const_data (homedir)); - - for (i=0; i<n_group_ids; i++) - _dbus_test_diag ("- %ld", group_ids[i]); - - dbus_error_init (&error); - _dbus_test_diag ("Is Console user: %i", - _dbus_is_console_user (uid, &error)); - _dbus_test_diag ("Invocation was OK: %s", error.message ? error.message : "yes"); - dbus_error_free (&error); - _dbus_test_diag ("Is Console user 4711: %i", - _dbus_is_console_user (4711, &error)); - _dbus_test_diag ("Invocation was OK: %s", error.message ? error.message : "yes"); - dbus_error_free (&error); - - dbus_free (group_ids); - - return TRUE; -} -#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ |