[Python-checkins] bpo-31904: Skip some tests of changing owner in _test_all_chown_common() on VxWorks (GH-23716)

vstinner webhook-mailer at python.org
Tue Dec 15 16:22:07 EST 2020


https://github.com/python/cpython/commit/9a0dea6137a9fe295c8b03aaa08a74c8572ecc4e
commit: 9a0dea6137a9fe295c8b03aaa08a74c8572ecc4e
branch: master
author: pxinwr <peixing.xin at windriver.com>
committer: vstinner <vstinner at python.org>
date: 2020-12-15T22:21:53+01:00
summary:

bpo-31904: Skip some tests of changing owner in _test_all_chown_common() on VxWorks (GH-23716)

files:
A Misc/NEWS.d/next/Tests/2020-12-09-15-23-28.bpo-31904.ghj38d.rst
M Lib/test/test_posix.py

diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index cd18a4972fa2c..588c86994b4bd 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -724,11 +724,20 @@ def check_stat(uid, gid):
         chown_func(first_param, uid, -1)
         check_stat(uid, gid)
 
-        if uid == 0:
+        if sys.platform == "vxworks":
+            # On VxWorks, root user id is 1 and 0 means no login user:
+            # both are super users.
+            is_root = (uid in (0, 1))
+        else:
+            is_root = (uid == 0)
+        if is_root:
             # Try an amusingly large uid/gid to make sure we handle
             # large unsigned values.  (chown lets you use any
             # uid/gid you like, even if they aren't defined.)
             #
+            # On VxWorks uid_t is defined as unsigned short. A big
+            # value greater than 65535 will result in underflow error.
+            #
             # This problem keeps coming up:
             #   http://bugs.python.org/issue1747858
             #   http://bugs.python.org/issue4591
@@ -738,7 +747,7 @@ def check_stat(uid, gid):
             # This part of the test only runs when run as root.
             # Only scary people run their tests as root.
 
-            big_value = 2**31
+            big_value = (2**31 if sys.platform != "vxworks" else 2**15)
             chown_func(first_param, big_value, big_value)
             check_stat(big_value, big_value)
             chown_func(first_param, -1, -1)
diff --git a/Misc/NEWS.d/next/Tests/2020-12-09-15-23-28.bpo-31904.ghj38d.rst b/Misc/NEWS.d/next/Tests/2020-12-09-15-23-28.bpo-31904.ghj38d.rst
new file mode 100644
index 0000000000000..654562bf407b1
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-12-09-15-23-28.bpo-31904.ghj38d.rst
@@ -0,0 +1 @@
+Skip some tests in _test_all_chown_common() on VxWorks.



More information about the Python-checkins mailing list