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

Paul Boca pboca at cloudbasesolutions.com
Fri Jul 1 16:27:00 UTC 2016


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 at cloudbasesolutions.com>
---
V2: No changes
V3: No changes
V4: No changes
V5: No changes
---
 tests/daemon-py.at  | 7 +++++++
 tests/jsonrpc-py.at | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/tests/daemon-py.at b/tests/daemon-py.at
index e59c11d..d952126 100644
--- a/tests/daemon-py.at
+++ b/tests/daemon-py.at
@@ -3,6 +3,7 @@ AT_BANNER([daemon unit tests - Python])
 m4_define([DAEMON_PYN],
   [AT_SETUP([daemon - $1])
    AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_KEYWORDS([python daemon])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([expected])
@@ -26,6 +27,7 @@ DAEMON_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_PYN],
   [AT_SETUP([daemon --monitor - $1])
    AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([parent])
    AT_CAPTURE_FILE([parentpid])
@@ -73,6 +75,7 @@ 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])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([parent])
    AT_CAPTURE_FILE([parentpid])
@@ -120,6 +123,7 @@ DAEMON_MONITOR_RESTART_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_DETACH_PYN],
   [AT_SETUP([daemon --detach - $1])
    AT_SKIP_IF([test $2 = no])
+   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 +146,7 @@ m4_define([CHECK],
 m4_define([DAEMON_DETACH_MONITOR_PYN],
   [AT_SETUP([daemon --detach --monitor - $1])
    AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([daemon])
    AT_CAPTURE_FILE([olddaemon])
    AT_CAPTURE_FILE([newdaemon])
@@ -219,6 +224,7 @@ 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])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([status])
    AT_CAPTURE_FILE([stderr])
@@ -243,6 +249,7 @@ 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])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_CAPTURE_FILE([pid])
    AT_CAPTURE_FILE([status])
    AT_CAPTURE_FILE([stderr])
diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at
index 966741d..5440b7d 100644
--- a/tests/jsonrpc-py.at
+++ b/tests/jsonrpc-py.at
@@ -3,6 +3,7 @@ AT_BANNER([JSON-RPC - Python])
 m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN],
   [AT_SETUP([JSON-RPC request and successful reply - $1])
    AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_KEYWORDS([python jsonrpc])
    AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket])
    AT_CHECK([test -s pid])
@@ -20,6 +21,7 @@ JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([JSONRPC_REQ_REPLY_ERROR_PYN],
   [AT_SETUP([JSON-RPC request and error reply - $1])
    AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_KEYWORDS([python jsonrpc])
    AT_CHECK([$PYTHON $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket])
    AT_CHECK([test -s pid])
@@ -37,6 +39,7 @@ JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([JSONRPC_NOTIFICATION_PYN],
   [AT_SETUP([JSON-RPC notification - $1])
    AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
    AT_KEYWORDS([python jsonrpc])
    AT_CHECK([$3 $srcdir/test-jsonrpc.py --detach --pidfile=`pwd`/pid listen punix:socket])
    AT_CHECK([test -s pid])
-- 
2.7.2.windows.1



More information about the dev mailing list