Commit a89e4501 authored by Simon McVittie's avatar Simon McVittie

Merge branch 'dbus-1.10'

parents b0286eed 008264ff
......@@ -684,6 +684,13 @@ bus_config_parser_trivial_test (const DBusString *test_data_dir)
if (!process_test_valid_subdir (test_data_dir, "valid-config-files", VALID))
goto finish;
#ifndef DBUS_WIN
/* We already test default_session_servicedirs and default_system_servicedirs
* in bus_config_parser_test() */
if (!process_test_valid_subdir (test_data_dir, "valid-config-files-system", VALID))
goto finish;
#endif
/* we don't process all the invalid files, as the trivial parser can't hope
* to validate them all for all different syntaxes. We just check one broken
* file to see if junk is received */
......@@ -693,14 +700,16 @@ bus_config_parser_trivial_test (const DBusString *test_data_dir)
goto finish;
_dbus_string_free (&full_path);
#ifndef DBUS_WIN
/* just test if the check_file_valid works okay and we got sane values */
if (!make_full_path (test_data_dir, "valid-config-files", "system.conf", &full_path))
if (!make_full_path (test_data_dir, "valid-config-files-system", "system.conf", &full_path))
goto finish;
if (!check_file_valid (&full_path, VALID))
goto finish;
/* check to see if we got the correct values from the parser */
if (!check_return_values (&full_path))
goto finish;
#endif
/* woot! */
retval = TRUE;
......
......@@ -3405,30 +3405,30 @@ test_default_session_servicedirs (void)
DBusList *dirs;
DBusList *link;
DBusString progs;
DBusString install_root_based;
int i;
dbus_bool_t ret = FALSE;
#ifdef DBUS_WIN
const char *common_progs;
DBusString install_root_based;
#endif
/* On Unix we don't actually use these, but it's easier to handle the
* deallocation if we always allocate them, whether needed or not */
if (!_dbus_string_init (&progs) ||
!_dbus_string_init (&install_root_based))
_dbus_assert_not_reached ("OOM allocating strings");
if (!_dbus_string_init (&install_root_based) ||
!_dbus_string_append (&install_root_based, DBUS_DATADIR) ||
#ifdef DBUS_WIN
if (!_dbus_string_append (&install_root_based, DBUS_DATADIR) ||
!_dbus_string_append (&install_root_based, "/dbus-1/services") ||
!_dbus_replace_install_prefix (&install_root_based))
_dbus_assert_not_reached ("OOM getting relocated DBUS_DATADIR");
goto out;
_dbus_assert (_dbus_path_is_absolute (&install_root_based));
test_session_service_dir_matches[0] = _dbus_string_get_const_data (&install_root_based);
test_session_service_dir_matches[0] = _dbus_string_get_const_data (
&install_root_based);
#endif
/* On Unix we don't actually use this variable, but it's easier to handle the
* deallocation if we always allocate it, whether needed or not */
if (!_dbus_string_init (&progs))
_dbus_assert_not_reached ("OOM allocating progs");
#ifndef DBUS_UNIX
common_progs = _dbus_getenv ("CommonProgramFiles");
if (common_progs)
......@@ -3518,10 +3518,8 @@ test_default_session_servicedirs (void)
ret = TRUE;
out:
_dbus_string_free (&progs);
#ifdef DBUS_WIN
_dbus_string_free (&install_root_based);
#endif
_dbus_string_free (&progs);
return ret;
}
......@@ -3681,6 +3679,11 @@ bus_config_parser_test (const DBusString *test_data_dir)
if (!process_test_valid_subdir (test_data_dir, "valid-config-files", VALID))
return FALSE;
#ifndef DBUS_WIN
if (!process_test_valid_subdir (test_data_dir, "valid-config-files-system", VALID))
return FALSE;
#endif
if (!process_test_valid_subdir (test_data_dir, "invalid-config-files", INVALID))
return FALSE;
......
......@@ -122,8 +122,8 @@ set (TESTDIRS
test/data/valid-config-files
test/data/valid-config-files/basic.d
test/data/valid-config-files/session.d
test/data/valid-config-files/system.d
test/data/valid-config-files-system
test/data/valid-config-files-system/system.d
test/data/valid-introspection-files
test/data/valid-messages
test/data/valid-service-files
......@@ -140,13 +140,16 @@ set (TESTDIRS
)
set (CONFIG_VERBOSE 0)
FOREACH(DIR ${TESTDIRS})
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
ENDFOREACH(DIR)
### copy tests to builddir so that generated tests and static tests
### are all in one place.
MESSAGE(STATUS "Copying test files to test directory")
FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.service)
FOREACH(DIR ${TESTDIRS})
FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
FOREACH(FILE ${FILES})
GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
......@@ -164,7 +167,6 @@ MESSAGE(STATUS "Generating test files from templates into test directory")
FOREACH(FILE_TYPE *.conf.in *.service.in)
FOREACH(DIR ${TESTDIRS})
FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
FOREACH(FILE ${FILES})
GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
STRING(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
......@@ -178,19 +180,5 @@ FOREACH(FILE_TYPE *.conf.in *.service.in)
ENDFOREACH(FILE_TYPE)
MESSAGE(STATUS "Copying generated bus config files to test directory")
set (OUTDIR ${CMAKE_BINARY_DIR}/test/data/valid-config-files)
SET(FILES
"${CMAKE_SOURCE_DIR}/../bus/session.conf.in"
"${CMAKE_SOURCE_DIR}/../bus/system.conf.in"
)
FILE(MAKE_DIRECTORY ${OUTDIR})
FOREACH(FILE ${FILES})
GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
STRING(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
SET (TARGET ${OUTDIR}/${FILENAME})
configure_file(${FILE} ${TARGET} @ONLY)
IF (CONFIG_VERBOSE)
MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
ENDIF (CONFIG_VERBOSE)
ENDFOREACH(FILE)
configure_file("${CMAKE_SOURCE_DIR}/../bus/session.conf.in" ${CMAKE_BINARY_DIR}/test/data/valid-config-files/session.conf @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/../bus/system.conf.in" ${CMAKE_BINARY_DIR}/test/data/valid-config-files-system/system.conf @ONLY)
......@@ -25,6 +25,9 @@
#ifdef DBUS_ENABLE_EMBEDDED_TESTS
#include "dbus-auth-script.h"
#include <stdio.h>
#include "dbus-auth.h"
#include "dbus-string.h"
#include "dbus-hash.h"
......@@ -339,7 +342,7 @@ _dbus_auth_script_run (const DBusString *filename)
"UNIX_ONLY"))
{
/* skip this file */
_dbus_warn ("skipping unix only auth script\n");
fprintf (stderr, "skipping unix only auth script\n");
retval = TRUE;
goto out;
}
......@@ -355,7 +358,7 @@ _dbus_auth_script_run (const DBusString *filename)
"WIN_ONLY"))
{
/* skip this file */
_dbus_warn ("skipping windows only auth script\n");
fprintf (stderr, "skipping windows only auth script\n");
retval = TRUE;
goto out;
}
......
......@@ -582,6 +582,7 @@ spawn_program (char* name, char** argv, char** envp)
static DWORD __stdcall
babysitter (void *parameter)
{
int ret = 0;
DBusBabysitter *sitter = (DBusBabysitter *) parameter;
PING();
......@@ -612,17 +613,19 @@ babysitter (void *parameter)
if (sitter->child_handle != NULL)
{
int ret;
DWORD status;
PING();
// wait until process finished
WaitForSingleObject (sitter->child_handle, INFINITE);
PING();
ret = GetExitCodeProcess (sitter->child_handle, &status);
sitter->child_status = status;
sitter->have_child_status = TRUE;
if (ret)
{
sitter->child_status = status;
sitter->have_child_status = TRUE;
}
CloseHandle (sitter->child_handle);
sitter->child_handle = NULL;
......@@ -637,7 +640,7 @@ babysitter (void *parameter)
_dbus_babysitter_unref (sitter);
return 0;
return ret ? 0 : 1;
}
dbus_bool_t
......
......@@ -335,7 +335,8 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args
{
char *s = "";
char buf[1024];
char format[1024];
switch(severity)
{
case DBUS_SYSTEM_LOG_INFO: s = "info"; break;
......@@ -344,8 +345,8 @@ _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args
case DBUS_SYSTEM_LOG_FATAL: s = "fatal"; break;
}
sprintf(buf,"%s%s",s,msg);
vsprintf(buf,buf,args);
snprintf(format, sizeof(format), "%s%s", s ,msg);
vsnprintf(buf, sizeof(buf), format, args);
OutputDebugStringA(buf);
if (severity == DBUS_SYSTEM_LOG_FATAL)
......
......@@ -288,7 +288,7 @@ _dbus_get_peer_pid_from_tcp_handle (int handle)
return 0;
}
_dbus_verbose ("trying to get peers pid");
_dbus_verbose ("trying to get peer's pid\n");
result = get_pid_from_extended_tcp_table (peer_port);
if (result > 0)
......@@ -2932,6 +2932,7 @@ _dbus_daemon_publish_session_bus_address (const char* address, const char *scope
char *shared_addr = NULL;
DBusString shm_name;
DBusString mutex_name;
dbus_uint64_t len;
_dbus_assert (address);
......@@ -2966,7 +2967,7 @@ _dbus_daemon_publish_session_bus_address (const char* address, const char *scope
}
// create shm
dbus_uint64_t len = strlen( address ) + 1;
len = strlen (address) + 1;
hDBusSharedMem = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
len >> 32, len & 0xffffffffu,
......@@ -3114,8 +3115,8 @@ _dbus_get_autolaunch_address (const char *scope, DBusString *address,
if (_dbus_daemon_already_runs(address,&shm_name,scope))
{
_dbus_verbose( "found running dbus daemon at %s\n",
_dbus_string_get_const_data (&shm_name) );
_dbus_verbose( "found running dbus daemon for scope '%s' at %s\n",
scope ? scope : "", _dbus_string_get_const_data (&shm_name) );
retval = TRUE;
goto out;
}
......
......@@ -384,7 +384,7 @@ static_data = \
data/valid-config-files/entities.conf \
data/valid-config-files/listen-unix-runtime.conf \
data/valid-config-files/many-rules.conf \
data/valid-config-files/system.d/test.conf \
data/valid-config-files-system/system.d/test.conf \
data/valid-messages/array-of-array-of-uint32.message \
data/valid-messages/dict-simple.message \
data/valid-messages/dict.message \
......@@ -468,7 +468,7 @@ if DBUS_ENABLE_INSTALLED_TESTS
install -m644 "installable/$${F%.in}" "$(DESTDIR)$(testexecdir)/$${F%.in}"; \
done
ln -nfs $(datadir)/dbus-1/session.conf $(DESTDIR)$(testexecdir)/data/valid-config-files/session.conf
ln -nfs $(datadir)/dbus-1/system.conf $(DESTDIR)$(testexecdir)/data/valid-config-files/system.conf
ln -nfs $(datadir)/dbus-1/system.conf $(DESTDIR)$(testexecdir)/data/valid-config-files-system/system.conf
else
@:
endif
......@@ -486,7 +486,7 @@ clean-local:
imported_data = \
data/valid-config-files/session.conf \
data/valid-config-files/system.conf \
data/valid-config-files-system/system.conf \
$(NULL)
noinst_DATA = $(imported_data)
......@@ -496,10 +496,14 @@ CLEANFILES += \
installable \
$(NULL)
$(imported_data): data/valid-config-files/%.conf: $(top_builddir)/bus/%.conf
data/valid-config-files/session.conf: $(top_builddir)/bus/session.conf
$(AM_V_at)$(MKDIR_P) data/valid-config-files
$(AM_V_GEN)cp $< $@
data/valid-config-files-system/system.conf: $(top_builddir)/bus/system.conf
$(AM_V_at)$(MKDIR_P) data/valid-config-files-system
$(AM_V_GEN)cp $< $@
$(installable_test_meta): %.test: %$(EXEEXT) Makefile
$(AM_V_GEN) ( \
echo '[Test]'; \
......
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<user>mybususer</user>
<listen>unix:path=/foo/bar</listen>
<listen>tcp:port=1234</listen>
<includedir>basic.d</includedir>
<standard_session_servicedirs />
<servicedir>/usr/share/foo</servicedir>
<include ignore_missing="yes">nonexistent.conf</include>
<policy context="default">
<allow user="*"/>
<deny send_interface="org.freedesktop.System" send_member="Reboot"/>
<deny receive_interface="org.freedesktop.System" receive_member="Reboot"/>
<deny send_path="/foo/bar/SystemObjectThing" send_member="Reboot"/>
<deny own="org.freedesktop.System"/>
<deny own_prefix="org.freedesktop.ManySystems"/>
<deny send_destination="org.freedesktop.System"/>
<deny receive_sender="org.freedesktop.System"/>
<deny user="root"/>
<deny group="bin"/>
<allow send_type="error"/>
<allow send_type="method_call"/>
<allow send_type="method_return"/>
<allow send_type="signal"/>
<deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo"/>
<deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo" send_type="method_call"/>
</policy>
<policy context="mandatory">
<allow user="*"/>
<deny send_interface="org.freedesktop.System" send_member="Reboot"/>
<deny receive_interface="org.freedesktop.System" receive_member="Reboot"/>
<deny send_path="/foo/bar/SystemObjectThing" send_member="Reboot"/>
<deny own="org.freedesktop.System"/>
<deny own_prefix="org.freedesktop.ManySystems"/>
<deny send_destination="org.freedesktop.System"/>
<deny receive_sender="org.freedesktop.System"/>
<deny user="root"/>
<deny group="bin"/>
<allow send_type="error"/>
<allow send_type="method_call"/>
<allow send_type="method_return"/>
<allow send_type="signal"/>
<deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo"/>
<deny send_destination="org.freedesktop.Bar" send_interface="org.freedesktop.Foo" send_type="method_call"/>
</policy>
<limit name="max_incoming_bytes">5000</limit>
<limit name="max_outgoing_bytes">5000</limit>
<limit name="max_message_size">300</limit>
<limit name="service_start_timeout">5000</limit>
<limit name="auth_timeout">6000</limit>
<limit name="max_completed_connections">50</limit>
<limit name="max_incomplete_connections">80</limit>
<limit name="max_connections_per_user">64</limit>
<limit name="max_pending_service_starts">64</limit>
<limit name="max_names_per_connection">256</limit>
<limit name="max_match_rules_per_connection">512</limit>
</busconfig>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- The following demonstrates how to punch holes in a default deny-all
policy so that a particular user can own a service, and other
<!-- The following demonstrates how to punch holes in a default deny-all
policy so that a particular user can own a service, and other
connections can get messages from it -->
<!-- Only root can own the FooService service, and
<!-- Only root can own the FooService service, and
this user can only send the one kind of message -->
<policy user="root">
<allow own="org.foo.FooService"/>
<allow send_interface="org.foo.FooBroadcastInterface"/>
</policy>
<!-- Allow any connection to receive the message, but
<!-- Allow any connection to receive the message, but
only if the message is sent by the owner of FooService -->
<policy context="default">
<allow receive_interface="org.foo.FooBroadcastInterface" receive_sender="org.foo.FooService"/>
......
......@@ -2,6 +2,5 @@ debug-allow-all.conf
debug-allow-all-sha1.conf
incoming-limit.conf
session.conf
system.conf
run-with-tmp-session-bus.conf
finite-timeout.conf
......@@ -17,8 +17,6 @@
<deny own_prefix="org.freedesktop.ManySystems"/>
<deny send_destination="org.freedesktop.System"/>
<deny receive_sender="org.freedesktop.System"/>
<deny user="root"/>
<deny group="bin"/>
<allow send_type="error"/>
<allow send_type="method_call"/>
<allow send_type="method_return"/>
......@@ -36,8 +34,6 @@
<deny own_prefix="org.freedesktop.ManySystems"/>
<deny send_destination="org.freedesktop.System"/>
<deny receive_sender="org.freedesktop.System"/>
<deny user="root"/>
<deny group="bin"/>
<allow send_type="error"/>
<allow send_type="method_call"/>
<allow send_type="method_return"/>
......
......@@ -10,4 +10,24 @@
set -e
t="$1"
shift
exec "$t" --tap "$@"
case "$t" in
(*.exe)
# We're running a Windows executable, possibly on a Unix
# platform. Avoid having invalid TAP syntax like "ok 3\r\n"
# where "ok 3\n" was intended.
echo 1 > "$t".exit-status.tmp
(
set +e
"$t" --tap "$@"
echo "$?" > "$t".exit-status.tmp
) | sed -e 's/\r$//'
e="$(cat "$t".exit-status.tmp)"
rm "$t".exit-status.tmp
exit "$e"
;;
(*)
exec "$t" --tap "$@"
;;
esac
......@@ -62,12 +62,15 @@ typedef struct {
DBusMessage *message;
GThread *threads[N_THREADS];
gboolean last_unref;
unsigned n_refs;
unsigned n_threads;
} Fixture;
typedef void *(*RefFunc) (void *);
typedef void (*VoidFunc) (void *);
typedef struct {
const Fixture *f;
void *thing;
RefFunc ref;
VoidFunc ref_void;
......@@ -86,9 +89,10 @@ static gpointer
ref_thread (gpointer data)
{
Thread *thread = data;
int i;
const Fixture *f = thread->f;
unsigned i;
for (i = 0; i < N_REFS; i++)
for (i = 0; i < f->n_refs; i++)
{
if (thread->lock != NULL)
(thread->lock) (thread->mutex);
......@@ -115,9 +119,10 @@ static gpointer
cycle_thread (gpointer data)
{
Thread *thread = data;
int i;
const Fixture *f = thread->f;
unsigned i;
for (i = 0; i < N_REFS; i++)
for (i = 0; i < f->n_refs; i++)
{
if (thread->lock != NULL)
(thread->lock) (thread->mutex);
......@@ -146,9 +151,10 @@ static gpointer
unref_thread (gpointer data)
{
Thread *thread = data;
int i;
const Fixture *f = thread->f;
unsigned i;
for (i = 0; i < N_REFS; i++)
for (i = 0; i < f->n_refs; i++)
{
if (thread->lock != NULL)
(thread->lock) (thread->mutex);
......@@ -174,9 +180,9 @@ last_unref (void *data)
static void
wait_for_all_threads (Fixture *f)
{
int i;
unsigned i;
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
g_thread_join (f->threads[i]);
}
......@@ -200,6 +206,20 @@ setup (Fixture *f,
if (!dbus_threads_init_default ())
g_error ("OOM");
f->n_threads = N_THREADS;
f->n_refs = N_REFS;
// wine sets WINESERVERSOCKET for its child processes automatically
if (g_getenv ("WINESERVERSOCKET") != NULL)
{
/* Our reference-counting is really slow under Wine (it involves
* IPC to wineserver). Do fewer iterations: enough to demonstrate
* that it works, rather than a performance test.
*/
f->n_threads = 10;
f->n_refs = 10;
}
f->loop = _dbus_loop_new ();
g_assert (f->loop != NULL);
......@@ -257,28 +277,32 @@ static void
test_connection (Fixture *f,
gconstpointer data)
{
Thread public_api = { f->connection,
Thread public_api = {
f,
f->connection,
(RefFunc) dbus_connection_ref,
NULL,
(VoidFunc) dbus_connection_unref,
NULL,
NULL,
NULL };
Thread internal_api = { f->connection,
Thread internal_api = {
f,
f->connection,
(RefFunc) _dbus_connection_ref_unlocked,
NULL,
(VoidFunc) _dbus_connection_unref_unlocked,
f->connection,
(VoidFunc) _dbus_connection_lock,
(VoidFunc) _dbus_connection_unlock };
int i;
unsigned i;
/* Use a slot as a pseudo-weakref */
if (!dbus_connection_set_data (f->connection, connection_slot, f,
last_unref))
g_error ("OOM");
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
if ((i % 2) == 0)
f->threads[i] = g_thread_new (NULL, ref_thread, &public_api);
......@@ -290,7 +314,7 @@ test_connection (Fixture *f,
wait_for_all_threads (f);
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
if ((i % 2) == 0)
f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api);
......@@ -302,7 +326,7 @@ test_connection (Fixture *f,
wait_for_all_threads (f);
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
if ((i % 2) == 0)
f->threads[i] = g_thread_new (NULL, unref_thread, &public_api);
......@@ -338,26 +362,30 @@ static void
test_server (Fixture *f,
gconstpointer data)
{
Thread public_api = { f->server,
Thread public_api = {
f,
f->server,
(RefFunc) dbus_server_ref,
NULL,
(VoidFunc) dbus_server_unref,
NULL,
NULL,
NULL };
Thread internal_api = { f->server,
Thread internal_api = {
f,
f->server,
NULL,
(VoidFunc) _dbus_server_ref_unlocked,
(VoidFunc) _dbus_server_unref_unlocked,
f->server,
server_lock,
server_unlock };
int i;
unsigned i;
if (!dbus_server_set_data (f->server, server_slot, f, last_unref))
g_error ("OOM");
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
if ((i % 2) == 0)
f->threads[i] = g_thread_new (NULL, ref_thread, &public_api);
......@@ -369,7 +397,7 @@ test_server (Fixture *f,
wait_for_all_threads (f);
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
if ((i % 2) == 0)
f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api);
......@@ -381,7 +409,7 @@ test_server (Fixture *f,
wait_for_all_threads (f);
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
if ((i % 2) == 0)
f->threads[i] = g_thread_new (NULL, unref_thread, &public_api);
......@@ -407,19 +435,21 @@ test_message (Fixture *f,
{
DBusMessage *message = dbus_message_new_signal ("/foo", "foo.bar.baz",
"Foo");
Thread public_api = { message,
Thread public_api = {
f,
message,
(RefFunc) dbus_message_ref,
NULL,
(VoidFunc) dbus_message_unref,
NULL,
NULL,
NULL };
int i;
unsigned i;
if (!dbus_message_set_data (message, message_slot, f, last_unref))
g_error ("OOM");
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
f->threads[i] = g_thread_new (NULL, ref_thread, &public_api);
g_assert (f->threads[i] != NULL);
......@@ -427,7 +457,7 @@ test_message (Fixture *f,
wait_for_all_threads (f);
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
f->threads[i] = g_thread_new (NULL, cycle_thread, &public_api);
g_assert (f->threads[i] != NULL);
......@@ -435,7 +465,7 @@ test_message (Fixture *f,
wait_for_all_threads (f);
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)
{
f->threads[i] = g_thread_new (NULL, unref_thread, &public_api);
g_assert (f->threads[i] != NULL);
......@@ -453,14 +483,18 @@ static void
test_pending_call (Fixture *f,
gconstpointer data)
{
Thread public_api = { NULL,
Thread public_api = {
f,
NULL,
(RefFunc) dbus_pending_call_ref,
NULL,
(VoidFunc) dbus_pending_call_unref,
NULL,
NULL,
NULL };
Thread internal_api = { NULL,
Thread internal_api = {
f,
NULL,
(RefFunc) _dbus_pending_call_ref_unlocked,
NULL,
(VoidFunc) dbus_pending_call_unref,
......@@ -468,14 +502,16 @@ test_pending_call (Fixture *f,
(VoidFunc) _dbus_connection_lock,
(VoidFunc) _dbus_connection_unlock };
/* This one can't be used to ref, only to cycle or unref. */
Thread unref_and_unlock_api = { NULL,
Thread unref_and_unlock_api = {
f,
NULL,
(RefFunc) _dbus_pending_call_ref_unlocked,
NULL,
(VoidFunc) _dbus_pending_call_unref_and_unlock,
f->connection,
(VoidFunc) _dbus_connection_lock,
NULL };
int i;
unsigned i;
DBusPendingCall *pending_call;
_dbus_connection_lock (f->connection);
......@@ -492,7 +528,7 @@ test_pending_call (Fixture *f,
last_unref))
g_error ("OOM");
for (i = 0; i < N_THREADS; i++)
for (i = 0; i < f->n_threads; i++)