test-bus-kernel-bloom.c revision 26589352b2c7c067da0917ce95d5b31657ee7446
f545d156561c08020a67f9640c51454c2df4fb57fabien/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f545d156561c08020a67f9640c51454c2df4fb57fabien This file is part of systemd.
f545d156561c08020a67f9640c51454c2df4fb57fabien Copyright 2013 Lennart Poettering
f545d156561c08020a67f9640c51454c2df4fb57fabien systemd is free software; you can redistribute it and/or modify it
f545d156561c08020a67f9640c51454c2df4fb57fabien under the terms of the GNU Lesser General Public License as published by
f545d156561c08020a67f9640c51454c2df4fb57fabien the Free Software Foundation; either version 2.1 of the License, or
along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include "util.h"
#include "log.h"
#include "sd-bus.h"
#include "bus-kernel.h"
#include "bus-util.h"
static void test_one(
const char *path,
const char *interface,
const char *member,
bool as_list,
const char *arg0,
const char *match,
bool good) {
sd_bus *a, *b;
int r, found = 0;
r = sd_bus_new(&a);
assert_se(r >= 0);
r = sd_bus_new(&b);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
r = sd_bus_start(a);
assert_se(r >= 0);
r = sd_bus_start(b);
assert_se(r >= 0);
assert_se(r >= 0);
if (as_list)
assert_se(r >= 0);
r = sd_bus_process(b, &m);
sd_bus_unref(a);
sd_bus_unref(b);
test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path='/foo/bar/waldo/tuut'", false);
test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path='/foo/bar/waldo',interface='waldo.com',member='Piep',arg0='foobar'", true);
test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path='/foo/bar/waldo',interface='waldo.com',member='Piep',arg0='foobar2'", false);
test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path='/foo/bar/waldo/quux'", false);
test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path_namespace='/foo/bar/waldo'", true);
test_one("/foo/bar/waldo", "waldo.com", "Piep", false, "foobar", "path_namespace='/foo/bar'", true);