aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/testsuite/12readonly.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/xenstore/testsuite/12readonly.sh')
-rw-r--r--tools/xenstore/testsuite/12readonly.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/xenstore/testsuite/12readonly.sh b/tools/xenstore/testsuite/12readonly.sh
new file mode 100644
index 0000000000..5e7501a2e6
--- /dev/null
+++ b/tools/xenstore/testsuite/12readonly.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Test that read only connection can't alter store.
+
+[ "`echo 'write /test create contents' | ./xs_test 2>&1`" = "" ]
+
+# These are all valid.
+[ "`echo 'dir /
+read /test
+getperm /test
+watch /test token 0
+unwatch /test token
+start /
+commit
+start /
+abort' | ./xs_test --readonly 2>&1`" = "test
+contents
+0 NONE" ]
+
+# These don't work
+[ "`echo 'write /test2 create contents' | ./xs_test --readonly 2>&1`" = "FATAL: write: Read-only file system" ]
+[ "`echo 'write /test create contents' | ./xs_test --readonly 2>&1`" = "FATAL: write: Read-only file system" ]
+[ "`echo 'setperm /test 100 NONE' | ./xs_test --readonly 2>&1`" = "FATAL: setperm: Read-only file system" ]
+[ "`echo 'setperm /test 100 NONE' | ./xs_test --readonly 2>&1`" = "FATAL: setperm: Read-only file system" ]
+[ "`echo 'shutdown' | ./xs_test --readonly 2>&1`" = "FATAL: shutdown: Read-only file system" ]
+[ "`echo 'introduce 1 100 7 /home' | ./xs_test --readonly 2>&1`" = "FATAL: introduce: Read-only file system" ]
+
+# Check that watches work like normal.
+set -m
+[ "`echo 'watch / token 0
+waitwatch
+ackwatch token' | ./xs_test --readonly 2>&1`" = "/test:token" ] &
+
+[ "`echo 'write /test create contents' | ./xs_test 2>&1`" = "" ]
+if wait; then :; else
+ echo Readonly wait test failed: $?
+ exit 1
+fi
+
+
+