From: Simon McVittie Date: Thu, 15 Nov 2018 15:48:26 +0000 (+0000) Subject: test: Split slow parts of the former test-dbus into their own executables X-Git-Tag: dbus-1.13.10~25^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24a1f3406ab709928baabbc19007880cfbca0d7c;p=thirdparty%2Fdbus.git 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 --- diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index d67fe1ecd..ff70fc2c6 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -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}) diff --git a/test/Makefile.am b/test/Makefile.am index eecfec859..58e725598 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -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 diff --git a/test/internals/hash.c b/test/internals/hash.c new file mode 100644 index 000000000..f6faa7356 --- /dev/null +++ b/test/internals/hash.c @@ -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 + +#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); +} diff --git a/test/internals/marshal-recursive.c b/test/internals/marshal-recursive.c new file mode 100644 index 000000000..bfa3f69ba --- /dev/null +++ b/test/internals/marshal-recursive.c @@ -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 + +#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); +} diff --git a/test/internals/message-internals.c b/test/internals/message-internals.c new file mode 100644 index 000000000..1a8e25596 --- /dev/null +++ b/test/internals/message-internals.c @@ -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 + +#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); +} diff --git a/test/internals/misc-internals.c b/test/internals/misc-internals.c index 084d2e2b3..54094abee 100644 --- a/test/internals/misc-internals.c +++ b/test/internals/misc-internals.c @@ -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 },