From: Gurucharan Shetty Date: Fri, 18 Apr 2014 15:24:42 +0000 (-0700) Subject: testsuite.at: kill for windows. X-Git-Tag: sliver-openvswitch-2.2.90-1~3^2~94 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b3c3eec7195a86e343b58e52601c5ab676e07a0b;p=sliver-openvswitch.git testsuite.at: kill for windows. We use kill to cleanup processes from pidfiles. Windows has a 'taskkill' which does something similar. We can check if the process with a PID exists with 'tasklist'. Both tasklist and taskkill return 0 for both success and failure. So, we will have to grep to see if there is a o/p. A typical o/p of tasklist is: $ tasklist | grep ovs ovsdb-server.exe 3228 RDP-Tcp#0 2 6,132 K ovs-vswitchd.exe 2080 RDP-Tcp#0 2 5,808 K $ tasklist //fi "PID eq 3228" Image Name PID Session Name Session# Mem Usage ========================= ======== ================ =========== ============ ovsdb-server.exe 3228 RDP-Tcp#0 2 6,132 K Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- diff --git a/tests/testsuite.at b/tests/testsuite.at index b045ae66e..85c50d137 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -46,6 +46,35 @@ if test "$IS_WIN32" = "yes"; then pwd () { command pwd -W "$@" } + + kill () { + case "$1" in + -0) + shift + for i in $*; do + # tasklist will always have return code 0. + # If pid does exist, there will be a line with the pid. + if tasklist //fi "PID eq $i" | grep $i; then + : + else + return 1 + fi + done + return 0 + ;; + -[1-9]*) + shift + for i in $*; do + taskkill //F //PID $i + done + ;; + [1-9][1-9]*) + for i in $*; do + taskkill //F //PID $i + done + ;; + esac + } fi ] m4_divert_pop([PREPARE_TESTS])