diff mbox

[ovs-dev,V11,08/17] python tests: Skip python tests on Windows where POSIX pid is used

Message ID 1470159883-4648-9-git-send-email-pboca@cloudbasesolutions.com
State Changes Requested
Headers show

Commit Message

Paul Boca Aug. 2, 2016, 5:45 p.m. UTC
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.
Also the 'kill' command expects a POSIX pid, not the Windows pid written by the python
daemons in pid file.

Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
V2: No changes
V3: No changes
V4: No changes
V5: No changes
V6: No changes
V7: Added comments explaining why the tests are skipped.
    Enabled back the JSON-RPC tests
V8: No changes
V9: No changes
V10: No changes
V11: No changes
---
 tests/daemon-py.at | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Gurucharan Shetty Aug. 3, 2016, 3:50 p.m. UTC | #1
On 2 August 2016 at 10:45, Paul Boca <pboca@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.
> Also the 'kill' command expects a POSIX pid, not the Windows pid written
> by the python
> daemons in pid file.
>
> Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
>

I applied the patches till here.
In this change, the following comment has been added for all the tests that
are being skipped. Even those tests for which the comment is not relevant:
"Skip this test for Windows, echo $! gives shell pid instead of parent
process".

So I am skipping this. Please re-look this patch.



> ---
> V2: No changes
> V3: No changes
> V4: No changes
> V5: No changes
> V6: No changes
> V7: Added comments explaining why the tests are skipped.
>     Enabled back the JSON-RPC tests
> V8: No changes
> V9: No changes
> V10: No changes
> V11: No changes
> ---
>  tests/daemon-py.at | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/tests/daemon-py.at b/tests/daemon-py.at
> index e59c11d..b1ff4fd 100644
> --- a/tests/daemon-py.at
> +++ b/tests/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, echo $! gives shell pid instead of
> parent process
> +   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, echo $! gives shell pid instead of
> parent process
> +   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, echo $! gives shell pid instead of
> parent process
> +   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, echo $! gives shell pid instead of
> parent process
> +   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
> http://openvswitch.org/mailman/listinfo/dev
>
diff mbox

Patch

diff --git a/tests/daemon-py.at b/tests/daemon-py.at
index e59c11d..b1ff4fd 100644
--- a/tests/daemon-py.at
+++ b/tests/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, echo $! gives shell pid instead of parent process
+   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, echo $! gives shell pid instead of parent process
+   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, echo $! gives shell pid instead of parent process
+   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, echo $! gives shell pid instead of parent process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([status])
    AT_CAPTURE_FILE([stderr])