test-bus-cleanup.c revision d4d00020d6ad855d65d31020fefa5003e1bb477f
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering This file is part of systemd.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering Copyright 2013 Zbigniew Jędrzejewski-Szmek
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering systemd is free software; you can redistribute it and/or modify it
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering under the terms of the GNU Lesser General Public License as published by
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering (at your option) any later version.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering systemd is distributed in the hope that it will be useful, but
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering Lesser General Public License for more details.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering You should have received a copy of the GNU Lesser General Public License
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringstatic void test_bus_new(void) {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering printf("after new: refcount %u\n", REFCNT_GET(bus->n_ref));
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringstatic int test_bus_open(void) {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering printf("after open: refcount %u\n", REFCNT_GET(bus->n_ref));
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringstatic void test_bus_new_method_call(void) {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
58ea275a68cd242ad60161bcb7582614d1d89f13Lennart Poettering assert_se(sd_bus_open_system(&bus) >= 0);
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering assert_se(sd_bus_message_new_method_call(bus, &m, "a.service.name", "/an/object/path", "an.interface.name", "AMethodName") >= 0);
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering printf("after message_new_method_call: refcount %u\n", REFCNT_GET(bus->n_ref));
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering printf("after bus_unref: refcount %u\n", m->n_ref);
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poetteringstatic void test_bus_new_signal(void) {
4819ff0358b6317c195fd4b1768e03d09c871070Lennart Poettering _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
log_open();
test_bus_new();
r = test_bus_open();
return EXIT_TEST_SKIP;
return EXIT_SUCCESS;