summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-06-13 14:53:01 -0700
committerBen Pfaff <blp@ovn.org>2016-06-14 16:22:15 -0700
commit4a48cdfbf19643314d4e0b9d4b4ffc2961972eb2 (patch)
treea4fa06e839281b2132f4a624d1e50e333d1f8502 /tests
parent439357632b26ef4cba7c99e1862a3c4192d5d0e2 (diff)
downloadopenvswitch-4a48cdfbf19643314d4e0b9d4b4ffc2961972eb2.tar.gz
ofp-util: Fix parsing of parenthesized values within key-value pairs.
Reported-by: james hopper <jameshopper@email.com> Reported-at: http://openvswitch.org/pipermail/discuss/2016-June/021662.html Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ofp-util.at43
-rw-r--r--tests/ofproto.at4
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/ofp-util.at b/tests/ofp-util.at
index 248faf419..700173a34 100644
--- a/tests/ofp-util.at
+++ b/tests/ofp-util.at
@@ -50,3 +50,46 @@ OFPT_HELLO (OF1.1) (xid=0x1):
version bitmap: 0x02
])
AT_CLEANUP
+
+AT_SETUP([parsing key-value pairs])
+dnl Key-only basics.
+AT_CHECK([ovs-ofctl parse-key-value a a,b 'a b' 'a b' 'a
+b'], 0, [a
+a, b
+a, b
+a, b
+a, b
+])
+
+dnl Key-value basics.
+AT_CHECK([ovs-ofctl parse-key-value a:b a=b a:b,c=d 'a=b c' 'a(b)' 'a(b),c(d)'], 0,
+[a=b
+a=b
+a=b, c=d
+a=b, c
+a=b
+a=b, c=d
+])
+
+dnl Values that contain nested delimiters.
+AT_CHECK([ovs-ofctl parse-key-value 'a:(b,c)' 'a:b(c,d)e' 'a(b,c(d,e),f)'], 0,
+[a=(b,c)
+a=b(c,d)e
+a=b,c(d,e),f
+])
+
+dnl Extraneous delimiters.
+AT_CHECK([ovs-ofctl parse-key-value a,,b ',a b' ' a b ,'], 0, [a, b
+a, b
+a, b
+])
+
+dnl Missing right parentheses.
+dnl
+dnl m4 can't handle unbalanced parentheses so we use @{:@, which
+dnl Autotest replaces by a left parenthesis.
+AT_CHECK([ovs-ofctl parse-key-value 'a@{:@b' 'a@{:@b(c)' 'a=b@{:@c'], 0, [a=b
+a=b(c)
+a=b@{:@c
+])
+AT_CLEANUP
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 1ddee4386..c89c641e0 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -783,6 +783,10 @@ OVS_VSWITCHD_START
AT_DATA([groups.txt], [dnl
group_id=1234,type=all,bucket=output:10
group_id=1235,type=all,bucket=output:10
+
+dnl This checks for regression against a parser bug such that
+dnl "actions=resbmit(,1)" etc. was rejected as a syntax error.
+group_id=2345,type=select,bucket=weight:10,actions=resubmit(,1),bucket=weight:10,actions=resubmit(,2),bucket=weight:1,actions=resubmit(,3)
])
AT_CHECK([ovs-ofctl -O OpenFlow13 -vwarn add-groups br0 groups.txt])
AT_CHECK([ovs-vsctl del-br br0])