ia64/xen-unstable

view tools/xenstore/testsuite/08transaction.test @ 6946:e703abaf6e3d

Add behaviour to the remove methods to remove the transaction's path itself. This allows us to write Remove(path) to remove the specified path rather than having to slice the path ourselves.
author emellor@ewan
date Sun Sep 18 14:42:13 2005 +0100 (2005-09-18)
parents 3233e7ecfa9f
children f7a7f8f2e6e4 872cf6ee0594
line source
1 # Test transactions.
3 mkdir /test
5 # Simple transaction: create a file inside transaction.
6 1 start /test
7 1 write /test/entry1 create contents
8 2 dir /test
9 expect 1:entry1
10 1 dir /test
11 1 commit
12 expect 2:contents
13 2 read /test/entry1
15 rm /test/entry1
17 # Create a file and abort transaction.
18 1 start /test
19 1 write /test/entry1 create contents
20 2 dir /test
21 expect 1:entry1
22 1 dir /test
23 1 abort
24 2 dir /test
26 write /test/entry1 create contents
27 # Delete in transaction, commit
28 1 start /test
29 1 rm /test/entry1
30 expect 2:entry1
31 2 dir /test
32 1 dir /test
33 1 commit
34 2 dir /test
36 # Delete in transaction, abort.
37 write /test/entry1 create contents
38 1 start /test
39 1 rm /test/entry1
40 expect 2:entry1
41 2 dir /test
42 1 dir /test
43 1 abort
44 expect 2:entry1
45 2 dir /test
47 # Events inside transactions don't trigger watches until (successful) commit.
48 mkdir /test/dir
49 1 watch /test token
50 2 start /test
51 2 mkdir /test/dir/sub
52 expect 1: waitwatch failed: Connection timed out
53 1 waitwatch
54 2 close
55 1 close
57 1 watch /test token
58 2 start /test
59 2 mkdir /test/dir/sub
60 2 abort
61 expect 1: waitwatch failed: Connection timed out
62 1 waitwatch
63 1 close
65 1 watch /test token
66 2 start /test
67 2 mkdir /test/dir/sub
68 2 commit
69 expect 1:/test/dir/sub:token
70 1 waitwatch
71 1 ackwatch token
72 1 close
74 # Rm inside transaction works like rm outside: children get notified.
75 1 watch /test/dir/sub token
76 2 start /test
77 2 rm /test/dir
78 2 commit
79 expect 1:/test/dir/sub:token
80 1 waitwatch
81 1 ackwatch token
82 1 close
84 # Multiple events from single transaction don't trigger assert
85 1 watch /test token
86 2 start /test
87 2 write /test/1 create contents
88 2 write /test/2 create contents
89 2 commit
90 expect 1:/test/1:token
91 1 waitwatch
92 1 ackwatch token
93 expect 1:/test/2:token
94 1 waitwatch
95 1 ackwatch token
96 1 close