From: sos22@douglas.cl.cam.ac.uk Date: Tue, 13 Jun 2006 14:19:09 +0000 (+0100) Subject: Expand test_xenbus a little. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15955^2~21 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9b6a936257c8a143bb7497fd78dd0225d8b424be;p=xen.git Expand test_xenbus a little. Signed-off-by: Steven Smith --- diff --git a/extras/mini-os/xenbus/xenbus.c b/extras/mini-os/xenbus/xenbus.c index 68029f3ce7..6c56a87dc7 100644 --- a/extras/mini-os/xenbus/xenbus.c +++ b/extras/mini-os/xenbus/xenbus.c @@ -468,6 +468,30 @@ static void do_read_test(const char *path) free(res); } +static void do_write_test(const char *path, const char *val) +{ + DEBUG("Write %s to %s...\n", val, path); + char *msg = xenbus_write(path, val); + if (msg) { + DEBUG("Result %s\n", msg); + free(msg); + } else { + DEBUG("Success.\n"); + } +} + +static void do_rm_test(const char *path) +{ + DEBUG("rm %s...\n", path); + char *msg = xenbus_rm(path); + if (msg) { + DEBUG("Result %s\n", msg); + free(msg); + } else { + DEBUG("Success.\n"); + } +} + /* Simple testing thing */ void test_xenbus(void) { @@ -482,6 +506,17 @@ void test_xenbus(void) DEBUG("Doing read test.\n"); do_read_test("device/vif/0/mac"); do_read_test("device/vif/0/backend"); + + DEBUG("Doing write test.\n"); + do_write_test("device/vif/0/flibble", "flobble"); + do_read_test("device/vif/0/flibble"); + do_write_test("device/vif/0/flibble", "widget"); + do_read_test("device/vif/0/flibble"); + + DEBUG("Doing rm test.\n"); + do_rm_test("device/vif/0/flibble"); + do_read_test("device/vif/0/flibble"); + DEBUG("(Should have said ENOENT)\n"); } /*