Issue #9344: Add os.getgrouplist().
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 70a47b0..438634e 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -569,6 +569,21 @@
                 os.chdir(curdir)
                 support.rmtree(base_path)
 
+    @unittest.skipUnless(hasattr(posix, 'getgrouplist'), "test needs posix.getgrouplist()")
+    @unittest.skipUnless(hasattr(pwd, 'getpwuid'), "test needs pwd.getpwuid()")
+    @unittest.skipUnless(hasattr(os, 'getuid'), "test needs os.getuid()")
+    def test_getgrouplist(self):
+        with os.popen('id -G') as idg:
+            groups = idg.read().strip()
+
+        if not groups:
+            raise unittest.SkipTest("need working 'id -G'")
+
+        self.assertEqual(
+            set([int(x) for x in groups.split()]),
+            set(posix.getgrouplist(pwd.getpwuid(os.getuid())[0],
+                pwd.getpwuid(os.getuid())[3])))
+
     @unittest.skipUnless(hasattr(os, 'getegid'), "test needs os.getegid()")
     def test_getgroups(self):
         with os.popen('id -G') as idg: