Skip to content

Make more tests modular

Simon McVittie requested to merge smcv/dbus:more-modular-tests into master
  • _dbus_test_check: Wrap body of macro in do/while

    This avoids unexpected precedence when used as the body of an "if" or "else" without being wrapped in {}.

  • test: Move TAP helpers into dbus-testutils if embedded tests are disabled

    This lets us run a subset of the tests that previously relied on extra test-only code being compiled into libdbus.

  • 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.

  • test: Replace _dbus_assert_not_reached()

    Assertions can be disabled; but in test code the assertions are the entire point, so we don't want to disable them. Use _dbus_test_fatal() instead.

    test-service is actually a test helper rather than a test, so use its pre-existing die() function instead.

  • test: Replace some _dbus_assert() with _dbus_test_check()

    Assertions can be disabled, but in test code the assertions are the whole point, so use checks that can't be disabled instead.

    Because there's a lot of test code, I haven't done this globally, only in the tests that I recently converted from "embedded" to "modular".

Edited by Simon McVittie

Merge request reports