Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong
or missing the effective gid.
This commit is contained in:
parent
8166a5db5b
commit
24c3b4928e
|
@ -799,7 +799,11 @@ class PosixTester(unittest.TestCase):
|
||||||
groups = idg.read().strip()
|
groups = idg.read().strip()
|
||||||
ret = idg.close()
|
ret = idg.close()
|
||||||
|
|
||||||
if ret is not None or not groups:
|
try:
|
||||||
|
idg_groups = set(int(g) for g in groups.split())
|
||||||
|
except ValueError:
|
||||||
|
idg_groups = set()
|
||||||
|
if ret is not None or not idg_groups:
|
||||||
raise unittest.SkipTest("need working 'id -G'")
|
raise unittest.SkipTest("need working 'id -G'")
|
||||||
|
|
||||||
# Issues 16698: OS X ABIs prior to 10.6 have limits on getgroups()
|
# Issues 16698: OS X ABIs prior to 10.6 have limits on getgroups()
|
||||||
|
@ -810,12 +814,11 @@ class PosixTester(unittest.TestCase):
|
||||||
raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")
|
raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")
|
||||||
|
|
||||||
# 'id -G' and 'os.getgroups()' should return the same
|
# 'id -G' and 'os.getgroups()' should return the same
|
||||||
# groups, ignoring order and duplicates.
|
# groups, ignoring order, duplicates, and the effective gid.
|
||||||
# #10822 - it is implementation defined whether posix.getgroups()
|
# #10822/#26944 - It is implementation defined whether
|
||||||
# includes the effective gid so we include it anyway, since id -G does
|
# posix.getgroups() includes the effective gid.
|
||||||
self.assertEqual(
|
symdiff = idg_groups.symmetric_difference(posix.getgroups())
|
||||||
set([int(x) for x in groups.split()]),
|
self.assertTrue(not symdiff or symdiff == {posix.getegid()})
|
||||||
set(posix.getgroups() + [posix.getegid()]))
|
|
||||||
|
|
||||||
# tests for the posix *at functions follow
|
# tests for the posix *at functions follow
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ Build
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong or
|
||||||
|
missing the effective gid.
|
||||||
|
|
||||||
- Issue #28409: regrtest: fix the parser of command line arguments.
|
- Issue #28409: regrtest: fix the parser of command line arguments.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue