Lines Matching defs:mock

54 mock_server_cleanup(struct mock_server *mock)
60 dbus_connection_close(mock->client);
61 dbus_connection_unref(mock->client);
64 verify_eq (write(mock->sync_fds[0], "X", 1), 1);
66 /* Wait for the server child, it always returns mock */
67 verify_eq (waitpid(mock->pid, &child_status, 0), mock->pid);
70 file = strchr(mock->dbus_address, '/');
74 verify_eq (rmdir(mock->temp_dir), 0);
83 struct mock_server *mock = data;
85 verify_eq (mock->init_fn(conn, mock->init_pvt_data), EOK);
88 verify_eq (write(mock->sync_fds[1], "X", 1), 1);
106 struct mock_server *mock = data;
115 verify_eq (sbus_new_server(ctx, loop, mock->dbus_address, geteuid(), getegid(),
116 false, &server, on_accept_connection, mock), EOK);
118 tevent_add_fd(loop, ctx, mock->sync_fds[1], TEVENT_FD_READ,
122 verify_eq (write(mock->sync_fds[1], "X", 1), 1);
140 struct mock_server *mock;
143 mock = talloc_zero(mem_ctx, struct mock_server);
144 talloc_set_destructor(mock, mock_server_cleanup);
145 mock->init_fn = init_fn;
146 mock->init_pvt_data = init_pvt_data;
148 mock->temp_dir = mkdtemp(talloc_strdup(mock, "/tmp/sssd-dbus-tests.XXXXXX"));
149 verify_neq (mock->temp_dir, NULL);
150 mock->dbus_address = talloc_asprintf(mock, "unix:path=%s/sbus", mock->temp_dir);
151 verify_neq (mock->dbus_address, NULL);
154 verify_eq (socketpair(PF_LOCAL, SOCK_STREAM, 0, mock->sync_fds), 0);
157 mock->pid = fork();
158 if (mock->pid == 0) {
159 mock_server_child(mock);
163 verify_neq (mock->pid, -1);
166 verify_eq (read(mock->sync_fds[0], &dummy, 1), 1);
169 mock->client = dbus_connection_open_private(mock->dbus_address, NULL);
170 verify_neq (mock->client, NULL);
173 verify_eq (read(mock->sync_fds[0], &dummy, 1), 1);
175 return mock->client;