dbus/test/Makefile.am
John (J5) Palmieri 1a163e765c * configure.in: Add test/name-test/Makefile to the generated
Makefile list

	* dbus/dbus-shared.h (#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT):
	New flag which replaces DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT
	(#define DBUS_NAME_FLAG_DO_NOT_QUEUE): New flag for specifying
	not to queue an ower if it can't be the primary owner

	* bus/bus.h: Add new internal BusOwner struct

	* bus/driver.c (bus_driver_handle_hello): Send flags (0 for default)
	to bus_registry_ensure and don't set the prohibit_replacement flag
	since they are now set per BusOwner and not per name.
	(bus_driver_handle_list_queued_owners): bus method (ListQueuedOwners)
	that returns the list of connections in a name's connection queue

	* bus/services.c (struct BusService): remove prohibit_replacement field
	(struct BusOwner): new struct for keeping track of queued connections
	and their associated flags for the queue
	(struct BusRegistry): add a BusOwner memory pool
	(bus_registry_new): initialize the BusOwner memory pool
	(bus_registry_unref): free the BusOwner memory pool
	(_bus_service_find_owner_link): new internal method for
	searching the queue for a specific connection
	(bus_owner_set_flags): new method for adding setting the flags on a
	bus owner
	(bus_owner_new): new method that creates a BusOwner object from the
	pool and sets its flags
	(bus_owner_ref, bus_owner_unref): ref counting for BusOwner objects
	(bus_registry_ensure): Add the flags parameter
	(bus_registry_acquire_service): Switch from using raw connections to
	using the BusOwner struct
	Add new state machine for dealing with the new set of flags
	(bus_registry_set_service_context_table, struct OwnershipCancelData,
	cancel_ownership, free_ownership_cancel_data,
	add_cancel_ownership_to_transaction, struct OwnershipRestoreData,
	restore_ownership, free_ownership_restore_data,
	add_restore_ownership_to_transaction): Switch to using BusOwner
	instead of raw connections
	(bus_service_add_owner): Add flags parameter
	Switch to using BusOwner instead of raw connections
	Add state machine for dealing with the new set of flags
	(bus_service_swap_owner): Swaps the first and second owners in the
	queue.  Used to make sure proper signals are sent when a service looses
	or gains primary ownership.  We never insert an owner at the top of the
	queue.  Instead we insert it in the second position and then swap.
	(bus_service_remove_owner): Remove the owner from the queue sending
	out the NameLost and NameOwnerChanged signals if the we were the
	primary owner
	(bus_service_get_primary_owners_connection): New method that extracts
	the connection from the primary owner
	(bus_service_get_primary_owner): Returns the BusOwner instead of the
	connection
	(bus_service_get_allow_replacement): Changed from the old
	bus_service_get_prohibit_replacement method.  Checks the flags of the
	primary owner and returns if it can be replaced or not
	(bus_service_set_prohibit_replacement): removed
	(bus_service_has_owner): returns TRUE if and owner with
	the specified connection exists in the queue

	* dbus/dbus-bus.c (dbus_bus_connection_get_unique_name): New helper
	method that only compiles if tests are enabled.  Allows us to get the
	unique name of a connection so we can check it against the queue when
	doing regression tests

	* bus/activation.c (bus_activation_send_pending_auto_activate),
	bus/dispatch.c (bus_dispatch),
	bus/driver.c (bus_driver_handle_get_service_owner,
	bus_driver_handle_get_connection_unix_user,
	bus_driver_handle_get_connection_unix_process_id,
	bus_driver_handle_get_connection_selinux_security_context),
	bus/signals.c (connection_is_primary_owner):
	use bus_service_get_primary_owners_connection instead of
	bus_service_get_primary_owner

	* dbus/dbus-sysdeps.c (_dbus_connect_unix_socket,
	_dbus_listen_unix_socket): Calculate the length of the socket
	path and use that instead of using a fixed length which was
	causing socket names to contain many trailing Nul bytes.

	* dbus/dbus-glib-lowlevel.h, glib/dbus-gobject.c
	(dbus_g_method_get_sender): New method for extracting the sender
	from a DBusGMethodInvocation
	(dbus_g_method_return_get_reply): changed name to
	dbus_g_method_get_reply
	(dbus_g_method_return_send_reply): changed name to
	dbus_g_method_send reply

	* doc/dbus-specification.xml: New docs that describe how the new
	queueing system works and talks about the changes to the how
	we specify socket names

	* glib/examples/example-service.c,
	glib/examples/example-signal-emitter.c,
	glib/examples/statemachine/statemachine-server.c:
	Changed the RequestName flags to the new system

	* test/name-test/ (test-names.c, run-test.sh, Makefile.am): New
	regression test suite for testing various states of the new
	queueing system
2005-11-22 20:37:00 +00:00

155 lines
4.1 KiB
Makefile

if HAVE_GLIB
GLIB_SUBDIR=glib
endif
if HAVE_PYTHON
PYTHON_SUBDIR=python
endif
if HAVE_QTESTLIB
QT_SUBDIR=qt
endif
SUBDIRS=name-test $(GLIB_SUBDIR) $(PYTHON_SUBDIR) $(QT_SUBDIR)
DIST_SUBDIRS=glib python qt name-test
INCLUDES=-I$(top_srcdir) $(DBUS_TEST_CFLAGS)
if DBUS_BUILD_TESTS
## break-loader removed for now
TEST_BINARIES=test-service test-names test-shell-service shell-test spawn-test test-segfault test-exit test-sleep-forever
#enable stand alone make check test
TESTS=shell-test
else
TEST_BINARIES=
TESTS=
endif
if DBUS_GCOV_ENABLED
GCOV_BINARIES=decode-gcov
else
GCOV_BINARIES=
endif
noinst_PROGRAMS= $(TEST_BINARIES) $(GCOV_BINARIES)
test_service_SOURCES= \
test-service.c \
test-utils.c \
test-utils.h
test_names_SOURCES= \
test-names.c \
test-utils.c \
test-utils.h
##break_loader_SOURCES= \
## break-loader.c
test_shell_service_SOURCES = \
test-shell-service.c \
test-utils.c \
test-utils.h
shell_test_SOURCES= \
shell-test.c
spawn_test_SOURCES= \
spawn-test.c
test_exit_SOURCES = \
test-exit.c
test_segfault_SOURCES = \
test-segfault.c
test_sleep_forever_SOURCES = \
test-sleep-forever.c
decode_gcov_SOURCES= \
decode-gcov.c
TEST_LIBS=$(DBUS_TEST_LIBS) $(top_builddir)/dbus/libdbus-convenience.la
test_service_LDADD=$(TEST_LIBS)
test_names_LDADD=$(TEST_LIBS)
## break_loader_LDADD= $(TEST_LIBS)
test_shell_service_LDADD=$(TEST_LIBS)
shell_test_LDADD=$(TEST_LIBS)
spawn_test_LDADD=$(TEST_LIBS)
decode_gcov_LDADD=$(TEST_LIBS)
EXTRA_DIST=
## keep these in creation order, i.e. uppermost dirs first
TESTDIRS= \
data \
data/valid-messages \
data/invalid-messages \
data/incomplete-messages \
data/auth \
data/sha-1 \
data/valid-config-files \
data/valid-config-files/basic.d \
data/valid-config-files/system.d \
data/valid-service-files \
data/invalid-config-files \
data/equiv-config-files \
data/equiv-config-files/basic \
data/equiv-config-files/basic/basic.d \
data/equiv-config-files/entities \
data/equiv-config-files/entities/basic.d
FIND_TESTS=find -name "*.message" -o -name "*.message-raw" -o -name "*.auth-script" -o -name "*.sha1" -o -name "*.txt" -o -name "*.conf" -o -name "*.service"
dist-hook:
for D in $(TESTDIRS); do \
test -d $(distdir)/$$D || mkdir $(distdir)/$$D || exit 1 ; \
done ; \
FILES=`(cd $(srcdir) && $(FIND_TESTS) -o -name "*.in" -a -not -name Makefile.in)` ; \
for F in $$FILES; do \
echo '-- Disting file '$$F ; \
cp -f $(srcdir)/$$F $(distdir)/$$F || exit 1 ; \
done
## copy tests to builddir so that generated tests and static tests
## are all in one place.
all-local:
for D in $(TESTDIRS); do \
test -d $(top_builddir)/test/$$D || mkdir $(top_builddir)/test/$$D || exit 1 ; \
done ; \
if ! (test $(srcdir) = . || test $(srcdir) -ef .) ; then \
FILES=`(cd $(srcdir) && $(FIND_TESTS))` ; \
for F in $$FILES; do \
SRC=$(srcdir)/$$F ; \
DEST=$(top_builddir)/test/$$F ; \
echo '-- Copying test file '$$F ; \
cp $$SRC $$DEST || exit 1 ; \
chmod u+w $$DEST || exit 1 ; \
done ; \
else \
echo '-- No need to copy test data as srcdir = builddir' ; \
fi ; \
echo '-- Copying' $(top_builddir)/bus/*.conf 'to test directory' ; \
cp $(top_builddir)/bus/*.conf $(top_builddir)/test/data/valid-config-files || exit 1 ; \
chmod u+w $(top_builddir)/test/data/valid-config-files/*.conf || exit 1
## this doesn't clean generated test data files when srcdir=builddir
clean-local:
if test $(srcdir) != . ; then \
FILES=`(cd $(top_builddir)/test && $(FIND_TESTS))` ; \
for F in $$FILES; do \
DEST=$(top_builddir)/test/$$F ; \
echo '-- Deleting test file '$$F ; \
rm $$DEST || exit 1 ; \
done ; \
REVERSEDIRS= ; \
for D in $(TESTDIRS); do \
REVERSEDIRS="$$D $$REVERSEDIRS" ; \
done ; \
for D in $$REVERSEDIRS; do \
rmdir $(top_builddir)/test/$$D || exit 1 ; \
done ; \
fi