2003-03-13 06:18:06 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu" -*- */
|
|
|
|
|
/* test.h unit test routines
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2003 Red Hat, Inc.
|
|
|
|
|
*
|
2004-08-10 03:07:01 +00:00
|
|
|
* Licensed under the Academic Free License version 2.1
|
2003-03-13 06:18:06 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 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, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef BUS_TEST_H
|
|
|
|
|
#define BUS_TEST_H
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#ifdef DBUS_BUILD_TESTS
|
|
|
|
|
|
|
|
|
|
#include <dbus/dbus.h>
|
|
|
|
|
#include <dbus/dbus-string.h>
|
2003-03-16 Havoc Pennington <hp@pobox.com>
Oops - test code was only testing failure of around 30 of the
mallocs in the test path, but it turns out there are 500+
mallocs. I believe this was due to misguided linking setup such
that there was one copy of dbus_malloc etc. in the daemon and one
in the shared lib, and only daemon mallocs were tested. In any
case, the test case now tests all 500+ mallocs, and doesn't pass
yet, though there are lots of fixes in this patch.
* dbus/dbus-connection.c (dbus_connection_dispatch_message): fix
this so that it doesn't need to allocate memory, since it
has no way of indicating failure due to OOM (and would be
annoying if it did).
* dbus/dbus-list.c (_dbus_list_pop_first_link): new function
* bus/Makefile.am: rearrange to create two self-contained
libraries, to avoid having libraries with overlapping symbols.
that was resulting in weirdness, e.g. I'm pretty sure there
were two copies of global static variables.
* dbus/dbus-internals.c: move the malloc debug stuff to
dbus-memory.c
* dbus/dbus-list.c (free_link): free list mempool if it becomes
empty.
* dbus/dbus-memory.c (_dbus_disable_mem_pools): new function
* dbus/dbus-address.c (dbus_parse_address): free list nodes
on failure.
* bus/dispatch.c (bus_dispatch_add_connection): free
message_handler_slot when no longer using it, so
memory leak checkers are happy for the test suite.
* dbus/dbus-server-debug-pipe.c (debug_finalize): free server name
* bus/bus.c (new_connection_callback): disconnect in here if
bus_connections_setup_connection fails.
* bus/connection.c (bus_connections_unref): fix to free the
connections
(bus_connections_setup_connection): if this fails, don't
disconnect the connection, just be sure there are no side
effects.
* dbus/dbus-string.c (undo_alignment): unbreak this
* dbus/dbus-auth.c (_dbus_auth_unref): free some stuff we were
leaking
(_dbus_auth_new): fix the order in which we free strings
on OOM failure
* bus/connection.c (bus_connection_disconnected): fix to
not send ServiceDeleted multiple times in case of memory
allocation failure
* dbus/dbus-bus.c (dbus_bus_get_base_service): new function to
get the base service name
(dbus_bus_register_client): don't return base service name,
instead store it on the DBusConnection and have an accessor
function for it.
(dbus_bus_register_client): rename dbus_bus_register()
* bus/dispatch.c (check_hello_message): verify that other
connections on the bus also got the correct results, not
just the one sending hello
2003-03-16 08:08:21 +00:00
|
|
|
#include "connection.h"
|
2003-03-13 06:18:06 +00:00
|
|
|
|
2003-04-04 00:39:22 +00:00
|
|
|
dbus_bool_t bus_dispatch_test (const DBusString *test_data_dir);
|
2003-04-14 23:52:40 +00:00
|
|
|
dbus_bool_t bus_dispatch_sha1_test (const DBusString *test_data_dir);
|
2003-04-04 00:39:22 +00:00
|
|
|
dbus_bool_t bus_policy_test (const DBusString *test_data_dir);
|
|
|
|
|
dbus_bool_t bus_config_parser_test (const DBusString *test_data_dir);
|
2003-09-21 19:53:56 +00:00
|
|
|
dbus_bool_t bus_signals_test (const DBusString *test_data_dir);
|
2003-10-11 06:20:28 +00:00
|
|
|
dbus_bool_t bus_expire_list_test (const DBusString *test_data_dir);
|
2004-03-12 14:07:16 +00:00
|
|
|
dbus_bool_t bus_activation_service_reload_test (const DBusString *test_data_dir);
|
2003-04-04 00:39:22 +00:00
|
|
|
dbus_bool_t bus_setup_debug_client (DBusConnection *connection);
|
|
|
|
|
void bus_test_clients_foreach (BusConnectionForeachFunction function,
|
|
|
|
|
void *data);
|
|
|
|
|
dbus_bool_t bus_test_client_listed (DBusConnection *connection);
|
2003-04-07 23:28:16 +00:00
|
|
|
void bus_test_run_bus_loop (BusContext *context,
|
|
|
|
|
dbus_bool_t block);
|
|
|
|
|
void bus_test_run_clients_loop (dbus_bool_t block);
|
2003-04-04 00:39:22 +00:00
|
|
|
void bus_test_run_everything (BusContext *context);
|
|
|
|
|
BusContext* bus_context_new_test (const DBusString *test_data_dir,
|
|
|
|
|
const char *filename);
|
|
|
|
|
|
2003-03-31 08:19:50 +00:00
|
|
|
|
2004-03-12 14:07:16 +00:00
|
|
|
|
2003-03-13 06:18:06 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* BUS_TEST_H */
|