From 9b6a936257c8a143bb7497fd78dd0225d8b424be Mon Sep 17 00:00:00 2001 From: "sos22@douglas.cl.cam.ac.uk" Date: Tue, 13 Jun 2006 15:19:09 +0100 Subject: Expand test_xenbus a little. Signed-off-by: Steven Smith --- extras/mini-os/xenbus/xenbus.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'extras/mini-os/xenbus') 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"); } /* -- cgit v1.2.3