test: Split slow parts of the former test-dbus into their own executables

This makes it easier for a developer to run just the fast parts while
debugging some issue reproduced by the faster tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2018-11-15 15:48:26 +00:00
parent b7f11c17d1
commit 24a1f3406a
6 changed files with 138 additions and 3 deletions

View file

@ -93,6 +93,15 @@ if(WIN32)
endif()
if(DBUS_ENABLE_EMBEDDED_TESTS)
add_test_executable(test-hash ${TEST_DIR}/internals/hash.c dbus-testutils)
set_target_properties(test-hash PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
add_test_executable(test-marshal-recursive ${TEST_DIR}/internals/marshal-recursive.c dbus-testutils)
set_target_properties(test-marshal-recursive PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
add_test_executable(test-message-internals ${TEST_DIR}/internals/message-internals.c dbus-testutils)
set_target_properties(test-message-internals PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
add_test_executable(test-misc-internals ${TEST_DIR}/internals/misc-internals.c dbus-testutils)
set_target_properties(test-misc-internals PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})

View file

@ -83,6 +83,9 @@ uninstallable_test_programs += \
test-bus \
test-bus-dispatch \
test-bus-dispatch-sha1 \
test-hash \
test-marshal-recursive \
test-message-internals \
test-misc-internals \
$(NULL)
@ -197,6 +200,15 @@ test_bus_dispatch_sha1_LDADD = \
libdbus-testutils.la \
$(NULL)
test_hash_SOURCES = internals/hash.c
test_hash_LDADD = libdbus-testutils.la
test_marshal_recursive_SOURCES = internals/marshal-recursive.c
test_marshal_recursive_LDADD = libdbus-testutils.la
test_message_internals_SOURCES = internals/message-internals.c
test_message_internals_LDADD = libdbus-testutils.la
test_misc_internals_SOURCES = internals/misc-internals.c
test_misc_internals_LDADD = libdbus-testutils.la

39
test/internals/hash.c Normal file
View file

@ -0,0 +1,39 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright 2002-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 "dbus/dbus-internals.h"
#include "dbus/dbus-test.h"
#include "test/test-utils.h"
static DBusTestCase test = { "hash", _dbus_hash_test };
int
main (int argc,
char **argv)
{
return _dbus_test_main (argc, argv, 1, &test,
DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS,
NULL, NULL);
}

View file

@ -0,0 +1,39 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright 2002-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 "dbus/dbus-internals.h"
#include "dbus/dbus-test.h"
#include "test/test-utils.h"
static DBusTestCase test = { "marshal-recursive", _dbus_marshal_recursive_test };
int
main (int argc,
char **argv)
{
return _dbus_test_main (argc, argv, 1, &test,
DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS,
NULL, NULL);
}

View file

@ -0,0 +1,39 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright 2002-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 "dbus/dbus-internals.h"
#include "dbus/dbus-test.h"
#include "test/test-utils.h"
static DBusTestCase test = { "message", _dbus_message_test };
int
main (int argc,
char **argv)
{
return _dbus_test_main (argc, argv, 1, &test,
DBUS_TEST_FLAGS_CHECK_MEMORY_LEAKS,
NULL, NULL);
}

View file

@ -38,14 +38,11 @@ static DBusTestCase tests[] =
{ "object-tree", _dbus_object_tree_test },
{ "signature", _dbus_signature_test },
{ "marshalling", _dbus_marshal_test },
{ "marshal-recursive" , _dbus_marshal_recursive_test },
{ "byteswap", _dbus_marshal_byteswap_test },
{ "memory", _dbus_memory_test },
{ "mem-pool", _dbus_mem_pool_test },
{ "list", _dbus_list_test },
{ "marshal-validate", _dbus_marshal_validate_test },
{ "message", _dbus_message_test },
{ "hash", _dbus_hash_test },
{ "credentials", _dbus_credentials_test },
{ "keyring", _dbus_keyring_test },
{ "sha", _dbus_sha_test },