mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 01:48:00 +02:00
test: Break out the slow parts of test-bus into their own executables
This makes it more convenient to re-run the rest of test-bus as required when debugging. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
a15839da9b
commit
3b512610c0
5 changed files with 137 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
59
test/bus/dispatch-sha1.c
Normal file
59
test/bus/dispatch-sha1.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
59
test/bus/dispatch.c
Normal file
59
test/bus/dispatch.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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 }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue