From 6a977b6416ca17fad98bb5fa68f05842c040864a Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Sat, 9 Mar 2019 13:25:04 +0000 Subject: [PATCH] backport of bpo-35704 to Python3.7 branch --- Lib/test/test_shutil.py | 13 +++++++++++++ .../Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 6e2b1004d309c9..53cc89b5d813c4 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -25,6 +25,7 @@ from test.support import TESTFN, FakePath TESTFN2 = TESTFN + "2" +AIX = sys.platform[:3] == 'aix' try: import grp @@ -84,6 +85,17 @@ def rlistdir(path): res.append(name) return res +# AIX 32-bit mode, by default, lacks enough memory for the xz/lzma compiler test +# The AIX command 'dump -o program' gives XCOFF header information +# The second word of the last line in the maxdata value +# when 32-bit maxdata must be greater than 0x1000000 for the xz test to succeed +def _maxdataOK(): + if AIX and sys.maxsize == 2147483647: + hdrs=subprocess.getoutput("/usr/bin/dump -o %s" % sys.executable) + maxdata=hdrs.split("\n")[-1].split()[1] + return int(maxdata,16) >= 0x20000000 + else: + return True class TestShutil(unittest.TestCase): @@ -1269,6 +1281,7 @@ def test_unpack_archive_bztar(self): self.check_unpack_archive('bztar') @support.requires_lzma + @unittest.skipIf(AIX and not _maxdataOK(), "AIX MAXDATA must be 0x20000000 or larger") def test_unpack_archive_xztar(self): self.check_unpack_archive('xztar') diff --git a/Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst b/Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst new file mode 100644 index 00000000000000..e36fa4ab288489 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst @@ -0,0 +1,4 @@ +Skip ``test_shutil.test_unpack_archive_xztar`` to prevent a MemoryError +on 32-bit AIX when MAXDATA setting is less than 0x20000000. + +Patch by Michael Felt (aixtools)