{"op": "insert",
"table": "simple",
"row": {}}]']],
- [['set 0 b 1, set 1 r 3.5' \
- 'insert 2, delete 1']],
+ [['verify 0 b, verify 1 r, set 0 b 1, set 1 r 3.5' \
+ 'insert 2, verify 2 i, verify 1 b, delete 1']],
[[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
000: i=1 r=2 b=true s=mystring u=<2> ia=[1 2 3] ra=[-0.5] ba=[false true] sa=[abc def] ua=[<3> <4>] uuid=<5>
001: commit, status=success
005: done
]])
+OVSDB_CHECK_IDL([simple idl, handling verification failure],
+ [['["idltest",
+ {"op": "insert",
+ "table": "simple",
+ "row": {"i": 1,
+ "r": 2.0}},
+ {"op": "insert",
+ "table": "simple",
+ "row": {}}]']],
+ [['set 0 b 1' \
+ '+["idltest",
+ {"op": "update",
+ "table": "simple",
+ "where": [["i", "==", 1]],
+ "row": {"r": 5.0}}]' \
+ '+verify 1 r, set 1 r 3' \
+ 'verify 1 r, set 1 r 3' \
+ ]],
+ [[000: i=0 r=0 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
+000: i=1 r=2 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
+001: commit, status=success
+002: {"error":null,"result":[{"count":1}]}
+003: commit, status=try again
+004: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
+004: i=1 r=5 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
+005: commit, status=success
+006: i=0 r=0 b=true s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
+006: i=1 r=3 b=false s= u=<0> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<2>
+007: done
+]])
+
OVSDB_CHECK_IDL([simple idl, increment operation],
[['["idltest",
{"op": "insert",
"i=%d", atoi(arg1));
}
idltest_simple_delete(s);
+ } else if (!strcmp(name, "verify")) {
+ const struct idltest_simple *s;
+
+ if (!arg2 || arg3) {
+ ovs_fatal(0, "\"verify\" command requires 2 arguments");
+ }
+
+ s = idltest_find_simple(idl, atoi(arg1));
+ if (!s) {
+ ovs_fatal(0, "\"verify\" command asks for nonexistent "
+ "i=%d", atoi(arg1));
+ }
+
+ if (!strcmp(arg2, "i")) {
+ idltest_simple_verify_i(s);
+ } else if (!strcmp(arg2, "b")) {
+ idltest_simple_verify_b(s);
+ } else if (!strcmp(arg2, "s")) {
+ idltest_simple_verify_s(s);
+ } else if (!strcmp(arg2, "u")) {
+ idltest_simple_verify_s(s);
+ } else if (!strcmp(arg2, "r")) {
+ idltest_simple_verify_r(s);
+ } else {
+ ovs_fatal(0, "\"verify\" command asks for unknown column %s",
+ arg2);
+ }
} else if (!strcmp(name, "increment")) {
if (!arg2 || arg3) {
- ovs_fatal(0, "\"set\" command requires 2 arguments");
+ ovs_fatal(0, "\"increment\" command requires 2 arguments");
}
ovsdb_idl_txn_increment(txn, arg1, arg2, NULL);
increment = true;