netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / tests / ovsdb-query.at
1 AT_BANNER([OVSDB -- queries])
2
3 OVSDB_CHECK_POSITIVE([queries on scalars],
4   [[query \
5     '{"columns":
6         {"i": {"type": "integer"},
7          "r": {"type": "real"},
8          "b": {"type": "boolean"},
9          "s": {"type": "string"},
10          "u": {"type": "uuid"}}}' \
11     '[{"i": 0,
12        "r": 0.5,
13        "b": true,
14        "s": "a",
15        "u": ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]},
16       {"i": 1,
17        "r": 1.5,
18        "b": false,
19        "s": "b",
20        "u": ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]},
21       {"i": 2,
22        "r": 2.5,
23        "b": true,
24        "s": "c",
25        "u": ["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]},
26       {"i": 3,
27        "r": 3.5,
28        "b": false,
29        "s": "d",
30        "u": ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]},
31       {"i": 4,
32        "r": 4.5,
33        "b": true,
34        "s": "e",
35        "u": ["uuid", "4a5127e2-0256-4a72-a7dc-6246213967c7"]}]' \
36     '[[],
37       [["i", "==", 0]],
38       [["i", "!=", 1]],
39       [["i", "<", 2]],
40       [["i", "<=", 3]],
41       [["i", ">", 2]],
42       [["i", ">=", 4]],
43       [["i", "includes", 3]],
44       [["i", "excludes", 2]],
45       [["r", "==", 0.5]],
46       [["r", "!=", 1.5]],
47       [["r", "<", 2.5]],
48       [["r", "<=", 3.5]],
49       [["r", ">", 4.5]],
50       [["r", ">=", 5.5]],
51       [["r", "includes", 1]],
52       [["r", "excludes", 3]],
53       [["b", "==", true]],
54       [["b", "!=", true]],
55       [["b", "includes", false]],
56       [["b", "excludes", true]],
57       [["s", "==", "a"]],
58       [["s", "!=", "b"]],
59       [["s", "includes", "c"]],
60       [["s", "excludes", "d"]],
61       [["u", "==", ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]],
62       [["u", "!=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]],
63       [["u", "includes",["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]]]]']],
64   [dnl
65 query  0: 11111
66 query  1: 1----
67 query  2: 1-111
68 query  3: 11---
69 query  4: 1111-
70 query  5: ---11
71 query  6: ----1
72 query  7: ---1-
73 query  8: 11-11
74 query  9: 1----
75 query 10: 1-111
76 query 11: 11---
77 query 12: 1111-
78 query 13: -----
79 query 14: -----
80 query 15: -----
81 query 16: 11111
82 query 17: 1-1-1
83 query 18: -1-1-
84 query 19: -1-1-
85 query 20: -1-1-
86 query 21: 1----
87 query 22: 1-111
88 query 23: --1--
89 query 24: 111-1
90 query 25: 1----
91 query 26: 1-111
92 query 27: --1--],
93   [query])
94
95 OVSDB_CHECK_POSITIVE([queries on sets],
96   [[query \
97     '{"columns": {"i": {"type": {"key": "integer", "min": 0, "max": "unlimited"}}}}' \
98     '[{"i": ["set", []]},
99       {"i": ["set", [0]]},
100       {"i": ["set", [1]]},
101       {"i": ["set", [0, 1]]},
102       {"i": ["set", [2]]},
103       {"i": ["set", [2, 0]]},
104       {"i": ["set", [2, 1]]},
105       {"i": ["set", [2, 1, 0]]}]' \
106     '[[],
107       [["i", "==", ["set", []]]],
108       [["i", "==", ["set", [0]]]],
109       [["i", "==", ["set", [1]]]],
110       [["i", "==", ["set", [0, 1]]]],
111       [["i", "==", ["set", [2]]]],
112       [["i", "==", ["set", [2, 0]]]],
113       [["i", "==", ["set", [2, 1]]]],
114       [["i", "==", ["set", [2, 1, 0]]]],
115       [["i", "!=", ["set", []]]],
116       [["i", "!=", ["set", [0]]]],
117       [["i", "!=", ["set", [1]]]],
118       [["i", "!=", ["set", [0, 1]]]],
119       [["i", "!=", ["set", [2]]]],
120       [["i", "!=", ["set", [2, 0]]]],
121       [["i", "!=", ["set", [2, 1]]]],
122       [["i", "!=", ["set", [2, 1, 0]]]],
123       [["i", "includes", ["set", []]]],
124       [["i", "includes", ["set", [0]]]],
125       [["i", "includes", ["set", [1]]]],
126       [["i", "includes", ["set", [0, 1]]]],
127       [["i", "includes", ["set", [2]]]],
128       [["i", "includes", ["set", [2, 0]]]],
129       [["i", "includes", ["set", [2, 1]]]],
130       [["i", "includes", ["set", [2, 1, 0]]]],
131       [["i", "excludes", ["set", []]]],
132       [["i", "excludes", ["set", [0]]]],
133       [["i", "excludes", ["set", [1]]]],
134       [["i", "excludes", ["set", [0, 1]]]],
135       [["i", "excludes", ["set", [2]]]],
136       [["i", "excludes", ["set", [2, 0]]]],
137       [["i", "excludes", ["set", [2, 1]]]],
138       [["i", "excludes", ["set", [2, 1, 0]]]]]']],
139   [dnl
140 query  0: 11111 111
141 query  1: 1---- ---
142 query  2: -1--- ---
143 query  3: --1-- ---
144 query  4: ---1- ---
145 query  5: ----1 ---
146 query  6: ----- 1--
147 query  7: ----- -1-
148 query  8: ----- --1
149 query  9: -1111 111
150 query 10: 1-111 111
151 query 11: 11-11 111
152 query 12: 111-1 111
153 query 13: 1111- 111
154 query 14: 11111 -11
155 query 15: 11111 1-1
156 query 16: 11111 11-
157 query 17: 11111 111
158 query 18: -1-1- 1-1
159 query 19: --11- -11
160 query 20: ---1- --1
161 query 21: ----1 111
162 query 22: ----- 1-1
163 query 23: ----- -11
164 query 24: ----- --1
165 query 25: 11111 111
166 query 26: 1-1-1 -1-
167 query 27: 11--1 1--
168 query 28: 1---1 ---
169 query 29: 1111- ---
170 query 30: 1-1-- ---
171 query 31: 11--- ---
172 query 32: 1---- ---], [query])
173
174 # This is the same as the "set" test except that it adds values,
175 # all of which always match.
176 OVSDB_CHECK_POSITIVE([queries on maps (1)],
177   [[query \
178     '{"columns": {"i": {"type": {"key": "integer",
179                                  "value": "boolean",
180                                  "min": 0,
181                                  "max": "unlimited"}}}}' \
182     '[{"i": ["map", []]},
183       {"i": ["map", [[0, true]]]},
184       {"i": ["map", [[1, false]]]},
185       {"i": ["map", [[0, true], [1, false]]]},
186       {"i": ["map", [[2, true]]]},
187       {"i": ["map", [[2, true], [0, true]]]},
188       {"i": ["map", [[2, true], [1, false]]]},
189       {"i": ["map", [[2, true], [1, false], [0, true]]]}]' \
190     '[[],
191       [["i", "==", ["map", []]]],
192       [["i", "==", ["map", [[0, true]]]]],
193       [["i", "==", ["map", [[1, false]]]]],
194       [["i", "==", ["map", [[0, true], [1, false]]]]],
195       [["i", "==", ["map", [[2, true]]]]],
196       [["i", "==", ["map", [[2, true], [0, true]]]]],
197       [["i", "==", ["map", [[2, true], [1, false]]]]],
198       [["i", "==", ["map", [[2, true], [1, false], [0, true]]]]],
199       [["i", "!=", ["map", []]]],
200       [["i", "!=", ["map", [[0, true]]]]],
201       [["i", "!=", ["map", [[1, false]]]]],
202       [["i", "!=", ["map", [[0, true], [1, false]]]]],
203       [["i", "!=", ["map", [[2, true]]]]],
204       [["i", "!=", ["map", [[2, true], [0, true]]]]],
205       [["i", "!=", ["map", [[2, true], [1, false]]]]],
206       [["i", "!=", ["map", [[2, true], [1, false], [0, true]]]]],
207       [["i", "includes", ["map", []]]],
208       [["i", "includes", ["map", [[0, true]]]]],
209       [["i", "includes", ["map", [[1, false]]]]],
210       [["i", "includes", ["map", [[0, true], [1, false]]]]],
211       [["i", "includes", ["map", [[2, true]]]]],
212       [["i", "includes", ["map", [[2, true], [0, true]]]]],
213       [["i", "includes", ["map", [[2, true], [1, false]]]]],
214       [["i", "includes", ["map", [[2, true], [1, false], [0, true]]]]],
215       [["i", "excludes", ["map", []]]],
216       [["i", "excludes", ["map", [[0, true]]]]],
217       [["i", "excludes", ["map", [[1, false]]]]],
218       [["i", "excludes", ["map", [[0, true], [1, false]]]]],
219       [["i", "excludes", ["map", [[2, true]]]]],
220       [["i", "excludes", ["map", [[2, true], [0, true]]]]],
221       [["i", "excludes", ["map", [[2, true], [1, false]]]]],
222       [["i", "excludes", ["map", [[2, true], [1, false], [0, true]]]]]]']],
223   [dnl
224 query  0: 11111 111
225 query  1: 1---- ---
226 query  2: -1--- ---
227 query  3: --1-- ---
228 query  4: ---1- ---
229 query  5: ----1 ---
230 query  6: ----- 1--
231 query  7: ----- -1-
232 query  8: ----- --1
233 query  9: -1111 111
234 query 10: 1-111 111
235 query 11: 11-11 111
236 query 12: 111-1 111
237 query 13: 1111- 111
238 query 14: 11111 -11
239 query 15: 11111 1-1
240 query 16: 11111 11-
241 query 17: 11111 111
242 query 18: -1-1- 1-1
243 query 19: --11- -11
244 query 20: ---1- --1
245 query 21: ----1 111
246 query 22: ----- 1-1
247 query 23: ----- -11
248 query 24: ----- --1
249 query 25: 11111 111
250 query 26: 1-1-1 -1-
251 query 27: 11--1 1--
252 query 28: 1---1 ---
253 query 29: 1111- ---
254 query 30: 1-1-- ---
255 query 31: 11--- ---
256 query 32: 1---- ---], [query])
257
258 # This is the same as the "set" test except that it adds values,
259 # and those values don't always match.
260 OVSDB_CHECK_POSITIVE([queries on maps (2)],
261   [[query \
262     '{"columns": {"i": {"type": {"key": "integer",
263                                  "value": "boolean",
264                                  "min": 0,
265                                  "max": "unlimited"}}}}' \
266     '[{"i": ["map", []]},
267       {"i": ["map", [[0, true]]]},
268       {"i": ["map", [[0, false]]]},
269       {"i": ["map", [[1, false]]]},
270       {"i": ["map", [[1, true]]]},
271
272       {"i": ["map", [[0, true], [1, false]]]},
273       {"i": ["map", [[0, true], [1, true]]]},
274       {"i": ["map", [[2, true]]]},
275       {"i": ["map", [[2, false]]]},
276       {"i": ["map", [[2, true], [0, true]]]},
277
278       {"i": ["map", [[2, false], [0, true]]]},
279       {"i": ["map", [[2, true], [1, false]]]},
280       {"i": ["map", [[2, true], [1, true]]]},
281       {"i": ["map", [[2, true], [1, false], [0, true]]]},
282       {"i": ["map", [[2, true], [1, false], [0, false]]]}]' \
283     '[[],
284       [["i", "==", ["map", []]]],
285       [["i", "==", ["map", [[0, true]]]]],
286       [["i", "==", ["map", [[1, false]]]]],
287       [["i", "==", ["map", [[0, true], [1, false]]]]],
288       [["i", "==", ["map", [[2, true]]]]],
289       [["i", "==", ["map", [[2, true], [0, true]]]]],
290       [["i", "==", ["map", [[2, true], [1, false]]]]],
291       [["i", "==", ["map", [[2, true], [1, false], [0, true]]]]],
292       [["i", "!=", ["map", []]]],
293       [["i", "!=", ["map", [[0, true]]]]],
294       [["i", "!=", ["map", [[1, false]]]]],
295       [["i", "!=", ["map", [[0, true], [1, false]]]]],
296       [["i", "!=", ["map", [[2, true]]]]],
297       [["i", "!=", ["map", [[2, true], [0, true]]]]],
298       [["i", "!=", ["map", [[2, true], [1, false]]]]],
299       [["i", "!=", ["map", [[2, true], [1, false], [0, true]]]]],
300       [["i", "includes", ["map", []]]],
301       [["i", "includes", ["map", [[0, true]]]]],
302       [["i", "includes", ["map", [[1, false]]]]],
303       [["i", "includes", ["map", [[0, true], [1, false]]]]],
304       [["i", "includes", ["map", [[2, true]]]]],
305       [["i", "includes", ["map", [[2, true], [0, true]]]]],
306       [["i", "includes", ["map", [[2, true], [1, false]]]]],
307       [["i", "includes", ["map", [[2, true], [1, false], [0, true]]]]],
308       [["i", "excludes", ["map", []]]],
309       [["i", "excludes", ["map", [[0, true]]]]],
310       [["i", "excludes", ["map", [[1, false]]]]],
311       [["i", "excludes", ["map", [[0, true], [1, false]]]]],
312       [["i", "excludes", ["map", [[2, true]]]]],
313       [["i", "excludes", ["map", [[2, true], [0, true]]]]],
314       [["i", "excludes", ["map", [[2, true], [1, false]]]]],
315       [["i", "excludes", ["map", [[2, true], [1, false], [0, true]]]]]]']],
316   [dnl
317 query  0: 11111 11111 11111
318 query  1: 1---- ----- -----
319 query  2: -1--- ----- -----
320 query  3: ---1- ----- -----
321 query  4: ----- 1---- -----
322 query  5: ----- --1-- -----
323 query  6: ----- ----1 -----
324 query  7: ----- ----- -1---
325 query  8: ----- ----- ---1-
326 query  9: -1111 11111 11111
327 query 10: 1-111 11111 11111
328 query 11: 111-1 11111 11111
329 query 12: 11111 -1111 11111
330 query 13: 11111 11-11 11111
331 query 14: 11111 1111- 11111
332 query 15: 11111 11111 1-111
333 query 16: 11111 11111 111-1
334 query 17: 11111 11111 11111
335 query 18: -1--- 11--1 1--1-
336 query 19: ---1- 1---- -1-11
337 query 20: ----- 1---- ---1-
338 query 21: ----- --1-1 -1111
339 query 22: ----- ----1 ---1-
340 query 23: ----- ----- -1-11
341 query 24: ----- ----- ---1-
342 query 25: 11111 11111 11111
343 query 26: 1-111 --11- -11-1
344 query 27: 111-1 -1111 1-1--
345 query 28: 1-1-1 --11- --1--
346 query 29: 11111 11-1- 1----
347 query 30: 1-111 ---1- -----
348 query 31: 111-1 -1-1- 1----
349 query 32: 1-1-1 ---1- -----], [query])
350
351 OVSDB_CHECK_POSITIVE([UUID-distinct queries on scalars],
352   [[query-distinct \
353     '{"columns":
354         {"i": {"type": "integer"},
355          "r": {"type": "real"},
356          "b": {"type": "boolean"},
357          "s": {"type": "string"},
358          "u": {"type": "uuid"}}}' \
359     '[{"i": 0,
360        "r": 0.5,
361        "b": true,
362        "s": "a",
363        "u": ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]},
364       {"i": 1,
365        "r": 1.5,
366        "b": false,
367        "s": "b",
368        "u": ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]},
369       {"i": 2,
370        "r": 2.5,
371        "b": true,
372        "s": "c",
373        "u": ["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]},
374       {"i": 3,
375        "r": 3.5,
376        "b": false,
377        "s": "d",
378        "u": ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]},
379       {"i": 4,
380        "r": 4.5,
381        "b": true,
382        "s": "e",
383        "u": ["uuid", "4a5127e2-0256-4a72-a7dc-6246213967c7"]}]' \
384     '[[],
385       [["i", "==", 0]],
386       [["i", "!=", 1]],
387       [["i", "<", 2]],
388       [["i", "<=", 3]],
389       [["i", ">", 2]],
390       [["i", ">=", 4]],
391       [["i", "includes", 3]],
392       [["i", "excludes", 2]],
393       [["r", "==", 0.5]],
394       [["r", "!=", 1.5]],
395       [["r", "<", 2.5]],
396       [["r", "<=", 3.5]],
397       [["r", ">", 4.5]],
398       [["r", ">=", 5.5]],
399       [["r", "includes", 1]],
400       [["r", "excludes", 3]],
401       [["b", "==", true]],
402       [["b", "!=", true]],
403       [["b", "includes", false]],
404       [["b", "excludes", true]],
405       [["s", "==", "a"]],
406       [["s", "!=", "b"]],
407       [["s", "includes", "c"]],
408       [["s", "excludes", "d"]],
409       [["u", "==", ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]],
410       [["u", "!=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]],
411       [["u", "includes",["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]]]]' \
412     '["_uuid"]']],
413   [dnl
414 query  0: abcde
415 query  1: a----
416 query  2: a-cde
417 query  3: ab---
418 query  4: abcd-
419 query  5: ---de
420 query  6: ----e
421 query  7: ---d-
422 query  8: ab-de
423 query  9: a----
424 query 10: a-cde
425 query 11: ab---
426 query 12: abcd-
427 query 13: -----
428 query 14: -----
429 query 15: -----
430 query 16: abcde
431 query 17: a-c-e
432 query 18: -b-d-
433 query 19: -b-d-
434 query 20: -b-d-
435 query 21: a----
436 query 22: a-cde
437 query 23: --c--
438 query 24: abc-e
439 query 25: a----
440 query 26: a-cde
441 query 27: --c--],
442   [query])
443
444 OVSDB_CHECK_POSITIVE([Boolean-distinct queries on scalars],
445   [[query-distinct \
446     '{"columns":
447         {"i": {"type": "integer"},
448          "r": {"type": "real"},
449          "b": {"type": "boolean"},
450          "s": {"type": "string"},
451          "u": {"type": "uuid"}}}' \
452     '[{"i": 0,
453        "r": 0.5,
454        "b": true,
455        "s": "a",
456        "u": ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]},
457       {"i": 1,
458        "r": 1.5,
459        "b": false,
460        "s": "b",
461        "u": ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]},
462       {"i": 2,
463        "r": 2.5,
464        "b": true,
465        "s": "c",
466        "u": ["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]},
467       {"i": 3,
468        "r": 3.5,
469        "b": false,
470        "s": "d",
471        "u": ["uuid", "62315898-64e0-40b9-b26f-ff74225303e6"]},
472       {"i": 4,
473        "r": 4.5,
474        "b": true,
475        "s": "e",
476        "u": ["uuid", "4a5127e2-0256-4a72-a7dc-6246213967c7"]}]' \
477     '[[],
478       [["i", "==", 0]],
479       [["i", "!=", 1]],
480       [["i", "<", 2]],
481       [["i", "<=", 3]],
482       [["i", ">", 2]],
483       [["i", ">=", 4]],
484       [["i", "includes", 3]],
485       [["i", "excludes", 2]],
486       [["r", "==", 0.5]],
487       [["r", "!=", 1.5]],
488       [["r", "<", 2.5]],
489       [["r", "<=", 3.5]],
490       [["r", ">", 4.5]],
491       [["r", ">=", 5.5]],
492       [["r", "includes", 1]],
493       [["r", "excludes", 3]],
494       [["b", "==", true]],
495       [["b", "!=", true]],
496       [["b", "includes", false]],
497       [["b", "excludes", true]],
498       [["s", "==", "a"]],
499       [["s", "!=", "b"]],
500       [["s", "includes", "c"]],
501       [["s", "excludes", "d"]],
502       [["u", "==", ["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]],
503       [["u", "!=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]],
504       [["u", "includes",["uuid", "ad0fa355-8b84-4a36-a4b5-b2c1bfd91758"]]]]' \
505     '["b"]']],
506   [dnl
507 query  0: ababa
508 query  1: a-a-a
509 query  2: ababa
510 query  3: ababa
511 query  4: ababa
512 query  5: ababa
513 query  6: a-a-a
514 query  7: -b-b-
515 query  8: ababa
516 query  9: a-a-a
517 query 10: ababa
518 query 11: ababa
519 query 12: ababa
520 query 13: -----
521 query 14: -----
522 query 15: -----
523 query 16: ababa
524 query 17: a-a-a
525 query 18: -b-b-
526 query 19: -b-b-
527 query 20: -b-b-
528 query 21: a-a-a
529 query 22: ababa
530 query 23: a-a-a
531 query 24: ababa
532 query 25: a-a-a
533 query 26: ababa
534 query 27: a-a-a],
535   [query])
536
537 OVSDB_CHECK_NEGATIVE([parse colunn set containing bad name],
538   [[query-distinct \
539     '{"columns": {"i": {"type": "integer"}}}' \
540     '[{"i": 0}]' \
541     '[[]]' \
542     '["i", "bad"]']],
543   [bad is not a valid column name])