ia64/xen-unstable
changeset 10393:e9dd58963e97
Expand test_xenbus a little.
Signed-off-by: Steven Smith <sos22@cam.ac.uk>
Signed-off-by: Steven Smith <sos22@cam.ac.uk>
author | sos22@douglas.cl.cam.ac.uk |
---|---|
date | Tue Jun 13 15:19:09 2006 +0100 (2006-06-13) |
parents | 464324585311 |
children | 3d85c1136d63 |
files | extras/mini-os/xenbus/xenbus.c |
line diff
1.1 --- a/extras/mini-os/xenbus/xenbus.c Tue Jun 13 15:17:01 2006 +0100 1.2 +++ b/extras/mini-os/xenbus/xenbus.c Tue Jun 13 15:19:09 2006 +0100 1.3 @@ -468,6 +468,30 @@ static void do_read_test(const char *pat 1.4 free(res); 1.5 } 1.6 1.7 +static void do_write_test(const char *path, const char *val) 1.8 +{ 1.9 + DEBUG("Write %s to %s...\n", val, path); 1.10 + char *msg = xenbus_write(path, val); 1.11 + if (msg) { 1.12 + DEBUG("Result %s\n", msg); 1.13 + free(msg); 1.14 + } else { 1.15 + DEBUG("Success.\n"); 1.16 + } 1.17 +} 1.18 + 1.19 +static void do_rm_test(const char *path) 1.20 +{ 1.21 + DEBUG("rm %s...\n", path); 1.22 + char *msg = xenbus_rm(path); 1.23 + if (msg) { 1.24 + DEBUG("Result %s\n", msg); 1.25 + free(msg); 1.26 + } else { 1.27 + DEBUG("Success.\n"); 1.28 + } 1.29 +} 1.30 + 1.31 /* Simple testing thing */ 1.32 void test_xenbus(void) 1.33 { 1.34 @@ -482,6 +506,17 @@ void test_xenbus(void) 1.35 DEBUG("Doing read test.\n"); 1.36 do_read_test("device/vif/0/mac"); 1.37 do_read_test("device/vif/0/backend"); 1.38 + 1.39 + DEBUG("Doing write test.\n"); 1.40 + do_write_test("device/vif/0/flibble", "flobble"); 1.41 + do_read_test("device/vif/0/flibble"); 1.42 + do_write_test("device/vif/0/flibble", "widget"); 1.43 + do_read_test("device/vif/0/flibble"); 1.44 + 1.45 + DEBUG("Doing rm test.\n"); 1.46 + do_rm_test("device/vif/0/flibble"); 1.47 + do_read_test("device/vif/0/flibble"); 1.48 + DEBUG("(Should have said ENOENT)\n"); 1.49 } 1.50 1.51 /*