diff options
author | Simon Horman <horms@verge.net.au> | 2014-06-13 11:40:23 +0900 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-06-13 16:20:00 -0700 |
commit | 1637ebb2e40a328a65b63cea7604d7037dda145f (patch) | |
tree | 7d11ff06559b9a7ad0b5c301440b03bdcd9543ee /tests/ofproto.at | |
parent | 8b768391b9d9ff7e4923c7475e4b05df7b29eeac (diff) | |
download | openvswitch-1637ebb2e40a328a65b63cea7604d7037dda145f.tar.gz |
ofproto: Break out perl code for sorting multiline messages
The flow monitoring tests includes a perl script to sort multiline
messages. This commit breaks it out of an individual test so that it can
be used elsewhere.
Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com changed approach from a separate file to a shell function]
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests/ofproto.at')
-rw-r--r-- | tests/ofproto.at | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/tests/ofproto.at b/tests/ofproto.at index bd9c3af86..f1c177437 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -2097,6 +2097,28 @@ OFPT_BARRIER_REPLY (OF1.2): OVS_VSWITCHD_STOP AT_CLEANUP +m4_divert_push([PREPARE_TESTS]) +# Sorts groups of lines that start with a space, without moving them +# past the nearest line that does not start with a space. +multiline_sort () { + ${PERL} -e ' + use warnings; + use strict; + my @buffer = (); + while (<STDIN>) { + if (/^ /) { + push(@buffer, $_); + } else { + print $_ foreach sort(@buffer); + print $_; + @buffer = (); + } + } + print $_ foreach sort(@buffer); +' +} +m4_divert_pop([PREPARE_TESTS]) + AT_SETUP([ofproto - flow monitoring]) AT_KEYWORDS([monitor]) OVS_VSWITCHD_START @@ -2140,24 +2162,7 @@ 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 -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 (<STDIN>) { - 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], +AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | multiline_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): |