Skip to content

Commit ef110b1

Browse files
aixtoolsmiss-islington
authored andcommitted
bpo-35704: Prevent test_shutil fail result when AIX is 32-bit and MAXDATA < 0x20000000 (GH-11500)
https://bugs.python.org/issue35704
1 parent 09fbcd6 commit ef110b1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Lib/test/test_shutil.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
TESTFN2 = TESTFN + "2"
3636
MACOS = sys.platform.startswith("darwin")
37+
AIX = sys.platform[:3] == 'aix'
3738
try:
3839
import grp
3940
import pwd
@@ -141,6 +142,17 @@ def supports_file2file_sendfile():
141142

142143
SUPPORTS_SENDFILE = supports_file2file_sendfile()
143144

145+
# AIX 32-bit mode, by default, lacks enough memory for the xz/lzma compiler test
146+
# The AIX command 'dump -o program' gives XCOFF header information
147+
# The second word of the last line in the maxdata value
148+
# when 32-bit maxdata must be greater than 0x1000000 for the xz test to succeed
149+
def _maxdataOK():
150+
if AIX and sys.maxsize == 2147483647:
151+
hdrs=subprocess.getoutput("/usr/bin/dump -o %s" % sys.executable)
152+
maxdata=hdrs.split("\n")[-1].split()[1]
153+
return int(maxdata,16) >= 0x20000000
154+
else:
155+
return True
144156

145157
class TestShutil(unittest.TestCase):
146158

@@ -1351,6 +1363,7 @@ def test_unpack_archive_bztar(self):
13511363
self.check_unpack_archive('bztar')
13521364

13531365
@support.requires_lzma
1366+
@unittest.skipIf(AIX and not _maxdataOK(), "AIX MAXDATA must be 0x20000000 or larger")
13541367
def test_unpack_archive_xztar(self):
13551368
self.check_unpack_archive('xztar')
13561369

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add PermissionError to the Exception: list
2+
patch by Michael Felt, aixtools

0 commit comments

Comments
 (0)