diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8bd164487..6c731c1b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,10 +19,6 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: Setup .NET Core 3.1 - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '3.1.x' - name: Setup .NET 6.0 uses: actions/setup-dotnet@v4 with: @@ -31,6 +27,10 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.x' + - name: Setup .NET 9.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' - name: Version Information run: | dotnet --info @@ -48,9 +48,6 @@ jobs: - name: Test (net462) run: ./make.ps1 -frameworks net462 test-all shell: pwsh - - name: Test (netcoreapp3.1) - run: ./make.ps1 -frameworks netcoreapp3.1 test-all - shell: pwsh - name: Test (net6.0) run: ./make.ps1 -frameworks net6.0 test-all shell: pwsh diff --git a/Build/netcoreapp3.1.props b/Build/netcoreapp3.1.props deleted file mode 100644 index 53b1e59f1..000000000 --- a/Build/netcoreapp3.1.props +++ /dev/null @@ -1,38 +0,0 @@ - - - - false - - - - $(Features);FEATURE_APARTMENTSTATE - $(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES - $(Features);FEATURE_ASSEMBLY_RESOLVE - $(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY - $(Features);FEATURE_CODEDOM - $(Features);FEATURE_COM - $(Features);FEATURE_CONFIGURATION - $(Features);FEATURE_CTYPES - $(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR - $(Features);FEATURE_EXCEPTION_STATE - $(Features);FEATURE_FILESYSTEM - $(Features);FEATURE_FULL_CRYPTO - $(Features);FEATURE_FULL_NET - $(Features);FEATURE_LCG - $(Features);FEATURE_LOADWITHPARTIALNAME - $(Features);FEATURE_METADATA_READER - $(Features);FEATURE_MMAP - $(Features);FEATURE_NATIVE - $(Features);FEATURE_PIPES - $(Features);FEATURE_PROCESS - $(Features);FEATURE_REFEMIT - $(Features);FEATURE_REGISTRY - $(Features);FEATURE_RUNTIMEINFORMATION - $(Features);FEATURE_SECURITY_RULES - $(Features);FEATURE_SERIALIZATION - $(Features);FEATURE_STACK_TRACE - $(Features);FEATURE_SYNC_SOCKETS - $(Features);FEATURE_THREAD - $(Features);FEATURE_XMLDOC - - diff --git a/Build/steps.yml b/Build/steps.yml index 12a52759c..5903af548 100644 --- a/Build/steps.yml +++ b/Build/steps.yml @@ -25,22 +25,22 @@ steps: displayName: Grab Package Version - task: UseDotNet@2 - displayName: Install .NET Core 3.1 runtime for testing + displayName: Install .NET 6.0 runtime for testing inputs: packageType: 'runtime' - version: '3.1.x' + version: '6.0.x' - task: UseDotNet@2 - displayName: Install .NET 6.0 runtime for testing + displayName: Install .NET 8.0 runtime for testing inputs: packageType: 'runtime' - version: '6.0.x' + version: '8.0.x' - task: UseDotNet@2 - displayName: Install .NET 8.0 SDK for build + displayName: Install .NET 9.0 SDK for build inputs: packageType: 'sdk' - version: '8.0.x' + version: '9.0.x' # Set Mono version on macOS - ${{ if eq(parameters.os, 'macOS') }}: diff --git a/IronPython.sln b/IronPython.sln index 3de1c02d7..f7c936d83 100644 --- a/IronPython.sln +++ b/IronPython.sln @@ -41,7 +41,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{17737ACB Build\net8.0.props = Build\net8.0.props Build\net9.0-windows.props = Build\net9.0-windows.props Build\net9.0.props = Build\net9.0.props - Build\netcoreapp3.1.props = Build\netcoreapp3.1.props Build\netstandard2.0.props = Build\netstandard2.0.props Build\steps.yml = Build\steps.yml Build\Tasks.Targets = Build\Tasks.Targets diff --git a/Package/nuget/IronPython.nuspec b/Package/nuget/IronPython.nuspec index d2334abc2..491d14977 100644 --- a/Package/nuget/IronPython.nuspec +++ b/Package/nuget/IronPython.nuspec @@ -29,10 +29,6 @@ This package contains the IronPython interpreter engine. - - - - @@ -40,9 +36,9 @@ This package contains the IronPython interpreter engine. - - - + + + diff --git a/Package/zip/Zip.Packaging.targets b/Package/zip/Zip.Packaging.targets index bec14c1fa..cb5db9c81 100644 --- a/Package/zip/Zip.Packaging.targets +++ b/Package/zip/Zip.Packaging.targets @@ -4,7 +4,7 @@ - + diff --git a/Src/DLR b/Src/DLR index 7e887d984..6e2f41a27 160000 --- a/Src/DLR +++ b/Src/DLR @@ -1 +1 @@ -Subproject commit 7e887d9848dbfeca268814aeb237c83dc1244c8a +Subproject commit 6e2f41a27a74978026d869507f404b3d8575e3b8 diff --git a/Src/IronPythonConsole/IronPythonConsole.csproj b/Src/IronPythonConsole/IronPythonConsole.csproj index a933ddd3f..a66fcd7a3 100644 --- a/Src/IronPythonConsole/IronPythonConsole.csproj +++ b/Src/IronPythonConsole/IronPythonConsole.csproj @@ -1,9 +1,7 @@  - net462;netcoreapp3.1;net6.0;net8.0 - - false + net462;net6.0;net8.0 Exe IronPythonConsole ipy @@ -20,12 +18,6 @@ Content PreserveNewest - - - false - Content - PreserveNewest - diff --git a/Src/IronPythonTest/IronPythonTest.csproj b/Src/IronPythonTest/IronPythonTest.csproj index 95d56194d..4a76e9f88 100644 --- a/Src/IronPythonTest/IronPythonTest.csproj +++ b/Src/IronPythonTest/IronPythonTest.csproj @@ -1,9 +1,7 @@  - net462;netcoreapp3.1;net6.0;net8.0 - - false + net462;net6.0;net8.0 true diff --git a/Tests/modules/network_related/test__socket.py b/Tests/modules/network_related/test__socket.py index ce1ba4548..594eabb58 100644 --- a/Tests/modules/network_related/test__socket.py +++ b/Tests/modules/network_related/test__socket.py @@ -13,7 +13,7 @@ import time import unittest -from iptest import IronPythonTestCase, is_cli, is_osx, is_linux, is_windows, is_cpython, run_test +from iptest import IronPythonTestCase, is_cli, is_mono, is_osx, is_linux, is_windows, is_cpython, run_test AF_DICT = {"AF_APPLETALK" : 5, "AF_DECnet" : 12, @@ -432,7 +432,6 @@ def test_cp5814(self): HOST = 'localhost' PORT = 0 s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM) -s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, 1) # prevents an "Address already in use" error when the socket is in a TIME_WAIT state s.settimeout(20) # prevents the server from staying open if the client never connects s.bind((HOST, PORT)) s.listen(1) @@ -534,15 +533,14 @@ def test_misc(self): def test_makefile_refcount(self): "Ensures that the _socket stays open while there's still a file associated" - GPORT = None + PORT = None def echoer(): - nonlocal GPORT + nonlocal PORT s = socket.socket() - s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # prevents an "Address already in use" error when the socket is in a TIME_WAIT state s.settimeout(15) # prevents the server from staying open if the client never connects s.bind(('localhost', 0)) - GPORT = s.getsockname()[1] s.listen(5) + PORT = s.getsockname()[1] (s2, _) = s.accept() s2.send(s2.recv(10)) s2.close() @@ -551,11 +549,16 @@ def echoer(): _thread.start_new_thread(echoer, ()) for _ in range(20): time.sleep(0.5) - if GPORT is not None: + if PORT is not None: break + if is_mono: + # Warm up Mono to connecting sockets + dummy = socket.socket() s = socket.socket() - s.connect(('localhost', GPORT)) + if is_mono: + dummy.close() + s.connect(('localhost', PORT)) f1 = s.makefile('r') f2 = s.makefile('w') s.close() @@ -582,7 +585,6 @@ def test_cp7451(self): HOST = 'localhost' PORT = 0 s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM) -s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, 1) # prevents an "Address already in use" error when the socket is in a TIME_WAIT state s.settimeout(20) # prevents the server from staying open if the client never connects s.bind((HOST, PORT)) s.listen(1) diff --git a/Tests/modules/type_related/test_ctypes.py b/Tests/modules/type_related/test_ctypes.py index 3c390a1bf..f4c1fdf3e 100644 --- a/Tests/modules/type_related/test_ctypes.py +++ b/Tests/modules/type_related/test_ctypes.py @@ -12,7 +12,7 @@ import gc import unittest -from iptest import IronPythonTestCase, is_posix, is_cli, big, myint, run_test +from iptest import IronPythonTestCase, is_posix, is_cli, is_mono, big, myint, run_test class CTypesTest(IronPythonTestCase): export_error_msg = "Existing exports of data: object cannot be re-sized" if is_cli else "cannot resize an array that is exporting buffers" @@ -30,11 +30,14 @@ def test_from_array(self): self.assertRaisesMessage(BufferError, self.export_error_msg, arr.append, 100) self.assertRaisesMessage(BufferError, self.export_error_msg, arr.insert, 10, 100) + if is_mono: + with c: pass # gc.collect() in Mono may return before collection is finished del c gc.collect() arr.append(100) self.assertEqual(arr[-1], 100) + @unittest.skipIf(is_mono, "gc.collect() in Mono may return before collection is finished") def test_from_memoryview(self): arr = array('i', range(16)) with memoryview(arr) as mv: diff --git a/Tests/test_descr_stdlib.py b/Tests/test_descr_stdlib.py index 4dc8c3312..38bf4100a 100644 --- a/Tests/test_descr_stdlib.py +++ b/Tests/test_descr_stdlib.py @@ -6,7 +6,7 @@ ## Run selected tests from test_descr from StdLib ## -from iptest import is_ironpython, generate_suite, run_test +from iptest import is_ironpython, is_mono, generate_suite, run_test import test.test_descr @@ -59,6 +59,14 @@ def load_tests(loader, standard_tests, pattern): test.test_descr.ClassPropertiesAndMethods('test_restored_object_new'), # TODO: marked as expectedFailure but doesn't fail ] + if is_mono: + skip_tests += [ + # On Mono, gc.collect() may return before collection is finished making some tests unreliable + test.test_descr.ClassPropertiesAndMethods('test_delete_hook'), + test.test_descr.ClassPropertiesAndMethods('test_subtype_resurrection'), + test.test_descr.ClassPropertiesAndMethods('test_weakrefs'), + ] + return generate_suite(tests, failing_tests, skip_tests) else: diff --git a/Tests/test_io_stdlib.py b/Tests/test_io_stdlib.py index 66a2e0d52..fab9301e4 100644 --- a/Tests/test_io_stdlib.py +++ b/Tests/test_io_stdlib.py @@ -182,6 +182,31 @@ def load_tests(loader, standard_tests, pattern): test.test_io.PyMiscIOTest('test_attributes'), # AssertionError: 'wb+' != 'rb+' ] + if is_mono: + skip_tests += [ + # On Mono, gc.collect() may return before collection is finished making some tests unreliable + test.test_io.CBufferedRandomTest('test_destructor'), + test.test_io.CBufferedWriterTest('test_destructor'), + test.test_io.PyBufferedWriterTest('test_destructor'), + test.test_io.PyBufferedRandomTest('test_destructor'), + test.test_io.PyBufferedReaderTest('test_override_destructor'), + test.test_io.PyBufferedWriterTest('test_override_destructor'), + test.test_io.PyBufferedRandomTest('test_override_destructor'), + + test.test_io.CTextIOWrapperTest('test_destructor'), + test.test_io.CIOTest('test_IOBase_finalize'), + + test.test_io.PyTextIOWrapperTest('test_destructor'), + test.test_io.PyTextIOWrapperTest('test_override_destructor'), + test.test_io.PyIOTest('test_RawIOBase_destructor'), + test.test_io.PyIOTest('test_BufferedIOBase_destructor'), + test.test_io.PyIOTest('test_IOBase_destructor'), + test.test_io.PyIOTest('test_TextIOBase_destructor'), + + test.test_io.CMiscIOTest('test_blockingioerror'), + test.test_io.PyMiscIOTest('test_blockingioerror'), + ] + return generate_suite(tests, failing_tests, skip_tests) else: diff --git a/Tests/test_memoryio_stdlib.py b/Tests/test_memoryio_stdlib.py index 71ba7c843..0294135b5 100644 --- a/Tests/test_memoryio_stdlib.py +++ b/Tests/test_memoryio_stdlib.py @@ -6,7 +6,7 @@ ## Run selected tests from test_memoryio from StdLib ## -from iptest import is_ironpython, generate_suite, run_test +from iptest import is_ironpython, is_mono, generate_suite, run_test import test.test_memoryio @@ -25,6 +25,12 @@ def load_tests(loader, standard_tests, pattern): test.test_memoryio.CStringIOTest('test_instance_dict_leak'), # https://github.com/IronLanguages/ironpython3/issues/1004 ] + if is_mono: + skip_tests += [ + # On Mono, gc.collect() may return before collection is finished making some tests unreliable + test.test_memoryio.PyBytesIOTest('test_getbuffer') + ] + return generate_suite(tests, failing_tests, skip_tests) else: diff --git a/Tests/test_namebinding.py b/Tests/test_namebinding.py index 1e2ffde9e..75919ff3d 100644 --- a/Tests/test_namebinding.py +++ b/Tests/test_namebinding.py @@ -3,8 +3,9 @@ # See the LICENSE file in the project root for more information. import sys +import unittest -from iptest import IronPythonTestCase, is_cli, path_modifier, run_test +from iptest import IronPythonTestCase, is_cli, is_mono, path_modifier, run_test glb = 0 res = '' @@ -312,6 +313,7 @@ def test_DelBuiltin(self): self.assertRaises(NameError, DoDelBuiltin) self.assertRaises(NameError, DoDelBuiltin) + @unittest.skipIf(is_mono, "TODO: figure out; the finalizer is called way after WaitForPendingFinalizers") def test_SimpleTest(self): """simple case""" global res diff --git a/make.ps1 b/make.ps1 index 32786dd37..e4575bee7 100755 --- a/make.ps1 +++ b/make.ps1 @@ -4,7 +4,7 @@ Param( [Parameter(Position=1)] [String] $target = "build", [String] $configuration = "Release", - [String[]] $frameworks=@('net462','netcoreapp3.1','net6.0','net8.0'), + [String[]] $frameworks=@('net462','net6.0','net8.0'), [String] $platform = $null, # auto-detect [switch] $runIgnored, [int] $jobs = [System.Environment]::ProcessorCount