]>
Commit | Line | Data |
---|---|---|
41709ccc | 1 | AT_BANNER([OVSDB -- logging]) |
f85f8ebb BP |
2 | |
3 | AT_SETUP([create empty, reread]) | |
41709ccc BP |
4 | AT_KEYWORDS([ovsdb log]) |
5 | AT_CAPTURE_FILE([log]) | |
7c126fbb | 6 | AT_CHECK( |
7446f148 | 7 | [test-ovsdb log-io file create], [0], |
f85f8ebb BP |
8 | [file: open successful |
9 | ], [ignore]) | |
7c126fbb | 10 | AT_CHECK( |
7446f148 | 11 | [test-ovsdb log-io file read-only read], [0], |
f85f8ebb | 12 | [file: open successful |
41709ccc | 13 | file: read: end of log |
f85f8ebb BP |
14 | ], [ignore]) |
15 | AT_CHECK([test -f .file.~lock~]) | |
16 | AT_CLEANUP | |
17 | ||
18 | AT_SETUP([write one, reread]) | |
41709ccc | 19 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 20 | AT_CAPTURE_FILE([file]) |
7c126fbb | 21 | AT_CHECK( |
7446f148 | 22 | [[test-ovsdb log-io file create 'write:[0]']], [0], |
f85f8ebb BP |
23 | [[file: open successful |
24 | file: write:[0] successful | |
25 | ]], [ignore]) | |
7c126fbb | 26 | AT_CHECK( |
7446f148 | 27 | [test-ovsdb log-io file read-only read read], [0], |
f85f8ebb BP |
28 | [[file: open successful |
29 | file: read: [0] | |
41709ccc | 30 | file: read: end of log |
f85f8ebb BP |
31 | ]], [ignore]) |
32 | AT_CHECK([test -f .file.~lock~]) | |
33 | AT_CLEANUP | |
34 | ||
7446f148 | 35 | AT_SETUP([check that create fails if file exists]) |
41709ccc | 36 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 37 | AT_CAPTURE_FILE([file]) |
7c126fbb | 38 | AT_CHECK( |
7446f148 | 39 | [[test-ovsdb log-io file create 'write:[1]']], [0], |
f85f8ebb BP |
40 | [[file: open successful |
41 | file: write:[1] successful | |
42 | ]], [ignore]) | |
7c126fbb | 43 | AT_CHECK( |
7446f148 | 44 | [test-ovsdb log-io file read-only read], [0], |
f85f8ebb BP |
45 | [[file: open successful |
46 | file: read: [1] | |
47 | ]], [ignore]) | |
7c126fbb | 48 | AT_CHECK( |
bc9dcfb3 | 49 | [test-ovsdb log-io file create read], [1], |
a6be657b | 50 | [], [test-ovsdb: I/O error: file: create failed (File exists) |
f85f8ebb BP |
51 | ]) |
52 | AT_CHECK([test -f .file.~lock~]) | |
53 | AT_CLEANUP | |
54 | ||
55 | AT_SETUP([write one, reread]) | |
41709ccc | 56 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 57 | AT_CAPTURE_FILE([file]) |
7c126fbb | 58 | AT_CHECK( |
7446f148 | 59 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
60 | [[file: open successful |
61 | file: write:[0] successful | |
62 | file: write:[1] successful | |
63 | file: write:[2] successful | |
64 | ]], [ignore]) | |
7c126fbb | 65 | AT_CHECK( |
7446f148 | 66 | [test-ovsdb log-io file read-only read read read read], [0], |
f85f8ebb BP |
67 | [[file: open successful |
68 | file: read: [0] | |
69 | file: read: [1] | |
70 | file: read: [2] | |
41709ccc | 71 | file: read: end of log |
f85f8ebb BP |
72 | ]], [ignore]) |
73 | AT_CHECK([test -f .file.~lock~]) | |
74 | AT_CLEANUP | |
75 | ||
76 | AT_SETUP([write one, reread, append]) | |
41709ccc | 77 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 78 | AT_CAPTURE_FILE([file]) |
7c126fbb | 79 | AT_CHECK( |
7446f148 | 80 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
81 | [[file: open successful |
82 | file: write:[0] successful | |
83 | file: write:[1] successful | |
84 | file: write:[2] successful | |
85 | ]], [ignore]) | |
7c126fbb | 86 | AT_CHECK( |
7446f148 | 87 | [[test-ovsdb log-io file read/write read read read 'write:["append"]']], [0], |
f85f8ebb BP |
88 | [[file: open successful |
89 | file: read: [0] | |
90 | file: read: [1] | |
91 | file: read: [2] | |
92 | file: write:["append"] successful | |
93 | ]], [ignore]) | |
7c126fbb | 94 | AT_CHECK( |
7446f148 | 95 | [test-ovsdb log-io file read-only read read read read read], [0], |
f85f8ebb BP |
96 | [[file: open successful |
97 | file: read: [0] | |
98 | file: read: [1] | |
99 | file: read: [2] | |
100 | file: read: ["append"] | |
41709ccc | 101 | file: read: end of log |
f85f8ebb BP |
102 | ]], [ignore]) |
103 | AT_CHECK([test -f .file.~lock~]) | |
104 | AT_CLEANUP | |
105 | ||
106 | AT_SETUP([write, reread one, overwrite]) | |
41709ccc | 107 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 108 | AT_CAPTURE_FILE([file]) |
7c126fbb | 109 | AT_CHECK( |
7446f148 | 110 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
111 | [[file: open successful |
112 | file: write:[0] successful | |
113 | file: write:[1] successful | |
114 | file: write:[2] successful | |
115 | ]], [ignore]) | |
7c126fbb | 116 | AT_CHECK( |
7446f148 | 117 | [[test-ovsdb log-io file read/write read 'write:["more data"]']], [0], |
f85f8ebb BP |
118 | [[file: open successful |
119 | file: read: [0] | |
120 | file: write:["more data"] successful | |
121 | ]], [ignore]) | |
7c126fbb | 122 | AT_CHECK( |
7446f148 | 123 | [test-ovsdb log-io file read-only read read read], [0], |
f85f8ebb BP |
124 | [[file: open successful |
125 | file: read: [0] | |
126 | file: read: ["more data"] | |
41709ccc | 127 | file: read: end of log |
f85f8ebb BP |
128 | ]], [ignore]) |
129 | AT_CHECK([test -f .file.~lock~]) | |
130 | AT_CLEANUP | |
131 | ||
132 | AT_SETUP([write, add corrupted data, read]) | |
41709ccc | 133 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 134 | AT_CAPTURE_FILE([file]) |
7c126fbb | 135 | AT_CHECK( |
7446f148 | 136 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
137 | [[file: open successful |
138 | file: write:[0] successful | |
139 | file: write:[1] successful | |
140 | file: write:[2] successful | |
141 | ]], [ignore]) | |
142 | AT_CHECK([echo 'xxx' >> file]) | |
7c126fbb | 143 | AT_CHECK( |
7446f148 | 144 | [test-ovsdb log-io file read-only read read read read], [0], |
f85f8ebb BP |
145 | [[file: open successful |
146 | file: read: [0] | |
147 | file: read: [1] | |
148 | file: read: [2] | |
149 | file: read failed: syntax error: file: parse error at offset 174 in header line "xxx" | |
150 | ]], [ignore]) | |
151 | AT_CHECK([test -f .file.~lock~]) | |
152 | AT_CLEANUP | |
153 | ||
154 | AT_SETUP([write, add corrupted data, read, overwrite]) | |
41709ccc | 155 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 156 | AT_CAPTURE_FILE([file]) |
7c126fbb | 157 | AT_CHECK( |
7446f148 | 158 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
159 | [[file: open successful |
160 | file: write:[0] successful | |
161 | file: write:[1] successful | |
162 | file: write:[2] successful | |
163 | ]], [ignore]) | |
164 | AT_CHECK([echo 'xxx' >> file]) | |
7c126fbb | 165 | AT_CHECK( |
7446f148 | 166 | [[test-ovsdb log-io file read/write read read read read 'write:[3]']], [0], |
f85f8ebb BP |
167 | [[file: open successful |
168 | file: read: [0] | |
169 | file: read: [1] | |
170 | file: read: [2] | |
171 | file: read failed: syntax error: file: parse error at offset 174 in header line "xxx" | |
172 | file: write:[3] successful | |
173 | ]], [ignore]) | |
7c126fbb | 174 | AT_CHECK( |
7446f148 | 175 | [test-ovsdb log-io file read-only read read read read read], [0], |
f85f8ebb BP |
176 | [[file: open successful |
177 | file: read: [0] | |
178 | file: read: [1] | |
179 | file: read: [2] | |
180 | file: read: [3] | |
41709ccc | 181 | file: read: end of log |
f85f8ebb BP |
182 | ]], [ignore]) |
183 | AT_CHECK([test -f .file.~lock~]) | |
184 | AT_CLEANUP | |
185 | ||
186 | AT_SETUP([write, corrupt some data, read, overwrite]) | |
41709ccc | 187 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 188 | AT_CAPTURE_FILE([file]) |
7c126fbb | 189 | AT_CHECK( |
7446f148 | 190 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
191 | [[file: open successful |
192 | file: write:[0] successful | |
193 | file: write:[1] successful | |
194 | file: write:[2] successful | |
195 | ]], [ignore]) | |
196 | AT_CHECK([[sed 's/\[2]/[3]/' < file > file.tmp]]) | |
197 | AT_CHECK([mv file.tmp file]) | |
198 | AT_CHECK([[grep -c '\[3]' file]], [0], [1 | |
199 | ]) | |
7c126fbb | 200 | AT_CHECK( |
7446f148 | 201 | [[test-ovsdb log-io file read/write read read read 'write:["longer data"]']], [0], |
f85f8ebb BP |
202 | [[file: open successful |
203 | file: read: [0] | |
204 | file: read: [1] | |
205 | file: read failed: syntax error: file: 4 bytes starting at offset 170 have SHA-1 hash 5c031e5c0d3a9338cc127ebe40bb2748b6a67e78 but should have hash 98f55556e7ffd432381b56a19bd485b3e6446442 | |
206 | file: write:["longer data"] successful | |
207 | ]], [ignore]) | |
7c126fbb | 208 | AT_CHECK( |
7446f148 | 209 | [test-ovsdb log-io file read-only read read read read], [0], |
f85f8ebb BP |
210 | [[file: open successful |
211 | file: read: [0] | |
212 | file: read: [1] | |
213 | file: read: ["longer data"] | |
41709ccc | 214 | file: read: end of log |
f85f8ebb BP |
215 | ]], [ignore]) |
216 | AT_CHECK([test -f .file.~lock~]) | |
217 | AT_CLEANUP | |
218 | ||
219 | AT_SETUP([write, truncate file, read, overwrite]) | |
41709ccc | 220 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 221 | AT_CAPTURE_FILE([file]) |
7c126fbb | 222 | AT_CHECK( |
7446f148 | 223 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
224 | [[file: open successful |
225 | file: write:[0] successful | |
226 | file: write:[1] successful | |
227 | file: write:[2] successful | |
228 | ]], [ignore]) | |
229 | AT_CHECK([[sed 's/\[2]/2/' < file > file.tmp]]) | |
230 | AT_CHECK([mv file.tmp file]) | |
231 | AT_CHECK([[grep -c '^2$' file]], [0], [1 | |
232 | ]) | |
7c126fbb | 233 | AT_CHECK( |
7446f148 | 234 | [[test-ovsdb log-io file read/write read read read 'write:["longer data"]']], [0], |
f85f8ebb BP |
235 | [[file: open successful |
236 | file: read: [0] | |
237 | file: read: [1] | |
fe1e967e | 238 | file: read failed: I/O error: file: error reading 4 bytes starting at offset 170 (End of file) |
f85f8ebb BP |
239 | file: write:["longer data"] successful |
240 | ]], [ignore]) | |
7c126fbb | 241 | AT_CHECK( |
7446f148 | 242 | [test-ovsdb log-io file read-only read read read read], [0], |
f85f8ebb BP |
243 | [[file: open successful |
244 | file: read: [0] | |
245 | file: read: [1] | |
246 | file: read: ["longer data"] | |
41709ccc | 247 | file: read: end of log |
f85f8ebb BP |
248 | ]], [ignore]) |
249 | AT_CHECK([test -f .file.~lock~]) | |
250 | AT_CLEANUP | |
251 | ||
252 | AT_SETUP([write bad JSON, read, overwrite]) | |
41709ccc | 253 | AT_KEYWORDS([ovsdb log]) |
f85f8ebb | 254 | AT_CAPTURE_FILE([file]) |
7c126fbb | 255 | AT_CHECK( |
7446f148 | 256 | [[test-ovsdb log-io file create 'write:[0]' 'write:[1]' 'write:[2]']], [0], |
f85f8ebb BP |
257 | [[file: open successful |
258 | file: write:[0] successful | |
259 | file: write:[1] successful | |
260 | file: write:[2] successful | |
261 | ]], [ignore]) | |
262 | AT_CHECK([[printf '%s\n%s\n' 'OVSDB JSON 5 d910b02871075d3156ec8675dfc95b7d5d640aa6' 'null' >> file]]) | |
7c126fbb | 263 | AT_CHECK( |
7446f148 | 264 | [[test-ovsdb log-io file read/write read read read read 'write:["replacement data"]']], [0], |
f85f8ebb BP |
265 | [[file: open successful |
266 | file: read: [0] | |
267 | file: read: [1] | |
268 | file: read: [2] | |
c640c04f | 269 | file: read failed: syntax error: file: 5 bytes starting at offset 228 are not valid JSON (line 0, column 4, byte 4: syntax error at beginning of input) |
f85f8ebb BP |
270 | file: write:["replacement data"] successful |
271 | ]], [ignore]) | |
7c126fbb | 272 | AT_CHECK( |
7446f148 | 273 | [test-ovsdb log-io file read-only read read read read read], [0], |
f85f8ebb BP |
274 | [[file: open successful |
275 | file: read: [0] | |
276 | file: read: [1] | |
277 | file: read: [2] | |
278 | file: read: ["replacement data"] | |
41709ccc | 279 | file: read: end of log |
f85f8ebb BP |
280 | ]], [ignore]) |
281 | AT_CHECK([test -f .file.~lock~]) | |
282 | AT_CLEANUP |