[ovs-dev] [PATCH] ovs-vswitchd.at: Port a test to run successfully on Windows.

Gurucharan Shetty shettyg at nicira.com
Mon Oct 6 17:20:07 UTC 2014


It is a little tricky to implement "$!" with unit tests on Windows.
This commit changes the test so that it works both on Windows
and Linux.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 tests/ovs-vswitchd.at |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
index ec6030f..374be49 100644
--- a/tests/ovs-vswitchd.at
+++ b/tests/ovs-vswitchd.at
@@ -72,30 +72,22 @@ AT_SETUP([ovs-vswitchd -- start additional ovs-vswitchd process])
 OVS_VSWITCHD_START
 
 # start another ovs-vswitchd process.
-ovs-vswitchd --log-file=fakelog &
-pid=`echo $!`
+ovs-vswitchd --log-file=fakelog --unixctl="`pwd`"/unixctl &
 
 # sleep for a while
 sleep 5
 
 # stop the process.
-kill $pid
+ovs-appctl -t `pwd`/unixctl exit
 
 # check the fakelog, should only see one ERR for reporting
-# the existing ovs-vswitchd process and one WARN for killing
-# the process.
+# the existing ovs-vswitchd process.
 AT_CHECK([test `grep ERR fakelog | wc -l` -eq 1])
-AT_CHECK([test `grep WARN fakelog | wc -l` -eq 1])
 
 AT_CHECK([grep ERR fakelog | sed -e 's/^.*ERR|//; s/pid [[0-9]]*//'], [0], [dnl
 another ovs-vswitchd process is running, disabling this process () until it goes away
 ])
 
-# check the fakelog, the ERR log should be the last line.
-AT_CHECK([tail -n 2 fakelog | head -n 1 | sed -e 's/^.*ERR|//; s/pid [[0-9]]*//'], [0], [dnl
-another ovs-vswitchd process is running, disabling this process () until it goes away
-])
-
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
-- 
1.7.9.5




More information about the dev mailing list