Hi Ben, I am ok with the concept and I will test it if you send a patch out.
I tried to apply the diff but it gives me: error: patch failed: tests/ovs-macros.at:37 error: tests/ovs-macros.at: patch does not apply Alin. -----Mesaj original----- De la: Ben Pfaff [mailto:b...@nicira.com] Trimis: Thursday, June 25, 2015 3:17 AM Către: Gurucharan Shetty Cc: Alin Serdean; dev@openvswitch.org Subiect: Re: [ovs-dev] [PATCH 1/3] Add OVS_VSWITCHD_STOP to bfd unit tests On Wed, Jun 24, 2015 at 07:49:08AM -0700, Gurucharan Shetty wrote: > You can look at "commit 5e65e080ad4d57e" for more information on the > exact problem with taskkill. > > One option is to check for tskill and if it does not exist, use taskkill. Here's a concept for that, it's probably buggy because I don't have a handy Windows system for testing. (The minimal change would be to just add the new bit at the beginning but I couldn't resist "improving" the rest of the code.) diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index c583c3d..7427de0 100644 --- a/tests/ovs-macros.at +++ b/tests/ovs-macros.at @@ -37,37 +37,31 @@ if test "$IS_WIN32" = "yes"; then command diff --strip-trailing-cr "$@" } + # tskill is more effective than taskkill but it isn't always installed. + if (tskill //?) >/dev/null 2>&1; then :; else + tskill () { taskkill //F //PID $1 >/dev/null; } + fi + 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 >/dev/null; then - : - else - return 1 - fi - done - return 0 - ;; - -[1-9]*) - shift - for i in $*; do - if tasklist //fi "PID eq $i" | grep $i >/dev/null; then - tskill $i - fi - done - ;; + signal= + retval=0 + for arg; do + case $arg in + -*) signal=$arg ;; [1-9][0-9]*) - for i in $*; do - if tasklist //fi "PID eq $i" | grep $i >/dev/null; then - tskill $i + # tasklist always returns 0. + # If pid does exist, there will be a line with the pid. + if tasklist //fi "PID eq $arg" | grep $arg >/dev/null; then + if test "X$signal" != "X-0"; then + tskill $arg fi - done + else + retval=1 + fi ;; - esac + esac + done + return $retval } fi ] _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev