From: Simon McVittie Date: Thu, 16 Apr 2020 13:18:49 +0000 (+0100) Subject: test: Enable more tests when embedded tests are disabled X-Git-Tag: dbus-1.13.14~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c383f151be876461a5bfc4d307a2a76c78bcc5cd;p=thirdparty%2Fdbus.git test: Enable more tests when embedded tests are disabled These previously relied on embedding test-specific code in libdbus, but they actually only need public APIs, private interfaces that get exported anyway for the benefit of dbus-daemon, and the TAP helpers; so we can run them even in production builds. Signed-off-by: Simon McVittie --- diff --git a/test/Makefile.am b/test/Makefile.am index 9566f9006..a992bf912 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -85,14 +85,11 @@ TEST_BINARIES += test-spawn endif uninstallable_test_programs += \ - test-atomic \ test-bus \ test-bus-dispatch \ test-bus-dispatch-sha1 \ - test-hash \ test-marshal-recursive \ test-message-internals \ - test-misc-internals \ $(NULL) if DBUS_UNIX @@ -107,15 +104,15 @@ endif DBUS_UNIX noinst_PROGRAMS += $(uninstallable_test_programs) TESTS += $(uninstallable_test_programs) -test_atomic_SOURCES = internals/atomic.c -test_atomic_LDADD = libdbus-testutils.la - else !DBUS_ENABLE_EMBEDDED_TESTS TEST_BINARIES= endif !DBUS_ENABLE_EMBEDDED_TESTS +test_atomic_SOURCES = internals/atomic.c +test_atomic_LDADD = libdbus-testutils.la + noinst_PROGRAMS += $(TEST_BINARIES) # This helper is meant to crash, so if we're compiling the rest with @@ -273,7 +270,10 @@ installable_helpers = \ test-sleep-forever \ $(NULL) installable_tests = \ + test-atomic \ + test-hash \ test-shell \ + test-misc-internals \ test-printf \ $(NULL) installable_manual_tests = \ diff --git a/test/internals/misc-internals.c b/test/internals/misc-internals.c index 5f290a59a..3f66b8e3e 100644 --- a/test/internals/misc-internals.c +++ b/test/internals/misc-internals.c @@ -895,6 +895,7 @@ _dbus_signature_test (const char *test_data_dir _DBUS_GNUC_UNUSED) } #ifdef DBUS_UNIX +#ifdef DBUS_ENABLE_EMBEDDED_TESTS static dbus_bool_t _dbus_transport_unix_test (const char *test_data_dir _DBUS_GNUC_UNUSED) { @@ -919,6 +920,7 @@ _dbus_transport_unix_test (const char *test_data_dir _DBUS_GNUC_UNUSED) return ret; } +#endif /** * Unit test for dbus-userdb.c. @@ -972,28 +974,33 @@ _dbus_userdb_test (const char *test_data_dir) static DBusTestCase tests[] = { - { "string", _dbus_string_test }, - { "sysdeps", _dbus_sysdeps_test }, - { "data-slot", _dbus_data_slot_test }, { "misc", _dbus_misc_test }, { "address", _dbus_address_test }, { "server", _dbus_server_test }, - { "object-tree", _dbus_object_tree_test }, { "signature", _dbus_signature_test }, - { "marshalling", _dbus_marshal_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 }, + +#ifdef DBUS_ENABLE_EMBEDDED_TESTS + { "auth", _dbus_auth_test }, + { "byteswap", _dbus_marshal_byteswap_test }, { "credentials", _dbus_credentials_test }, + { "data-slot", _dbus_data_slot_test }, { "keyring", _dbus_keyring_test }, + { "marshal-validate", _dbus_marshal_validate_test }, + { "marshalling", _dbus_marshal_test }, + { "memory", _dbus_memory_test }, + { "object-tree", _dbus_object_tree_test }, { "sha", _dbus_sha_test }, - { "auth", _dbus_auth_test }, + { "string", _dbus_string_test }, + { "sysdeps", _dbus_sysdeps_test }, +#endif #if defined(DBUS_UNIX) { "userdb", _dbus_userdb_test }, +#ifdef DBUS_ENABLE_EMBEDDED_TESTS { "transport-unix", _dbus_transport_unix_test }, +#endif #endif { NULL } diff --git a/test/internals/sha.c b/test/internals/sha.c index b6f93caa2..8de77efbe 100644 --- a/test/internals/sha.c +++ b/test/internals/sha.c @@ -26,6 +26,8 @@ #include #include "misc-internals.h" +#ifdef DBUS_ENABLE_EMBEDDED_TESTS + #include #include @@ -489,3 +491,5 @@ _dbus_sha_test (const char *test_data_dir) return TRUE; } + +#endif