Skip to content

Commit 8e7539b

Browse files
committed
Enable some mmap tests
1 parent b9530a8 commit 8e7539b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Src/IronPythonTest/Cases/CPythonCasesManifest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ IsolationLevel=PROCESS # Also weakref failures; https://github.com/IronLanguages
587587
Ignore=true
588588

589589
[CPython.test_mmap]
590-
RunCondition=NOT $(IS_POSIX) OR (NOT $(IS_MONO) AND '$(FRAMEWORK)' <> '.NETCoreApp,Version=v6.0')
590+
RunCondition=NOT $(IS_MONO) AND (NOT $(IS_OSX) OR '$(FRAMEWORK)' <> '.NETCoreApp,Version=v6.0')
591591
IsolationLevel=PROCESS
592592

593593
[CPython.test_module]

Src/StdLib/Lib/test/test_mmap.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import re
66
import itertools
7+
import struct # IronPython: for platform architecture detection
78
import socket
89
import sys
910
import weakref
@@ -715,7 +716,6 @@ def test_weakref(self):
715716
gc_collect()
716717
self.assertIs(wr(), None)
717718

718-
@unittest.skipIf(sys.implementation.name == "ironpython", "TODO")
719719
class LargeMmapTests(unittest.TestCase):
720720

721721
def setUp(self):
@@ -748,7 +748,8 @@ def test_large_offset(self):
748748

749749
def test_large_filesize(self):
750750
with self._make_test_file(0x17FFFFFFF, b" ") as f:
751-
if sys.maxsize < 0x180000000:
751+
#if sys.maxsize < 0x180000000: # original CPython test
752+
if struct.calcsize('P') * 8 == 32: # IronPython: better detection of 32-bit platform
752753
# On 32 bit platforms the file is larger than sys.maxsize so
753754
# mapping the whole file should fail -- Issue #16743
754755
with self.assertRaises(OverflowError):
@@ -768,11 +769,13 @@ def _test_around_boundary(self, boundary):
768769
with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as m:
769770
self.assertEqual(m[start:end], tail)
770771

771-
@unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems")
772+
#@unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems") # original CPython decorator
773+
@unittest.skipUnless(struct.calcsize('P') * 8 > 32, "test cannot run on 32-bit systems") # IronPython: better detection of 32-bit platform
772774
def test_around_2GB(self):
773775
self._test_around_boundary(_2G)
774776

775-
@unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems")
777+
#@unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems") # original CPython decorator
778+
@unittest.skipUnless(struct.calcsize('P') * 8 > 32, "test cannot run on 32-bit systems") # IronPython: better detection of 32-bit platform
776779
def test_around_4GB(self):
777780
self._test_around_boundary(_4G)
778781

0 commit comments

Comments
 (0)