Skip to content

tests: Speed up bus-dispatch OOM testing by a factor of 30

Simon McVittie requested to merge smcv/dbus:30x-faster-testing into master
  • test/bus: Factor out common setup/teardown code

  • test/bus: Break up dispatch test into three separate tests

    This is really three separate test-cases: one for traditional activation as a direct child process of the dbus-daemon, and two for traditional activation (successful and failing) via the setuid dbus-daemon-launch-helper on Unix.

    The ones where activation succeeds extremely slow, as a result of the instrumentation for simulating malloc() failures combined with a large number of memory operations, particularly when using AddressSanitizer.

    Splitting up "OOM" tests like these has a disproportionately good impact on the time they take, because the simulated malloc() failure instrumentation repeats the entire test making the first malloc() fail, then making the second malloc() fail, and so on. For allocation failures in the second half of the test, this means we repeat the first half of the test with no malloc() failures a very large number of times, which is not a good use of time, because we already tested it successfully.

    Even when not using the "OOM" instrumentation, splitting up these tests lets them run in parallel, which is also a major time saving.

    Needless to say, this speeds up testing considerably. On my modern but unexceptional x86 laptop, in a typical debug build with Meson, the old dispatch test took just over 21 minutes, which drops to about 40 seconds each for the new normal-activation and helper-activation tests (and for most of that time, they're running in parallel, so the wall-clock time taken for the whole test suite is somewhere around a minute).

    In a debug build with Meson, gcc and AddressSanitizer, the old dispatch test takes longer than my patience will allow, and the new separate tests take about 5-6 minutes each. Reduce their timeout accordingly, but not as far as the default for slow tests (5 minutes) to allow some headroom for AddressSanitizer or slower systems.

    The failed-helper-activation test is almost instantaneous, and no longer needs to be marked as slow.

  • dispatch test: Pass in test data directory as a C string

    This reduces duplication a little bit.

Edited by Simon McVittie

Merge request reports