diff options
-rw-r--r-- | cmake/test/CMakeLists.txt | 8 | ||||
-rw-r--r-- | test/Makefile.am | 12 | ||||
-rw-r--r-- | test/bus/dispatch-sha1.c | 59 | ||||
-rw-r--r-- | test/bus/dispatch.c | 59 | ||||
-rw-r--r-- | test/bus/main.c | 2 |
5 files changed, 137 insertions, 3 deletions
diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 71d358d3..02143898 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -97,6 +97,14 @@ if(DBUS_ENABLE_EMBEDDED_TESTS) add_test_executable(test-bus "${SOURCES}" dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) set_target_properties(test-bus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) + set(SOURCES ${TEST_DIR}/bus/dispatch.c) + add_test_executable(test-bus-dispatch "${SOURCES}" dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) + set_target_properties(test-bus-dispatch PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) + + set(SOURCES ${TEST_DIR}/bus/dispatch-sha1.c) + add_test_executable(test-bus-dispatch-sha1 "${SOURCES}" dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) + set_target_properties(test-bus-dispatch-sha1 PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) + if(NOT WIN32) add_test_executable(test-bus-system ${TEST_DIR}/bus/system.c launch-helper-internal) add_test_executable(test-bus-launch-helper-oom ${TEST_DIR}/bus/launch-helper-oom.c launch-helper-internal) diff --git a/test/Makefile.am b/test/Makefile.am index 5d34f2be..475fb214 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -79,7 +79,11 @@ if !DBUS_WINCE uninstallable_test_programs += test-spawn-oom endif -uninstallable_test_programs += test-bus +uninstallable_test_programs += \ + test-bus \ + test-bus-dispatch \ + test-bus-dispatch-sha1 \ + $(NULL) if DBUS_UNIX uninstallable_test_programs += test-bus-launch-helper-oom @@ -168,6 +172,12 @@ test_bus_system_LDADD = $(top_builddir)/bus/liblaunch-helper-internal.la test_bus_SOURCES = bus/main.c test_bus_LDADD = $(top_builddir)/bus/libdbus-daemon-internal.la +test_bus_dispatch_SOURCES = bus/dispatch.c +test_bus_dispatch_LDADD = $(top_builddir)/bus/libdbus-daemon-internal.la + +test_bus_dispatch_sha1_SOURCES = bus/dispatch-sha1.c +test_bus_dispatch_sha1_LDADD = $(top_builddir)/bus/libdbus-daemon-internal.la + EXTRA_DIST += dbus-test-runner testexecdir = $(libexecdir)/installed-tests/dbus diff --git a/test/bus/dispatch-sha1.c b/test/bus/dispatch-sha1.c new file mode 100644 index 00000000..6902942f --- /dev/null +++ b/test/bus/dispatch-sha1.c @@ -0,0 +1,59 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ +/* + * Copyright 2003-2009 Red Hat, Inc. + * Copyright 2011-2018 Collabora Ltd. + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <config.h> + +#include "bus/test.h" + +#include <dbus/dbus-test-tap.h> +#include <dbus/dbus-test-wrappers.h> + +#include "bus/selinux.h" + +#ifndef DBUS_ENABLE_EMBEDDED_TESTS +#error This file is only relevant for the embedded tests +#endif + +static void +test_pre_hook (void) +{ +} + +static void +test_post_hook (void) +{ + if (_dbus_getenv ("DBUS_TEST_SELINUX")) + bus_selinux_shutdown (); +} + +static DBusTestCase test = { "dispatch-sha1", bus_dispatch_sha1_test }; + +int +main (int argc, char **argv) +{ + return _dbus_test_main (argc, argv, 1, &test, + (DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS | + DBUS_TEST_FLAGS_CHECK_FD_LEAKS | + DBUS_TEST_FLAGS_REQUIRE_DATA), + test_pre_hook, test_post_hook); +} diff --git a/test/bus/dispatch.c b/test/bus/dispatch.c new file mode 100644 index 00000000..49fd8025 --- /dev/null +++ b/test/bus/dispatch.c @@ -0,0 +1,59 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ +/* + * Copyright 2003-2009 Red Hat, Inc. + * Copyright 2011-2018 Collabora Ltd. + * + * Licensed under the Academic Free License version 2.1 + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include <config.h> + +#include "bus/test.h" + +#include <dbus/dbus-test-tap.h> +#include <dbus/dbus-test-wrappers.h> + +#include "bus/selinux.h" + +#ifndef DBUS_ENABLE_EMBEDDED_TESTS +#error This file is only relevant for the embedded tests +#endif + +static void +test_pre_hook (void) +{ +} + +static void +test_post_hook (void) +{ + if (_dbus_getenv ("DBUS_TEST_SELINUX")) + bus_selinux_shutdown (); +} + +static DBusTestCase test = { "dispatch", bus_dispatch_test }; + +int +main (int argc, char **argv) +{ + return _dbus_test_main (argc, argv, 1, &test, + (DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS | + DBUS_TEST_FLAGS_CHECK_FD_LEAKS | + DBUS_TEST_FLAGS_REQUIRE_DATA), + test_pre_hook, test_post_hook); +} diff --git a/test/bus/main.c b/test/bus/main.c index 67e5c65c..4faaa331 100644 --- a/test/bus/main.c +++ b/test/bus/main.c @@ -52,8 +52,6 @@ static DBusTestCase tests[] = { "expire-list", bus_expire_list_test }, { "config-parser", bus_config_parser_test }, { "signals", bus_signals_test }, - { "dispatch-sha1", bus_dispatch_sha1_test }, - { "dispatch", bus_dispatch_test }, { "activation-service-reload", bus_activation_service_reload_test }, { "unix-fds-passing", bus_unix_fds_passing_test }, { NULL } |