X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fovsdb-idl.at;h=3b4cfc8061d51382ddb81df4653945b2a8a2b890;hb=946350dce6c717af540f2bff68f1012fc8414d86;hp=9b90b032c5f837ca65e835c091df17f0b1de0a69;hpb=9cb53f2613d0194b85dddfdafc11d7193d6561e3;p=sliver-openvswitch.git diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 9b90b032c..3b4cfc806 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -1,6 +1,7 @@ AT_BANNER([OVSDB -- interface description language (IDL)]) -# OVSDB_CHECK_IDL(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS]) +# OVSDB_CHECK_IDL(TITLE, [PRE-IDL-TXN], TRANSACTIONS, OUTPUT, [KEYWORDS], +# [FILTER]) # # Creates a database with a schema derived from idltest.ovsidl, runs # each PRE-IDL-TXN (if any), starts an ovsdb-server on that database, @@ -11,7 +12,8 @@ AT_BANNER([OVSDB -- interface description language (IDL)]) # by markers of the form where N is a number. The first unique # UUID is replaced by <0>, the next by <1>, and so on. If a given # UUID appears more than once it is always replaced by the same -# marker. +# marker. If FILTER is supplied then the output is also filtered +# through the specified program. # # TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS. m4_define([OVSDB_CHECK_IDL], @@ -24,8 +26,8 @@ m4_define([OVSDB_CHECK_IDL], [AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore], [kill `cat pid`])]) AT_CHECK([test-ovsdb '-vPATTERN:console:test-ovsdb|%c|%m' -vjsonrpc -t10 idl unix:socket $3], [0], [stdout], [ignore], [kill `cat pid`]) - AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl], [0], [$4], [], - [kill `cat pid`]) + AT_CHECK([sort stdout | perl $srcdir/uuidfilt.pl]m4_if([$6],,, [[| $6]]), + [0], [$4], [], [kill `cat pid`]) OVSDB_SERVER_SHUTDOWN AT_CLEANUP]) @@ -163,8 +165,8 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL], {"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 @@ -176,6 +178,37 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL], 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", @@ -265,18 +298,20 @@ OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], "where": []}]' \ ]], [[000: empty -001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"reference to nonexistent row <1>","error":"referential integrity violation"}]} +001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"details":"Table link1 column k row <0> references nonexistent row <1> in table link1.","error":"referential integrity violation"}]} 002: {"error":null,"result":[{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}]} 003: i=1 k=1 ka=[] l2= uuid=<2> 003: i=2 k=1 ka=[] l2= uuid=<3> -004: {"error":null,"result":[{"count":2},{"details":"reference to nonexistent row <4>","error":"referential integrity violation"}]} +004: {"error":null,"result":[{"count":2},{"details":"Table link1 column k row references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} 005: {"error":null,"result":[{"count":1},{"details":"cannot delete link1 row <2> because of 1 remaining reference(s)","error":"referential integrity violation"}]} 006: {"error":null,"result":[{"count":1}]} 007: i=1 k=1 ka=[] l2= uuid=<2> 008: {"error":null,"result":[{"count":1}]} 009: empty 010: done -]]) +]], + [], + [[sed -e '/004:/s/row <[23]> references/row references/']]) OVSDB_CHECK_IDL([self-linking idl, sets], [], @@ -305,8 +340,8 @@ OVSDB_CHECK_IDL([self-linking idl, sets], '["idltest", {"op": "update", "table": "link1", - "where": [], - "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"], ["uuid", "1ac2b12e-b767-4805-a55d-43976e40c465"]]]}}]' \ + "where": [["i", "==", 2]], + "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"]]]}}]' \ '+["idltest", {"op": "delete", "table": "link1", @@ -322,7 +357,7 @@ OVSDB_CHECK_IDL([self-linking idl, sets], 004: i=1 k=0 ka=[0 1 2 3] l2= uuid=<1> 004: i=2 k=0 ka=[0 1 2 3] l2= uuid=<2> 004: i=3 k=0 ka=[0 1 2 3] l2= uuid=<3> -005: {"error":null,"result":[{"count":4},{"details":"reference to nonexistent row <4>","error":"referential integrity violation"}]} +005: {"error":null,"result":[{"count":1},{"details":"Table link1 column ka row <2> references nonexistent row <4> in table link1.","error":"referential integrity violation"}]} 006: {"error":null,"result":[{"count":4}]} 007: empty 008: done