From 3e8ee3310d4c08d46ba11d456dd401b068106b3c Mon Sep 17 00:00:00 2001 From: Gurucharan Shetty Date: Mon, 6 Oct 2014 10:04:26 -0700 Subject: [PATCH] ovs-vswitchd.at: Port tests to run successfully on Windows. It is a little tricky to implement "$!" with unit tests on Windows. This commit changes the tests so that it works both on Windows and Linux. Signed-off-by: Gurucharan Shetty Acked-by: Alex Wang --- tests/ovs-vswitchd.at | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at index ed6a087a3..d3120f7c4 100644 --- a/tests/ovs-vswitchd.at +++ b/tests/ovs-vswitchd.at @@ -72,27 +72,19 @@ 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 +AT_CHECK([tail -n1 fakelog | sed -e 's/^.*ERR|//; s/pid [[0-9]]*//'], [0], [dnl another ovs-vswitchd process is running, disabling this process () until it goes away ]) @@ -104,8 +96,7 @@ AT_SETUP([ovs-vswitchd -- switch over to another ovs-vswitchd process]) OVS_VSWITCHD_START # start a new ovs-vswitchd process. -ovs-vswitchd --log-file=fakelog --enable-dummy & -pid=`echo $!` +ovs-vswitchd --log-file=fakelog --enable-dummy --unixctl="`pwd`"/unixctl & # sleep for a while. sleep 5 @@ -123,14 +114,13 @@ bridge br0: using datapath ID ]) # stop the process. -kill $pid +ovs-appctl -t `pwd`/unixctl exit # check the fakelog, should not see WARN/ERR/EMER log other than the one # for reporting the existing ovs-vswitchd process and the one for killing # the process. AT_CHECK([sed -n " /|ERR|another ovs-vswitchd process is running/d -/|WARN|terminating with signal/d /|WARN|/p /|ERR|/p /|EMER|/p" fakelog -- 2.20.1