From: Simon McVittie Date: Fri, 28 Sep 2018 15:36:49 +0000 (+0100) Subject: test: Move marshalling tests into test/ X-Git-Tag: dbus-1.13.10~25^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ead2011ac29fc8678c0ed2bf0483a40899dbc04;p=thirdparty%2Fdbus.git test: Move marshalling tests into test/ dbus-marshal-recursive-util.c contains utility functions used by the other two, as well as tests. The others are purely test code. Signed-off-by: Simon McVittie --- diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt index 558df9612..2a695d842 100644 --- a/cmake/dbus/CMakeLists.txt +++ b/cmake/dbus/CMakeLists.txt @@ -153,9 +153,6 @@ set (DBUS_SHARED_HEADERS set (DBUS_UTIL_SOURCES ${DBUS_DIR}/dbus-asv-util.c ${DBUS_DIR}/dbus-mainloop.c - ${DBUS_DIR}/dbus-marshal-byteswap-util.c - ${DBUS_DIR}/dbus-marshal-recursive-util.c - ${DBUS_DIR}/dbus-marshal-validate-util.c ${DBUS_DIR}/dbus-message-util.c ${DBUS_DIR}/dbus-shell.c ${DBUS_DIR}/dbus-pollable-set.c diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 7d3723403..1c21ce0b8 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -96,10 +96,15 @@ 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(SOURCES ${TEST_DIR}/internals/dbus-marshal-recursive-util.c + ${TEST_DIR}/internals/dbus-marshal-recursive-util.h + ${TEST_DIR}/internals/marshal-recursive.c) + add_test_executable(test-marshal-recursive "${SOURCES}" dbus-testutils) set_target_properties(test-marshal-recursive PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) - set(SOURCES ${TEST_DIR}/internals/dbus-message-factory.c + set(SOURCES ${TEST_DIR}/internals/dbus-marshal-recursive-util.c + ${TEST_DIR}/internals/dbus-marshal-recursive-util.h + ${TEST_DIR}/internals/dbus-message-factory.c ${TEST_DIR}/internals/dbus-message-factory.h ${TEST_DIR}/internals/dbus-message-util.c ${TEST_DIR}/internals/dbus-message-util.h @@ -111,6 +116,10 @@ if(DBUS_ENABLE_EMBEDDED_TESTS) ${TEST_DIR}/internals/dbus-auth-script.h ${TEST_DIR}/internals/dbus-auth-util.c ${TEST_DIR}/internals/dbus-credentials-util.c + ${TEST_DIR}/internals/dbus-marshal-byteswap-util.c + ${TEST_DIR}/internals/dbus-marshal-recursive-util.c + ${TEST_DIR}/internals/dbus-marshal-recursive-util.h + ${TEST_DIR}/internals/dbus-marshal-validate-util.c ${TEST_DIR}/internals/misc-internals.c ${TEST_DIR}/internals/misc-internals.h) add_test_executable(test-misc-internals "${SOURCES}" dbus-testutils) diff --git a/dbus/Makefile.am b/dbus/Makefile.am index 5556c37ea..0656b7060 100644 --- a/dbus/Makefile.am +++ b/dbus/Makefile.am @@ -247,9 +247,6 @@ DBUS_UTIL_SOURCES= \ dbus-asv-util.h \ dbus-mainloop.c \ dbus-mainloop.h \ - dbus-marshal-byteswap-util.c \ - dbus-marshal-recursive-util.c \ - dbus-marshal-validate-util.c \ dbus-message-util.c \ dbus-shell.c \ dbus-shell.h \ diff --git a/dbus/dbus-test.h b/dbus/dbus-test.h index 75ff99a3f..7d6aa0131 100644 --- a/dbus/dbus-test.h +++ b/dbus/dbus-test.h @@ -43,10 +43,6 @@ dbus_bool_t _dbus_list_test (const char *test_data_dir); DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_marshal_test (const char *test_data_dir); -dbus_bool_t _dbus_marshal_recursive_test (const char *test_data_dir); -dbus_bool_t _dbus_marshal_byteswap_test (const char *test_data_dir); -dbus_bool_t _dbus_marshal_validate_test (const char *test_data_dir); - DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_misc_test (const char *test_data_dir); @@ -87,9 +83,4 @@ dbus_bool_t _dbus_memory_test (const char *test_data_dir); DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_object_tree_test (const char *test_data_dir); -dbus_bool_t _dbus_test_generate_bodies (int sequence, - int byte_order, - DBusString *signature, - DBusString *body); - #endif /* DBUS_TEST_H */ diff --git a/test/Makefile.am b/test/Makefile.am index a150e2b9b..2c8bc895c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -203,10 +203,16 @@ test_bus_dispatch_sha1_LDADD = \ test_hash_SOURCES = internals/hash.c test_hash_LDADD = libdbus-testutils.la -test_marshal_recursive_SOURCES = internals/marshal-recursive.c +test_marshal_recursive_SOURCES = \ + internals/dbus-marshal-recursive-util.c \ + internals/dbus-marshal-recursive-util.h \ + internals/marshal-recursive.c \ + $(NULL) test_marshal_recursive_LDADD = libdbus-testutils.la test_message_internals_SOURCES = \ + internals/dbus-marshal-recursive-util.c \ + internals/dbus-marshal-recursive-util.h \ internals/dbus-message-factory.c \ internals/dbus-message-factory.h \ internals/dbus-message-util.c \ @@ -220,6 +226,10 @@ test_misc_internals_SOURCES = \ internals/dbus-auth-script.h \ internals/dbus-auth-util.c \ internals/dbus-credentials-util.c \ + internals/dbus-marshal-byteswap-util.c \ + internals/dbus-marshal-recursive-util.c \ + internals/dbus-marshal-recursive-util.h \ + internals/dbus-marshal-validate-util.c \ internals/misc-internals.c \ internals/misc-internals.h \ $(NULL) diff --git a/dbus/dbus-marshal-byteswap-util.c b/test/internals/dbus-marshal-byteswap-util.c similarity index 95% rename from dbus/dbus-marshal-byteswap-util.c rename to test/internals/dbus-marshal-byteswap-util.c index 1ae142cd8..40b1780af 100644 --- a/dbus/dbus-marshal-byteswap-util.c +++ b/test/internals/dbus-marshal-byteswap-util.c @@ -23,12 +23,16 @@ #include +#include "misc-internals.h" + #ifdef DBUS_ENABLE_EMBEDDED_TESTS -#include "dbus-marshal-byteswap.h" -#include "dbus-test.h" +#include "dbus/dbus-marshal-byteswap.h" +#include "dbus/dbus-test.h" #include #include +#include "dbus-marshal-recursive-util.h" + static void do_byteswap_test (int byte_order) { diff --git a/dbus/dbus-marshal-recursive-util.c b/test/internals/dbus-marshal-recursive-util.c similarity index 99% rename from dbus/dbus-marshal-recursive-util.c rename to test/internals/dbus-marshal-recursive-util.c index 6a6b7d4f1..f81efffae 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/test/internals/dbus-marshal-recursive-util.c @@ -23,12 +23,14 @@ #include +#include "dbus-marshal-recursive-util.h" + #ifdef DBUS_ENABLE_EMBEDDED_TESTS -#include "dbus-marshal-recursive.h" -#include "dbus-marshal-basic.h" -#include "dbus-signature.h" -#include "dbus-internals.h" +#include "dbus/dbus-marshal-recursive.h" +#include "dbus/dbus-marshal-basic.h" +#include "dbus/dbus-signature.h" +#include "dbus/dbus-internals.h" #include #include @@ -124,8 +126,8 @@ _dbus_type_reader_equal_values (const DBusTypeReader *lhs, #ifndef DOXYGEN_SHOULD_SKIP_THIS -#include "dbus-test.h" -#include "dbus-list.h" +#include "dbus/dbus-test.h" +#include "dbus/dbus-list.h" #include #include diff --git a/test/internals/dbus-marshal-recursive-util.h b/test/internals/dbus-marshal-recursive-util.h new file mode 100644 index 000000000..ab069e4c5 --- /dev/null +++ b/test/internals/dbus-marshal-recursive-util.h @@ -0,0 +1,36 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ +/* dbus-marshal-recursive-util.c Would be in dbus-marshal-recursive.c, but only used in bus/tests + * + * Copyright (C) 2004, 2005 Red Hat, Inc. + * + * 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 + * + */ + +#ifndef TEST_INTERNALS_DBUS_MARSHAL_RECURSIVE_UTIL_H +#define TEST_INTERNALS_DBUS_MARSHAL_RECURSIVE_UTIL_H + +#include +#include + +dbus_bool_t _dbus_marshal_recursive_test (const char *test_data_dir); +dbus_bool_t _dbus_test_generate_bodies (int sequence, + int byte_order, + DBusString *signature, + DBusString *body); + +#endif diff --git a/dbus/dbus-marshal-validate-util.c b/test/internals/dbus-marshal-validate-util.c similarity index 98% rename from dbus/dbus-marshal-validate-util.c rename to test/internals/dbus-marshal-validate-util.c index ab7940427..4179928b4 100644 --- a/dbus/dbus-marshal-validate-util.c +++ b/test/internals/dbus-marshal-validate-util.c @@ -22,16 +22,22 @@ */ #include + +#include "misc-internals.h" + #ifdef DBUS_ENABLE_EMBEDDED_TESTS #ifndef DOXYGEN_SHOULD_SKIP_THIS -#include "dbus-internals.h" -#include "dbus-marshal-validate.h" -#include "dbus-marshal-recursive.h" +#include "dbus/dbus-internals.h" +#include "dbus/dbus-marshal-validate.h" +#include "dbus/dbus-marshal-recursive.h" #include -#include "dbus-test.h" +#include "dbus/dbus-test.h" + +#include "dbus-marshal-recursive-util.h" + #include typedef struct diff --git a/test/internals/dbus-message-factory.c b/test/internals/dbus-message-factory.c index f90ed724b..db02737aa 100644 --- a/test/internals/dbus-message-factory.c +++ b/test/internals/dbus-message-factory.c @@ -32,6 +32,8 @@ #include "dbus/dbus-test.h" #include "dbus/dbus-test-tap.h" +#include "dbus-marshal-recursive-util.h" + #include typedef enum diff --git a/test/internals/marshal-recursive.c b/test/internals/marshal-recursive.c index bfa3f69ba..5866657a5 100644 --- a/test/internals/marshal-recursive.c +++ b/test/internals/marshal-recursive.c @@ -27,6 +27,8 @@ #include "dbus/dbus-test.h" #include "test/test-utils.h" +#include "dbus-marshal-recursive-util.h" + static DBusTestCase test = { "marshal-recursive", _dbus_marshal_recursive_test }; int diff --git a/test/internals/misc-internals.h b/test/internals/misc-internals.h index 3b14d426b..b87a402bd 100644 --- a/test/internals/misc-internals.h +++ b/test/internals/misc-internals.h @@ -28,5 +28,7 @@ dbus_bool_t _dbus_auth_test (const char *test_data_dir); dbus_bool_t _dbus_credentials_test (const char *test_data_dir); +dbus_bool_t _dbus_marshal_byteswap_test (const char *test_data_dir); +dbus_bool_t _dbus_marshal_validate_test (const char *test_data_dir); #endif