Add a trivial sanity-check for the atomic primitives

System Internals / DBus - Ralf Habacker [freenet.de] - 13 December 2019 15:13 UTC

This doesn't verify that they're atomic, but does verify that they return the right things.

This commit adds a new test function _dbus_test_check (a) to make writing tests easier. It checks the given boolean expression and generates a "not ok" test result if the expression is false.

Due to the current design of the test api, the test is only compiled if embedded tests were enabled at the time of configuration.

It was also necessary to move the test_atomic target definitions in test/Makefile.am to the --enable-embedded-tests section to avoid a make distcheck build error.

The test case itself has been authored by smcv.

e4feb960 Add a trivial sanity-check for the atomic primitives
dbus/dbus-test-tap.h | 2 ++
test/CMakeLists.txt | 5 +++
test/Makefile.am | 4 +++
test/internals/atomic.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 102 insertions(+)

Upstream: cgit.freedesktop.org


  • Share