]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
test: Enable more tests when embedded tests are disabled
authorSimon McVittie <smcv@collabora.com>
Thu, 16 Apr 2020 13:18:49 +0000 (14:18 +0100)
committerSimon McVittie <smcv@collabora.com>
Mon, 20 Apr 2020 09:13:07 +0000 (10:13 +0100)
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 <smcv@collabora.com>
test/Makefile.am
test/internals/misc-internals.c
test/internals/sha.c

index 9566f9006a81745f116151d1fa6d517784ccbc5a..a992bf912d746fb43d1cdf81325056ef3cb3bb8a 100644 (file)
@@ -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 = \
index 5f290a59a2ecf89a0d3da385523c133961bf8a52..3f66b8e3ef7881d8e4fde0090436fefd6e71e5f2 100644 (file)
@@ -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 }
index b6f93caa223d0903cd409b7fb81a819ec729a2a0..8de77efbec00663ee07ad129aec98346e75cf94c 100644 (file)
@@ -26,6 +26,8 @@
 #include <config.h>
 #include "misc-internals.h"
 
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
+
 #include <stdio.h>
 #include <string.h>
 
@@ -489,3 +491,5 @@ _dbus_sha_test (const char *test_data_dir)
 
   return TRUE;
 }
+
+#endif