Thx for the fix!

Since the "ERR" log is the last one, could we have this fold in?

diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
index 374be49..33772d8 100644
--- a/tests/ovs-vswitchd.at
+++ b/tests/ovs-vswitchd.at
@@ -84,7 +84,7 @@ ovs-appctl -t `pwd`/unixctl exit
 # the existing ovs-vswitchd process.
 AT_CHECK([test `grep ERR fakelog | wc -l` -eq 1])

-AT_CHECK([grep ERR fakelog | 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
 ])



Also, there is another tests added just below this one that also need this
fix


diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
index 374be49..4e7206a 100644
--- a/tests/ovs-vswitchd.at
+++ b/tests/ovs-vswitchd.at
@@ -84,7 +84,7 @@ ovs-appctl -t `pwd`/unixctl exit
 # the existing ovs-vswitchd process.
 AT_CHECK([test `grep ERR fakelog | wc -l` -eq 1])

-AT_CHECK([grep ERR fakelog | 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
 ])

@@ -96,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
@@ -115,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



Acked-by: Alex Wang <[email protected]>


On Mon, Oct 6, 2014 at 10:20 AM, Gurucharan Shetty <[email protected]>
wrote:

> 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 <[email protected]>
> ---
>  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
>
> _______________________________________________
> dev mailing list
> [email protected]
> http://openvswitch.org/mailman/listinfo/dev
>
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to