test-bus-marshal.c revision df2d202e6ed4001a21c6512c244acad5d4706c87
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <stdlib.h>
#include <byteswap.h>
#ifdef HAVE_GLIB
#endif
#ifdef HAVE_DBUS
#endif
#include "log.h"
#include "util.h"
#include "sd-bus.h"
#include "bus-message.h"
#include "bus-util.h"
#include "bus-dump.h"
static void test_bus_label_escape_one(const char *a, const char *b) {
assert_se(t = sd_bus_label_escape(a));
assert_se(x = sd_bus_label_unescape(t));
assert_se(y = sd_bus_label_unescape(b));
}
static void test_bus_label_escape(void) {
}
int r, boolean;
const char *x, *x2, *y, *z, *a, *b, *c, *d;
uint8_t u, v;
char *h;
char *s;
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
assert_se(r >= 0);
r = sd_bus_message_close_container(m);
assert_se(r >= 0);
r = sd_bus_message_append_string_space(m, 5, &s);
assert_se(r >= 0);
strcpy(s, "hallo");
assert_se(r >= 0);
assert_se(r >= 0);
r = bus_message_seal(m, 4711);
assert_se(r >= 0);
bus_message_dump(m, stdout, true);
bus_message_dump(m, ms, false);
assert_se(r >= 0);
assert_se(h);
free(h);
#ifdef HAVE_GLIB
{
GDBusMessage *g;
char *p;
#if !defined(GLIB_VERSION_2_36)
g_type_init();
#endif
p = g_dbus_message_print(g, 0);
log_info("%s", p);
g_free(p);
g_object_unref(g);
}
#endif
#ifdef HAVE_DBUS
{
DBusMessage *w;
if (!w) {
} else
}
#endif
m = sd_bus_message_unref(m);
assert_se(r >= 0);
bus_message_dump(m, stdout, true);
bus_message_dump(m, ms, false);
assert_se(sd_bus_message_rewind(m, true) >= 0);
assert_se(r > 0);
assert_se(r > 0);
assert_se(r > 0);
assert_se(u == 3);
assert_se(v == 5);
assert_se(r > 0);
assert_se(r > 0);
r = sd_bus_message_read_basic(m, 's', &s);
assert_se(r > 0);
assert_se(r > 0);
assert_se(r > 0);
assert_se(r == 0);
assert_se(r >= 0);
r = sd_bus_message_rewind(m, true);
assert_se(r >= 0);
r = sd_bus_message_copy(copy, m, true);
assert_se(r >= 0);
assert_se(r >= 0);
r = sd_bus_message_rewind(m, true);
assert_se(r >= 0);
r = sd_bus_message_skip(m, "ssas");
assert_se(r > 0);
r = sd_bus_message_skip(m, "sass");
assert_se(r >= 0);
r = sd_bus_message_skip(m, "a{yv}");
assert_se(r >= 0);
assert_se(r > 0);
r = sd_bus_message_enter_container(m, 0, NULL);
assert_se(r > 0);
r = sd_bus_message_read(m, "(ss)", &x, &y);
assert_se(r > 0);
r = sd_bus_message_read(m, "(ss)", &a, &b);
assert_se(r > 0);
r = sd_bus_message_read(m, "(ss)", &c, &d);
assert_se(r > 0);
r = sd_bus_message_read(m, "(ss)", &x, &y);
assert_se(r == 0);
r = sd_bus_message_exit_container(m);
assert_se(r >= 0);
return 0;
}