From: Ben Pfaff Date: Thu, 28 Jan 2016 21:22:03 +0000 (-0800) Subject: tests: Avoid useless use of cat. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=38b0b29f0cd053baf5443da18d0e0e2ffe0f35c7 tests: Avoid useless use of cat. Commands like "cat file | a" can be rewritten more cheaply as "a < file". Signed-off-by: Ben Pfaff Acked-by: Jarno Rajahalme --- diff --git a/tests/dpif-netdev.at b/tests/dpif-netdev.at index b84ace06f..9abfbafe9 100644 --- a/tests/dpif-netdev.at +++ b/tests/dpif-netdev.at @@ -76,7 +76,7 @@ AT_CHECK([ovs-ofctl add-flow br0 action=normal]) AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) sleep 1 -AT_CHECK([cat ovs-vswitchd.log | grep -A 1 'miss upcall' | tail -n 1], [0], [dnl +AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) ]) AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl @@ -89,7 +89,7 @@ AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) sleep 1 -AT_CHECK([cat ovs-vswitchd.log | grep -A 1 'miss upcall' | tail -n 1], [0], [dnl +AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) ]) AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl @@ -113,7 +113,7 @@ AT_CHECK([ovs-ofctl add-flow br0 action=normal]) AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) sleep 1 -AT_CHECK([cat ovs-vswitchd.log | grep -A 1 'miss upcall' | tail -n 1], [0], [dnl +AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) ]) AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl @@ -128,7 +128,7 @@ AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) sleep 1 -AT_CHECK([cat ovs-vswitchd.log | grep -A 1 'miss upcall' | tail -n 1], [0], [dnl +AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl skb_priority(0),skb_mark(0),recirc_id(0),dp_hash(0),in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0) ]) AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index c29166e0b..a372d368a 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -3205,7 +3205,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00 @@ -3238,7 +3238,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,vlan_tci=0x0000,dl_src=40:44:44:44:00:01,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280 00000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00 @@ -3273,7 +3273,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mplsm,vlan_tci=0x0000,dl_src=40:44:44:44:00:02,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=41280 00000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00 @@ -3331,7 +3331,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63 @@ -3368,7 +3368,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63 @@ -3402,7 +3402,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:52,dl_dst=52:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63 @@ -3439,7 +3439,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:53,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63 @@ -3473,7 +3473,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63 @@ -3510,7 +3510,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63 @@ -3544,7 +3544,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63 @@ -3581,7 +3581,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63 @@ -3615,7 +3615,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) OVS_APP_EXIT_AND_WAIT(ovs-ofctl) -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63 @@ -3649,7 +3649,7 @@ done OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) ovs-appctl -t ovs-ofctl exit -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) mpls,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63 @@ -7115,7 +7115,7 @@ AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:push_vlan(vid=4,pcp=0),100 ]) -AT_CHECK([cat ovs-vswitchd.log | grep 'modify' | strip_ufid ], [0], [dnl +AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:push_vlan(vid=4,pcp=0),100 ]) OVS_VSWITCHD_STOP @@ -7186,7 +7186,7 @@ recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99/0x0,pcp=7/0x0),encap(eth_ty # Check that the new flow matches the CFI bit, while both vid and pcp # are wildcarded. -AT_CHECK([cat ovs-vswitchd.log | grep '\(modify\)\|\(flow_add\)' | strip_ufid ], [0], [dnl +AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,vlan_tci=0x0000,dl_type=0x1234, actions:100 dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234) dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100 diff --git a/tests/ofproto.at b/tests/ofproto.at index de84030be..ea3e0734e 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -612,7 +612,7 @@ AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,comman AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=last]) AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=all]) AT_CHECK([ovs-ofctl -O OpenFlow15 -vwarn remove-buckets br0 group_id=1234,command_bucket_id=1], [1], [], [stderr]) -AT_CHECK([cat stderr | ofctl_strip], [0], [dnl +AT_CHECK([ofctl_strip < stderr], [0], [dnl OFPT_ERROR (OF1.5): OFPGMFC_UNKNOWN_BUCKET OFPT_GROUP_MOD (OF1.5): REMOVE_BUCKET command_bucket_id:1,group_id=1234 @@ -4210,7 +4210,7 @@ NXST_FLOW reply: dnl Check logs for OpenFlow trace # Prevent race. -OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_sub | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3]) +OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): NXST_FLOW reply" | wc -l` -ge 3]) AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 2923cf2dd..f26f6223c 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -2905,7 +2905,7 @@ AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLO dnl Check logs for OpenFlow trace # Prevent race. -OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_sub | test `grep -- "|vconn|DBG|unix: sent (Success): OFPST_FLOW reply" | wc -l` -ge 2]) +OVS_WAIT_UNTIL([vconn_sub < ovs-vswitchd.log | test `grep -- "|vconn|DBG|unix: sent (Success): OFPST_FLOW reply" | wc -l` -ge 2]) # AT_CHECK([sed -n "s/^.*\(|vconn|DBG|.*xid=.*:\).*$/\1/p" ovs-vswitchd.log], [0], [dnl AT_CHECK([print_vconn_debug | vconn_sub | ofctl_strip], [0], [dnl vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5): diff --git a/tests/vlog.at b/tests/vlog.at index 99565dbb6..7c1b445b8 100644 --- a/tests/vlog.at +++ b/tests/vlog.at @@ -232,7 +232,7 @@ AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ AT_CHECK([ovs-appctl -t ovsdb-server exit]) # A default facility of LOG_LOCAL0 while writing to file. -AT_CHECK([cat ovsdb-server.log | head -1 | awk '{print $1}'], [0], [<133>1 +AT_CHECK([head -1 ovsdb-server.log | awk '{print $1}'], [0], [<133>1 ]) rm ovsdb-server.log @@ -240,7 +240,7 @@ AT_CHECK([ovsdb-server --detach --no-chdir --pidfile \ --remote=punix:$OVS_RUNDIR/db.sock -vPATTERN:file:"<%B>1 %A %m" \ -vFACILITY:daemon --log-file], [0], [], [stderr]) -AT_CHECK([cat ovsdb-server.log | head -1 | awk '{print $1}'], [0], [<29>1 +AT_CHECK([head -1 ovsdb-server.log | awk '{print $1}'], [0], [<29>1 ]) AT_CHECK([ovs-appctl -t ovsdb-server vlog/set FACILITY:invalid], [2], [], @@ -252,7 +252,7 @@ AT_CHECK([ovs-appctl -t ovsdb-server vlog/set FACILITY:local7]) AT_CHECK([ovs-appctl -t ovsdb-server vlog/set ANY:file:DBG]) AT_CHECK([ovs-appctl -t ovsdb-server exit]) -AT_CHECK([cat ovsdb-server.log | tail -1 | awk '{print $1}'], [0], [<191>1 +AT_CHECK([tail -1 ovsdb-server.log | awk '{print $1}'], [0], [<191>1 ]) AT_CLEANUP