/*
SSSD
Common utilities for dbus based tests.
Authors:
Stef Walter <stefw@redhat.com>
Copyright (C) Red Hat, Inc 2014
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdio.h>
struct mock_server {
char *temp_dir;
char *dbus_address;
/* Used for synchronization */
/* Only used during init */
void *init_pvt_data;
};
/*
* If you think we're going to do full error propagation during tests ...
* you're going to have a bad time (reading this code)
*/
#define verify_eq(x, y) \
#define verify_neq(x, y) \
static int
{
int child_status;
const char *file;
/* Tell the server thread to quit */
/* Wait for the server child, it always returns mock */
verify_eq (child_status, 0);
}
return EOK;
}
static int
void *data)
{
/* Synchronization point: test_dbus_setup_mock() should return */
return EOK;
}
static void
void *data)
{
*stop_server = true;
}
static void
{
bool stop_server = false;
/* Synchronization point: test_dbus_setup_mock() should connect */
/* Do the loop */
while(!stop_server) {
}
/* TODO: sbus doesn't support cleanup of a server */
}
struct DBusConnection *
struct tevent_context *loop,
void *init_pvt_data)
{
char dummy;
/* We use an fd pair as a synchronization device, integrates with tevent well */
/* Run the dbus server in a child process */
_exit(0);
}
/* Synchronization point: wait for sync point in mock_server_child */
/* Open a shared D-BUS connection to the address */
/* Synchronization point: wait for sync point in on_accept_connection */
}
{
return reply;
}