libnm-glib: make test-networkmanager-service.py automatically exit with its parent

System Internals / NetworkManager - Dan Winship [gnome.org] - 1 August 2014 11:12 UTC

test-nm-client.c and test-remote-settings-client.c were using their own assertion macros so they could kill the test service on assertion failure. Except that some new code didn't get the memo and used the g_assert* macros. Not to mention that sometimes the tests would crash outside of an assertion macro.

We can make test-networkmanager-service.py notice that its parent has crashed by opening a pipe between them and taking advantage of the fact that the pipe will be automatically closed if the parent crashes. So then test-networkmanager-service.py just has to watch for that, and exit if the pipe closes.

Then that lets us drop the test_assert* macros and just use g_assert* instead.

08b9119 libnm-glib: make test-networkmanager-service.py automatically exit with its parent
libnm-glib/tests/common.c | 8 +-
libnm-glib/tests/common.h | 1 +
libnm-glib/tests/test-nm-client.c | 188 ++++++++++--------------
libnm-glib/tests/test-remote-settings-client.c | 79 ++++------
tools/test-networkmanager-service.py | 9 +-
5 files changed, 126 insertions(+), 159 deletions(-)

Upstream: cgit.freedesktop.org


  • Share