diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-06-10 18:47:31 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-06-10 20:22:40 +0200 |
commit | 2e90f867f994a2c9ff3a6d268305ce666420d83b (patch) | |
tree | b4baafd088eaec064c9a08d9383268c8a0a81ec1 /src/libsystemd/sd-bus/test-bus-kernel-bloom.c | |
parent | a867b0022616511cceb02f801e7643427d9f3776 (diff) |
bus: fix test-bus-kerne-bloom.c to match properly
Make sure we actually verify our match-rules are executed properly. Right
now all we test is the bloom-matches, which are non-reliable as they leave
through false-positives.
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-kernel-bloom.c')
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-kernel-bloom.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-kernel-bloom.c b/src/libsystemd/sd-bus/test-bus-kernel-bloom.c index b11c43bd7b..8ebbbfaaac 100644 --- a/src/libsystemd/sd-bus/test-bus-kernel-bloom.c +++ b/src/libsystemd/sd-bus/test-bus-kernel-bloom.c @@ -26,6 +26,14 @@ #include "bus-kernel.h" #include "bus-util.h" +static int test_match(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { + int *found = userdata; + + *found = 1; + + return 0; +} + static void test_one( const char *path, const char *interface, @@ -39,7 +47,7 @@ static void test_one( _cleanup_free_ char *name = NULL, *bus_name = NULL, *address = NULL; _cleanup_bus_message_unref_ sd_bus_message *m = NULL; sd_bus *a, *b; - int r; + int r, found = 0; assert_se(asprintf(&name, "deine-mutter-%u", (unsigned) getpid()) >= 0); @@ -71,7 +79,7 @@ static void test_one( assert_se(r >= 0); log_debug("match"); - r = sd_bus_add_match(b, NULL, match, NULL, NULL); + r = sd_bus_add_match(b, NULL, match, test_match, &found); assert_se(r >= 0); log_debug("signal"); @@ -83,7 +91,7 @@ static void test_one( assert_se(r >= 0); r = sd_bus_process(b, &m); - assert_se(r >= 0 && (good == !!m)); + assert_se(r >= 0 && good == !!found); sd_bus_unref(a); sd_bus_unref(b); |