summaryrefslogtreecommitdiff
path: root/tests/ovs-vswitchd.at
diff options
context:
space:
mode:
authorGurucharan Shetty <gshetty@nicira.com>2014-10-06 10:04:26 -0700
committerGurucharan Shetty <gshetty@nicira.com>2014-10-06 14:52:22 -0700
commit1786535e7ef76d3bd3de5b15b8f22083eb5beb7e (patch)
tree3191fa92a85d47af592b48106cd089ed29add136 /tests/ovs-vswitchd.at
parentb3fca241bc3ecde81da6f6136f3dd0f1604a7412 (diff)
downloadopenvswitch-1786535e7ef76d3bd3de5b15b8f22083eb5beb7e.tar.gz
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 <gshetty@nicira.com> Acked-by: Alex Wang <alexw@nicira.com>
Diffstat (limited to 'tests/ovs-vswitchd.at')
-rw-r--r--tests/ovs-vswitchd.at22
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
index ec6030f83..4e7206af6 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