[ovs-dev] [PATCH 5/5] ofproto-dpif.at: Sprinkle --overwrite-pidfile

YAMAMOTO Takashi yamamoto at valinux.co.jp
Tue Apr 1 12:41:49 UTC 2014


>> On Mon, Mar 31, 2014 at 03:24:31PM +0900, YAMAMOTO Takashi wrote:
>>> These tests invokes ovs-ofctl monitor twice or more.
>>> Because "ovs-appctl -t ofctl exit" does not wait for the target
>>> process exit, there are chances to see the pid file from the previous
>>> incarnation.
>>> 
>>> Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
>> 
>> Good catch.
>> 
>> As an alternative, one could OVS_WAIT_UNTIL the pidfile disappears.
> 
> it sounds like a better solution.  i'll take a look.
> 
> YAMAMOTO Takashi

here's a patch.

i guess someone familiar with m4 can create
OVS_APP_EXIT_AND_WAIT(appname) macro.

YAMAMOTO Takashi

commit 7427b8bf4f2402fe132522ce8142a7d896a371c6
Author: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
Date:   Mon Mar 31 15:11:19 2014 +0900

    ofproto-dpif.at: Wait for the monitor's pidfile disappears where necessary
    
    These tests invokes ovs-ofctl monitor twice or more.
    Because "ovs-appctl -t ofctl exit" does not wait for the target
    process exit, there are chances to see the pid file from the previous
    incarnation.
    
    The way to wait for the completion of the previous incarnation was
    suggested by Ben Pfaff.
    
    Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
    Acked-by: Ben Pfaff <blp at nicira.com>

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index d2234e9..b020cf6 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -619,6 +619,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
@@ -682,6 +683,7 @@ for i in 1 2 3 ; do
     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
 done
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 ])
@@ -840,6 +842,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
@@ -860,6 +863,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
@@ -880,6 +884,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -900,6 +905,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -920,6 +926,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -940,6 +947,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
@@ -962,6 +970,7 @@ for i in 1 2 3; do
 done
 
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
@@ -981,6 +990,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1001,6 +1011,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1021,6 +1032,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1041,6 +1053,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1061,6 +1074,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1081,6 +1095,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
@@ -1101,6 +1116,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1129,6 +1145,7 @@ done
 #done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
@@ -1149,6 +1166,7 @@ for i in 1 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
@@ -1187,6 +1205,7 @@ for i in 1 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
@@ -1226,6 +1245,7 @@ done
 
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 9])
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=80:88:88:88:88:88,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=192.168.0.2,arp_op=2,arp_sha=50:54:00:00:00:05,arp_tha=00:00:00:00:00:00
@@ -1586,6 +1606,7 @@ for i in 1 2 3; do
 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])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1619,6 +1640,7 @@ for i in 1 2 3; do
 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])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1712,6 +1734,7 @@ for i in 1 2 3; do
 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])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
@@ -1749,6 +1772,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1783,6 +1807,7 @@ for i in 1 2 3; do
 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])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
@@ -1820,6 +1845,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1854,6 +1880,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
@@ -1925,6 +1952,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
@@ -1962,6 +1990,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
@@ -1996,6 +2025,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)



More information about the dev mailing list