From 90eed4a1f23d801ac2c07cd8f1c89bbd5dfb502f Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Thu, 3 Jan 2019 17:10:45 +0000 Subject: [PATCH 1/4] Fix test error introduced by bpo-35189 --- Lib/test/eintrdata/eintr_tester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index 25c169bde5005f5..6aa902564b73514 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -507,7 +507,7 @@ def _lock(self, lock_func, lock_name): lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB) lock_func(f, fcntl.LOCK_UN) time.sleep(0.01) - except BlockingIOError: + except (BlockingIOError, PermissionError): break # the child locked the file just a moment ago for 'sleep_time' seconds # that means that the lock below will block for 'sleep_time' minus some From 20d9d5a8d81549d0f989eab36a25f1d7a5309e74 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Tue, 8 Jan 2019 22:11:31 +0000 Subject: [PATCH 2/4] Add NEWS blurb --- Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst diff --git a/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst b/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst new file mode 100644 index 000000000000000..8ad7bd2475c0be0 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-01-04-17-44-41.bpo-35633.wHfVop.rst @@ -0,0 +1,2 @@ +Add PermissionError to the Exception: list +patch by Michael Felt, aixtools From fab69ea2842912362960498a29803e717eab6653 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Thu, 10 Jan 2019 09:18:20 +0000 Subject: [PATCH 3/4] Prevent ''test_shutil.test_unpack_archive_xztar'' from MemoryError on 32-bit AIX when MAXDATA setting is less than 0x20000000. --- Lib/test/test_shutil.py | 13 +++++++++++++ .../Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst | 3 +++ 2 files changed, 16 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 6f22e5378ff22cb..4c327b91d62cf05 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -34,6 +34,7 @@ TESTFN2 = TESTFN + "2" MACOS = sys.platform.startswith("darwin") +AIX = sys.platform[:3] == 'aix' try: import grp import pwd @@ -141,6 +142,17 @@ def supports_file2file_sendfile(): SUPPORTS_SENDFILE = supports_file2file_sendfile() +# 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): @@ -1351,6 +1363,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 000000000000000..5f3f1ba2328ded5 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst @@ -0,0 +1,3 @@ +Prevent ''test_shutil.test_unpack_archive_xztar'' from MemoryError on 32-bit AIX +when MAXDATA setting is less than 0x20000000. +patch by Michael Felt, aixtools From 874849d0ee88a3b324c047c937b9e5f9b0f1790f Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Sun, 17 Feb 2019 17:02:56 +0000 Subject: [PATCH 4/4] make requested changes --- Lib/test/eintrdata/eintr_tester.py | 2 +- .../NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index 6aa902564b73514..25c169bde5005f5 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -507,7 +507,7 @@ def _lock(self, lock_func, lock_name): lock_func(f, fcntl.LOCK_EX | fcntl.LOCK_NB) lock_func(f, fcntl.LOCK_UN) time.sleep(0.01) - except (BlockingIOError, PermissionError): + except BlockingIOError: break # the child locked the file just a moment ago for 'sleep_time' seconds # that means that the lock below will block for 'sleep_time' minus some 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 deleted file mode 100644 index 5f3f1ba2328ded5..000000000000000 --- a/Misc/NEWS.d/next/Tests/2019-01-10-09-14-58.bpo-35704.FLglYo.rst +++ /dev/null @@ -1,3 +0,0 @@ -Prevent ''test_shutil.test_unpack_archive_xztar'' from MemoryError on 32-bit AIX -when MAXDATA setting is less than 0x20000000. -patch by Michael Felt, aixtools