ia64/xen-unstable

view tools/xenstore/testsuite/07watch.test @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents a9ee400a5da9
children 8799d14bef77 9312a3e8a6f8 dfaf788ab18c
line source
1 # Watch something, write to it, check watch has fired.
2 write /test create contents
4 1 watch /test token
5 2 write /test create contents2
6 expect 1:/test:token
7 1 waitwatch
8 1 ackwatch token
9 1 close
11 # Check that reads don't set it off.
12 1 watch /test token
13 expect 2:contents2
14 2 read /test
15 expect 1: waitwatch failed: Connection timed out
16 1 waitwatch
17 1 close
19 # mkdir, setperm and rm should (also tests watching dirs)
20 mkdir /dir
21 1 watch /dir token
22 2 mkdir /dir/newdir
23 expect 1:/dir/newdir:token
24 1 waitwatch
25 1 ackwatch token
26 2 setperm /dir/newdir 0 READ
27 expect 1:/dir/newdir:token
28 1 waitwatch
29 1 ackwatch token
30 2 rm /dir/newdir
31 expect 1:/dir/newdir:token
32 1 waitwatch
33 1 ackwatch token
34 1 close
35 2 close
37 # We don't get a watch from our own commands.
38 watch /dir token
39 mkdir /dir/newdir
40 expect waitwatch failed: Connection timed out
41 waitwatch
42 close
44 # ignore watches while doing commands, should work.
45 watch /dir token
46 1 write /dir/test create contents
47 expect contents
48 read /dir/test
49 expect /dir/test:token
50 waitwatch
51 ackwatch token
52 close
54 # watch priority test: all simultaneous
55 1 watch /dir token1
56 3 watch /dir token3
57 2 watch /dir token2
58 write /dir/test create contents
59 expect 3:/dir/test:token3
60 3 waitwatch
61 3 ackwatch token3
62 expect 2:/dir/test:token2
63 2 waitwatch
64 2 ackwatch token2
65 expect 1:/dir/test:token1
66 1 waitwatch
67 1 ackwatch token1
68 1 close
69 2 close
70 3 close
72 # If one dies (without acking), the other should still get ack.
73 1 watch /dir token1
74 2 watch /dir token2
75 write /dir/test create contents
76 expect 2:/dir/test:token2
77 2 waitwatch
78 2 close
79 expect 1:/dir/test:token1
80 1 waitwatch
81 1 ackwatch token1
82 1 close
84 # If one dies (without reading at all), the other should still get ack.
85 1 watch /dir token1
86 2 watch /dir token2
87 write /dir/test create contents
88 2 close
89 expect 1:/dir/test:token1
90 1 waitwatch
91 1 ackwatch token1
92 1 close
93 2 close
95 # unwatch
96 1 watch /dir token1
97 1 unwatch /dir token1
98 1 watch /dir token2
99 2 write /dir/test2 create contents
100 expect 1:/dir/test2:token2
101 1 waitwatch
102 1 unwatch /dir token2
103 1 close
104 2 close
106 # unwatch while watch pending. Other watcher still gets the event.
107 1 watch /dir token1
108 2 watch /dir token2
109 write /dir/test create contents
110 2 unwatch /dir token2
111 expect 1:/dir/test:token1
112 1 waitwatch
113 1 ackwatch token1
114 1 close
115 2 close
117 # unwatch while watch pending. Should clear this so we get next event.
118 1 watch /dir token1
119 write /dir/test create contents
120 1 unwatch /dir token1
121 1 watch /dir/test token2
122 write /dir/test none contents2
123 expect 1:/dir/test:token2
124 1 waitwatch
125 1 ackwatch token2
127 # check we only get notified once.
128 1 watch /test token
129 2 write /test create contents2
130 expect 1:/test:token
131 1 waitwatch
132 1 ackwatch token
133 expect 1: waitwatch failed: Connection timed out
134 1 waitwatch
135 1 close
137 # watches are queued in order.
138 1 watch / token
139 2 write /test1 create contents
140 2 write /test2 create contents
141 2 write /test3 create contents
142 expect 1:/test1:token
143 1 waitwatch
144 1 ackwatch token
145 expect 1:/test2:token
146 1 waitwatch
147 1 ackwatch token
148 expect 1:/test3:token
149 1 waitwatch
150 1 ackwatch token
151 1 close
153 # Creation of subpaths should be covered correctly.
154 1 watch / token
155 2 write /test/subnode create contents2
156 2 write /test/subnode/subnode create contents2
157 expect 1:/test/subnode:token
158 1 waitwatch
159 1 ackwatch token
160 expect 1:/test/subnode/subnode:token
161 1 waitwatch
162 1 ackwatch token
163 expect 1: waitwatch failed: Connection timed out
164 1 waitwatch
165 1 close
167 # Watch event must have happened before we registered interest.
168 1 watch / token
169 2 write /test/subnode create contents2
170 1 watch / token2 0
171 expect 1:/test/subnode:token
172 1 waitwatch
173 1 ackwatch token
174 expect 1: waitwatch failed: Connection timed out
175 1 waitwatch
176 1 close
178 # Rm fires notification on child.
179 1 watch /test/subnode token
180 2 rm /test
181 expect 1:/test/subnode:token
182 1 waitwatch
183 1 ackwatch token
185 # Watch should not double-send after we ack, even if we did something in between.
186 1 watch /test2 token
187 2 write /test2/foo create contents2
188 expect 1:/test2/foo:token
189 1 waitwatch
190 expect 1:contents2
191 1 read /test2/foo
192 1 ackwatch token
193 expect 1: waitwatch failed: Connection timed out
194 1 waitwatch