aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/testsuite/12readonly.sh
blob: 5e7501a2e63d5d98d5e360c32c428b87a3bd6210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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