From: Ben Pfaff Date: Thu, 19 Jul 2012 15:42:21 +0000 (-0700) Subject: tests: Avoid hash order sensitivity in "ofproto - flow monitoring" test. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32cd83a272ab4b00ba6c167e021ebfdddf6337ec;p=openvswitch tests: Avoid hash order sensitivity in "ofproto - flow monitoring" test. The order in which flows appear in an NXST_FLOW_MONITOR reply depends on the hash order, which makes it depend on the details of the hash and on system endianness. This avoids sensitivity to the order by sorting the results. Reported-by: Simon Horman Signed-off-by: Ben Pfaff --- diff --git a/tests/ofproto.at b/tests/ofproto.at index 1135d375..2d28131b 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -779,7 +779,24 @@ ovs-ofctl mod-flows br0 cookie=5,dl_vlan=123,actions=output:3 ovs-ofctl del-flows br0 dl_vlan=123 ovs-ofctl del-flows br0 ovs-appctl -t ovs-ofctl ofctl/barrier -AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0], +sort=' + # Sorts groups of lines that start with a space, without moving them + # past the nearest line that does not start with a space. + use warnings; + use strict; + my @buffer = (); + while () { + if (/^ /) { + push(@buffer, $_); + } else { + print $_ foreach sort(@buffer); + print $_; + @buffer = (); + } + } + print $_ foreach sort(@buffer); +' +AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | perl -e "$sort"], [0], [NXST_FLOW_MONITOR reply (xid=0x0): event=ADDED table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2 NXST_FLOW_MONITOR reply (xid=0x0): @@ -829,17 +846,17 @@ NXST_FLOW_MONITOR reply (xid=0x0): event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=0 actions=output:3 event=DELETED reason=delete table=0 cookie=0x5 in_port=0,dl_vlan=123,dl_vlan_pcp=1 actions=output:3 NXST_FLOW_MONITOR reply (xid=0x0): - event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21 - event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22 + event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0 actions=output:20 + event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18 + event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=124 actions=output:2 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095 actions=output:14 + event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12 event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=1 actions=output:13 + event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=0 actions=output:21 + event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan_pcp=1 actions=output:22 event=DELETED reason=delete table=0 cookie=0 in_port=0,vlan_tci=0x0000 actions=output:11 - event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=0 actions=output:18 - event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=4095,dl_vlan_pcp=0 actions=output:12 - event=DELETED reason=delete table=0 cookie=0 in_port=0,dl_vlan=0,dl_vlan_pcp=1 actions=output:19 - event=DELETED reason=delete table=0 cookie=0 in_port=0 actions=output:23 OFPT_BARRIER_REPLY: ])