Hi Guru,

please see  my comment inline.

Thanks,
Paul

From: Guru Shetty [mailto:g...@ovn.org]
Sent: Friday, August 26, 2016 8:39 PM
To: Paul Boca
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH 01/12] python tests: Skip python tests specific 
to Linux



On 26 August 2016 at 07:40, Paul Boca 
<pb...@cloudbasesolutions.com<mailto:pb...@cloudbasesolutions.com>> wrote:
There is a difference between POSIX pid and Windows pid, not all the time are 
equal.
On Windows when a python script is started, a sh command is triggered as the 
parent
for script. So when we try to get the daemon pid with 'echo $!', this will get 
the pid of sh
not of python.exe as expected.
Some tests use undefined switches, on Windows, for `kill` command.

Signed-off-by: Paul-Daniel Boca 
<pb...@cloudbasesolutions.com<mailto:pb...@cloudbasesolutions.com>>
---
 tests/daemon-py.at<http://daemon-py.at> | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/daemon-py.at<http://daemon-py.at> 
b/tests/daemon-py.at<http://daemon-py.at>
index e59c11d..99ad038 100644
--- a/tests/daemon-py.at<http://daemon-py.at>
+++ b/tests/daemon-py.at<http://daemon-py.at>
@@ -3,6 +3,8 @@ AT_BANNER([daemon unit tests - Python])
 m4_define([DAEMON_PYN],
   [AT_SETUP([daemon - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_KEYWORDS([python daemon])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([expected])
@@ -26,6 +28,8 @@ DAEMON_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_PYN],
   [AT_SETUP([daemon --monitor - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([parent])
    AT_CAPTURE_FILE([parentpid])
@@ -73,6 +77,8 @@ DAEMON_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_RESTART_PYN],
   [AT_SETUP([daemon --monitor restart exit code - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([parent])
    AT_CAPTURE_FILE([parentpid])
@@ -120,6 +126,8 @@ DAEMON_MONITOR_RESTART_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([DAEMON_DETACH_PYN],
   [AT_SETUP([daemon --detach - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, the detached process isn't visible in msys

Can you explain what the above means? Glancing at the test tells me that 
something similar works for C code. Why is python different? It may make sense 
to make this as part of a separate commit.
[Paul Boca] I wrote that explanation because I didn’t saw the PID of the child 
process in `ps`.
I debugged a little and observed that the SIGTERM handler isn’t executed on 
Windows
and I found this bug http://bugs.python.org/issue26350.
The test fails because the pid file isn’t delelted on detached process exit.
I will update that description.

+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    # Start the daemon and make sure that the pidfile exists immediately.
    # We don't wait for the pidfile to get created because the daemon is
@@ -142,6 +150,8 @@ m4_define([CHECK],
 m4_define([DAEMON_DETACH_MONITOR_PYN],
   [AT_SETUP([daemon --detach --monitor - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, uses Linux specific kill signal
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([daemon])
    AT_CAPTURE_FILE([olddaemon])
    AT_CAPTURE_FILE([newdaemon])
@@ -219,6 +229,8 @@ DAEMON_DETACH_MONITOR_ERRORS_PYN([Python3], 
[$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_DETACH_CLOSES_FDS_PYN],
   [AT_SETUP([daemon --detach closes standard fds - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, uses Linux specific kill signal
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([status])
    AT_CAPTURE_FILE([stderr])
@@ -243,6 +255,8 @@ DAEMON_DETACH_CLOSES_FDS_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN],
   [AT_SETUP([daemon --detach --monitor closes standard fds - $1])
    AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, uses Linux specific kill signal
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([status])
    AT_CAPTURE_FILE([stderr])
--
2.7.2.windows.1
_______________________________________________
dev mailing list
dev@openvswitch.org<mailto:dev@openvswitch.org>
http://openvswitch.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to