diff --git a/Build/steps.yml b/Build/steps.yml index 12a52759c..70c690b97 100644 --- a/Build/steps.yml +++ b/Build/steps.yml @@ -81,6 +81,11 @@ steps: - powershell: ./make.ps1 test-all displayName: Test + # 32-bit tests on Windows only + - ${{ if eq(parameters.os, 'Windows') }}: + - powershell: ./make.ps1 -frameworks net462 -platform x86 test-all + displayName: Test 32-bit + - task: PublishTestResults@2 displayName: Publish Test Results inputs: diff --git a/Src/IronPythonTest/Cases/CPythonCasesManifest.ini b/Src/IronPythonTest/Cases/CPythonCasesManifest.ini index b1e098513..23d091eac 100644 --- a/Src/IronPythonTest/Cases/CPythonCasesManifest.ini +++ b/Src/IronPythonTest/Cases/CPythonCasesManifest.ini @@ -476,9 +476,11 @@ RunCondition=NOT $(IS_POSIX) # TODO: figure out RunCondition=$(IS_POSIX) Reason=Only valid for Unix +[CPython.test_hash] # IronPython.test_hash_stdlib +Ignore=true + [CPython.test_httplib] # IronPython.test_httplib_stdlib Ignore=true -Reason=Blocking [CPython.test_httpservers] Ignore=true @@ -496,7 +498,6 @@ Reason=Blocking RunCondition=NOT $(IS_LINUX) # TODO: debug NotParallelSafe=true # Creates/deletes a module with a static name 'test_imp_helper' - [CPython.test_import] Ignore=true Reason=ImportError: No module named _multiprocessing diff --git a/Src/IronPythonTest/Cases/CaseExecuter.cs b/Src/IronPythonTest/Cases/CaseExecuter.cs index d75cbc047..df0f9a9c2 100644 --- a/Src/IronPythonTest/Cases/CaseExecuter.cs +++ b/Src/IronPythonTest/Cases/CaseExecuter.cs @@ -30,7 +30,7 @@ private static string Executable { var folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string runner; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - runner = Path.Combine(folder, "ipy.exe"); + runner = Path.Combine(folder, IntPtr.Size == 4 ? "ipy32.exe" : "ipy.exe"); if (File.Exists(runner)) return runner; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { runner = Path.Combine(folder, "ipy"); diff --git a/Src/StdLib/Lib/test/test_hash.py b/Src/StdLib/Lib/test/test_hash.py index 77b7382f6..f647c6f7d 100644 --- a/Src/StdLib/Lib/test/test_hash.py +++ b/Src/StdLib/Lib/test/test_hash.py @@ -166,7 +166,6 @@ def test_hashes(self): for obj in self.hashes_to_check: self.assertEqual(hash(obj), _default_hash(obj)) -@unittest.skipIf(sys.implementation.name == "ironpython", "TODO") class HashRandomizationTests: # Each subclass should define a field "repr_", containing the repr() of diff --git a/Tests/test_formatting.py b/Tests/test_formatting.py index 6ecce4e4c..caa7c9e1c 100644 --- a/Tests/test_formatting.py +++ b/Tests/test_formatting.py @@ -5,7 +5,7 @@ import math import os -from iptest import IronPythonTestCase, is_cli, is_netcoreapp, is_netcoreapp21, big, run_test, skipUnlessIronPython +from iptest import IronPythonTestCase, is_cli, is_cli32, is_netcoreapp, is_netcoreapp21, big, run_test, skipUnlessIronPython class A: def __str__(self): @@ -407,6 +407,13 @@ def test_format_testfile(self): %r 0.999999999999e-4 -> 9.99999999999e-05 %r 0.999e-4 -> 9.99e-05 %r 1e-5 -> 1e-05 +""".strip().split("\n") + + if is_cli32: + expected_failures += """ +%r 1.0000000000000001e-4 -> 0.0001 +%r 1e-4 -> 0.0001 +%r 0.99999999999999999e-4 -> 0.0001 """.strip().split("\n") if not format_rounds_to_even: diff --git a/Tests/test_hash_stdlib.py b/Tests/test_hash_stdlib.py new file mode 100644 index 000000000..fb04103d7 --- /dev/null +++ b/Tests/test_hash_stdlib.py @@ -0,0 +1,66 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the Apache 2.0 License. +# See the LICENSE file in the project root for more information. + +## +## Run selected tests from test_hash from StdLib +## + +from iptest import is_ironpython, is_netcoreapp, is_cli32, generate_suite, run_test + +import test.test_hash + +def load_tests(loader, standard_tests, pattern): + tests = loader.loadTestsFromModule(test.test_hash) + + if is_ironpython: + test.test_hash.BytesHashRandomizationTests('test_empty_string') + test.test_hash.BytesHashRandomizationTests('test_fixed_hash') + test.test_hash.BytesHashRandomizationTests('test_long_fixed_hash') + test.test_hash.HashBuiltinsTestCase('test_hashes') + test.test_hash.HashEqualityTestCase('test_coerced_floats') + test.test_hash.HashEqualityTestCase('test_coerced_integers') + test.test_hash.HashEqualityTestCase('test_numeric_literals') + test.test_hash.HashEqualityTestCase('test_unaligned_buffers') + test.test_hash.HashInheritanceTestCase('test_default_hash') + test.test_hash.HashInheritanceTestCase('test_error_hash') + test.test_hash.HashInheritanceTestCase('test_fixed_hash') + test.test_hash.HashInheritanceTestCase('test_hashable') + test.test_hash.HashInheritanceTestCase('test_not_hashable') + test.test_hash.MemoryviewHashRandomizationTests('test_empty_string') + test.test_hash.MemoryviewHashRandomizationTests('test_fixed_hash') + test.test_hash.MemoryviewHashRandomizationTests('test_long_fixed_hash') + test.test_hash.StrHashRandomizationTests('test_empty_string') + test.test_hash.StrHashRandomizationTests('test_fixed_hash') + test.test_hash.StrHashRandomizationTests('test_long_fixed_hash') + test.test_hash.StrHashRandomizationTests('test_ucs2_string') + + failing_tests = [ + test.test_hash.BytesHashRandomizationTests('test_null_hash'), # KeyError: dotnet + test.test_hash.MemoryviewHashRandomizationTests('test_null_hash'), # KeyError: dotnet + test.test_hash.StrHashRandomizationTests('test_null_hash'), # KeyError: dotnet + test.test_hash.DatetimeDateTests('test_randomized_hash'), + test.test_hash.DatetimeDatetimeTests('test_randomized_hash'), + test.test_hash.DatetimeTimeTests('test_randomized_hash'), + ] + + if not is_netcoreapp: + failing_tests += [ + test.test_hash.BytesHashRandomizationTests('test_randomized_hash'), + test.test_hash.MemoryviewHashRandomizationTests('test_randomized_hash'), + test.test_hash.StrHashRandomizationTests('test_randomized_hash'), + ] + + if is_cli32: + failing_tests += [ + test.test_hash.HashDistributionTestCase('test_hash_distribution'), + ] + + skip_tests = [] + + return generate_suite(tests, failing_tests, skip_tests) + + else: + return tests + +run_test(__name__) diff --git a/Tests/test_memoryview.py b/Tests/test_memoryview.py index b8704a6c7..0399c12d0 100644 --- a/Tests/test_memoryview.py +++ b/Tests/test_memoryview.py @@ -205,10 +205,16 @@ def test_equality_structural(self): self.assertFalse(mv_d == mv_f) mv_P = mv.cast('P') - self.assertFalse(mv_P == mv_i) - self.assertFalse(mv_P == mv_L) - self.assertTrue(mv_P == mv_q) - self.assertTrue(mv_P == mv_Q) + if is_64: + self.assertFalse(mv_P == mv_i) + self.assertFalse(mv_P == mv_L) + self.assertTrue(mv_P == mv_q) + self.assertTrue(mv_P == mv_Q) + else: + self.assertTrue(mv_P == mv_i) + self.assertTrue(mv_P == mv_L) + self.assertFalse(mv_P == mv_q) + self.assertFalse(mv_P == mv_Q) # Comparing different formats works if the values are the same b = bytes(range(8)) diff --git a/Tests/test_stdconsole.py b/Tests/test_stdconsole.py index a40e9c6be..77fd17634 100644 --- a/Tests/test_stdconsole.py +++ b/Tests/test_stdconsole.py @@ -7,7 +7,7 @@ import sys import unittest -from iptest import IronPythonTestCase, is_cli, is_netcoreapp21, is_posix, run_test, skipUnlessIronPython +from iptest import IronPythonTestCase, is_cli, is_cli32, is_netcoreapp21, is_posix, run_test, skipUnlessIronPython if is_cli: import clr @@ -82,6 +82,8 @@ def TestCommandLine(self, args, expected_output, expected_exitcode = 0): realargs.extend(args) exitcode = os.spawnv(0, self.batfile, realargs) cmdline = "ipy " + ' '.join(args) + if is_cli32: + cmdline = "ipy32 " + ' '.join(args) print('') print(' {}'.format(cmdline)) diff --git a/Tests/test_struct_stdlib.py b/Tests/test_struct_stdlib.py index bd23acb06..bbc246c2a 100644 --- a/Tests/test_struct_stdlib.py +++ b/Tests/test_struct_stdlib.py @@ -6,7 +6,7 @@ ## Run selected tests from test_struct from StdLib ## -from iptest import is_ironpython, generate_suite, run_test +from iptest import is_ironpython, is_64, generate_suite, run_test import test.test_struct @@ -17,10 +17,14 @@ def load_tests(loader, standard_tests, pattern): failing_tests = [ test.test_struct.StructTest('test_705836'), # AssertionError: OverflowError not raised by pack test.test_struct.StructTest('test_bool'), # struct.error: expected bool value got IronPython.NewTypes.System.Object_1$1 - test.test_struct.StructTest('test_calcsize'), # AssertionError: 4 not greater than or equal to 8 test.test_struct.StructTest('test_count_overflow'), # AssertionError: error not raised by calcsize ] + if is_64: + failing_tests += [ + test.test_struct.StructTest('test_calcsize'), # AssertionError: 4 not greater than or equal to 8 - https://github.com/IronLanguages/ironpython3/pull/869 + ] + return generate_suite(tests, failing_tests) else: