diff --git a/CMakeLists.txt b/CMakeLists.txt index d3ec71be..3f9f37f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -443,7 +443,7 @@ enable_testing() ########### command line options ############### if(DBUS_BUILD_TESTS) - set(DBUS_ENABLE_EMBEDDED_TESTS ON) + set(DBUS_ENABLE_INTRUSIVE_TESTS ON) set(DBUS_ENABLE_MODULAR_TESTS ON) endif() diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 1cf57286..17e0def0 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -59,10 +59,15 @@ #ifndef DBUS_DISABLE_CHECKS # define DBUS_ENABLE_CHECKS 1 #endif -#cmakedefine DBUS_ENABLE_EMBEDDED_TESTS 1 +#cmakedefine DBUS_ENABLE_INTRUSIVE_TESTS 1 #cmakedefine DBUS_ENABLE_MODULAR_TESTS 1 #cmakedefine DBUS_USE_OUTPUT_DEBUG_STRING 1 +/* Compatibility with the old name for this functionality */ +#ifdef DBUS_ENABLE_INTRUSIVE_TESTS +# define DBUS_ENABLE_EMBEDDED_TESTS 1 +#endif + /* xmldocs */ /* doxygen */ #cmakedefine DBUS_GCOV_ENABLED 1 diff --git a/dbus/CMakeLists.txt b/dbus/CMakeLists.txt index aaa5a52d..04f9ca22 100644 --- a/dbus/CMakeLists.txt +++ b/dbus/CMakeLists.txt @@ -143,7 +143,7 @@ set(DBUS_SHARED_HEADERS dbus-sysdeps.h ) -if(DBUS_ENABLE_EMBEDDED_TESTS) +if(DBUS_ENABLE_INTRUSIVE_TESTS) set(DBUS_SHARED_SOURCES ${DBUS_SHARED_SOURCES} dbus-test-tap.c) set(DBUS_SHARED_HEADERS ${DBUS_SHARED_HEADERS} dbus-test-tap.h) # ... else they are in the test library instead diff --git a/dbus/dbus-macros-internal.h b/dbus/dbus-macros-internal.h index 3d7c0683..474a84b5 100644 --- a/dbus/dbus-macros-internal.h +++ b/dbus/dbus-macros-internal.h @@ -29,11 +29,12 @@ #include -#ifdef DBUS_ENABLE_EMBEDDED_TESTS -# define DBUS_EMBEDDED_TESTS_EXPORT DBUS_PRIVATE_EXPORT +#ifdef DBUS_ENABLE_INTRUSIVE_TESTS +# define DBUS_INTRUSIVE_TESTS_EXPORT DBUS_PRIVATE_EXPORT #else -# define DBUS_EMBEDDED_TESTS_EXPORT /* nothing */ +# define DBUS_INTRUSIVE_TESTS_EXPORT /* nothing */ #endif +#define DBUS_EMBEDDED_TESTS_EXPORT DBUS_INTRUSIVE_TESTS_EXPORT #if defined(DBUS_PRIVATE_EXPORT) /* value forced by compiler command line, don't redefine */ diff --git a/dbus/meson.build b/dbus/meson.build index 905255c2..87f18d91 100644 --- a/dbus/meson.build +++ b/dbus/meson.build @@ -79,7 +79,7 @@ dbus_shared_sources = [ 'dbus-sysdeps.c', ] -if embedded_tests +if intrusive_tests dbus_shared_sources += 'dbus-test-tap.c' endif diff --git a/meson.build b/meson.build index 1a1e8088..fed1b7f2 100644 --- a/meson.build +++ b/meson.build @@ -879,10 +879,12 @@ config.set('DBUS_USE_OUTPUT_DEBUG_STRING', windows_output_debug) # Controls whether the tools are built. tools = get_option('tools') -# DBUS_ENABLE_EMBEDDED_TESTS controls unit tests built in to .c files +# DBUS_ENABLE_INTRUSIVE_TESTS controls unit tests built in to .c files # and some stuff in the test/ subdir. -embedded_tests = get_option('embedded_tests') -config.set('DBUS_ENABLE_EMBEDDED_TESTS', embedded_tests) +intrusive_tests = get_option('intrusive_tests') +config.set('DBUS_ENABLE_INTRUSIVE_TESTS', intrusive_tests) +# An older name for the same thing +config.set('DBUS_ENABLE_EMBEDDED_TESTS', intrusive_tests) # DBUS_ENABLE_MODULAR_TESTS controls tests that work based on public API. @@ -1344,7 +1346,7 @@ summary_dict += { 'gcc coverage': get_option('b_coverage'), 'gcc profiling': get_option('b_pgo'), - 'Building embedded tests': embedded_tests, + 'Building intrusive tests': intrusive_tests, 'Building modular tests': dbus_enable_modular_tests, '- with GLib': use_glib, 'Installing tests': get_option('installed_tests'), @@ -1385,10 +1387,10 @@ endif summary(summary_dict, bool_yn: true) -if embedded_tests - warning('building with unit tests increases the size of the installed library and renders it insecure.') +if intrusive_tests + warning('building with intrusive tests increases the size of the installed library and renders it insecure.') if not asserts - warning('building with embedded tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)') + warning('building with intrusive tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)') endif endif diff --git a/meson_options.txt b/meson_options.txt index e63f4bd6..1fc8a2ad 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -82,10 +82,10 @@ option( ) option( - 'embedded_tests', + 'intrusive_tests', type: 'boolean', value: false, - description: 'Enable unit test code in the library and binaries' + description: 'Enable tests that require insecure extra code in the library and binaries' ) option( diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b3c593e5..032ba1f7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,7 +13,7 @@ add_library(dbus-testutils STATIC ) target_link_libraries(dbus-testutils ${DBUS_INTERNAL_LIBRARIES}) -if(DBUS_ENABLE_EMBEDDED_TESTS) +if(DBUS_ENABLE_INTRUSIVE_TESTS) add_subdirectory( name-test ) endif() @@ -100,7 +100,7 @@ if(WIN32) add_helper_executable(manual-paths ${manual-paths_SOURCES} dbus-testutils) endif() -if(DBUS_ENABLE_EMBEDDED_TESTS) +if(DBUS_ENABLE_INTRUSIVE_TESTS) add_test_executable(test-atomic ${test-atomic_SOURCES} dbus-testutils) add_test_executable(test-hash internals/hash.c dbus-testutils) set_target_properties(test-hash PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) diff --git a/test/meson.build b/test/meson.build index 1e61679a..e99196b8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -254,7 +254,9 @@ endif tests = [] -if embedded_tests +if intrusive_tests + # These tests require special instrumentation in libdbus and/or + # dbus-daemon, which is not safe to enable in production builds. tests += [ { @@ -682,10 +684,10 @@ if message_bus and tools and platform_unix and use_glib ] # Testing dbus-launch relies on special code in that binary. - if embedded_tests + if intrusive_tests scripts += { 'name': 'test-dbus-launch-eval.sh' } endif - if embedded_tests and use_x11_autolaunch + if intrusive_tests and use_x11_autolaunch scripts += { 'name': 'test-dbus-launch-x11.sh' } endif endif diff --git a/test/name-test/meson.build b/test/name-test/meson.build index 293a9d36..a99c0e9f 100644 --- a/test/name-test/meson.build +++ b/test/name-test/meson.build @@ -20,7 +20,7 @@ # SOFTWARE. -if embedded_tests +if intrusive_tests tests = [ {'name': 'test-ids'}, diff --git a/test/use-as-subproject/meson.build b/test/use-as-subproject/meson.build index 8111e9ee..e2a67d4a 100644 --- a/test/use-as-subproject/meson.build +++ b/test/use-as-subproject/meson.build @@ -22,7 +22,7 @@ libdbus_dep = dependency( fallback: ['dbus', 'libdbus_dep'], default_options: [ 'default_library=static', - 'embedded_tests=false', + 'intrusive_tests=false', 'message_bus=false', 'modular_tests=disabled', 'tools=false', diff --git a/tools/ci-build.sh b/tools/ci-build.sh index c971415c..55a3c1a4 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -354,7 +354,7 @@ case "$ci_buildsys" in case "$ci_variant" in (debug) set -- -Dasserts=true "$@" - set -- -Dembedded_tests=true "$@" + set -- -Dintrusive_tests=true "$@" set -- -Dverbose_mode=true "$@" case "$ci_host" in