From 5af19614d836fda853be922bde3d928d2a86eefc Mon Sep 17 00:00:00 2001 From: Victor Nova Date: Sun, 10 Apr 2022 15:32:08 -0700 Subject: [PATCH 1/2] fixed NativeTypeSpec on 32 bit platforms --- src/runtime/Native/NativeTypeSpec.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/Native/NativeTypeSpec.cs b/src/runtime/Native/NativeTypeSpec.cs index c57bd9363..3771061dd 100644 --- a/src/runtime/Native/NativeTypeSpec.cs +++ b/src/runtime/Native/NativeTypeSpec.cs @@ -10,7 +10,7 @@ struct NativeTypeSpec : IDisposable public readonly StrPtr Name; public readonly int BasicSize; public readonly int ItemSize; - public readonly TypeFlags Flags; + public readonly IntPtr Flags; public IntPtr Slots; public NativeTypeSpec(TypeSpec spec) @@ -20,7 +20,7 @@ public NativeTypeSpec(TypeSpec spec) this.Name = new StrPtr(spec.Name, Encoding.UTF8); this.BasicSize = spec.BasicSize; this.ItemSize = spec.ItemSize; - this.Flags = spec.Flags; + this.Flags = new IntPtr((long)spec.Flags); unsafe { From 85037267f87bb44d8e8e43784b3aa2e06dd0a469 Mon Sep 17 00:00:00 2001 From: Victor Nova Date: Sun, 10 Apr 2022 15:32:28 -0700 Subject: [PATCH 2/2] enable x86 testing on Windows in CI --- .github/workflows/main.yml | 10 ++++++++-- src/runtime/Native/NativeTypeSpec.cs | 4 ++-- tests/conftest.py | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 218796192..11d8699e4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,12 @@ jobs: matrix: os: [windows, ubuntu, macos] python: ["3.6", "3.7", "3.8", "3.9", "3.10"] - platform: [x64] + platform: [x64, x86] + exclude: + - os: ubuntu + platform: x86 + - os: macos + platform: x86 steps: - name: Set Environment on macOS @@ -67,6 +72,7 @@ jobs: run: pytest --runtime mono - name: Python Tests (.NET Core) + if: ${{ matrix.platform == 'x64' }} run: pytest --runtime netcore - name: Python Tests (.NET Framework) @@ -77,7 +83,7 @@ jobs: run: dotnet test --runtime any-${{ matrix.platform }} src/python_tests_runner/ - name: Perf tests - if: ${{ matrix.python == '3.8' }} + if: ${{ (matrix.python == '3.8') && (matrix.platform == 'x64') }} run: | pip install --force --no-deps --target src/perf_tests/baseline/ pythonnet==2.5.2 dotnet test --configuration Release --runtime any-${{ matrix.platform }} --logger "console;verbosity=detailed" src/perf_tests/ diff --git a/src/runtime/Native/NativeTypeSpec.cs b/src/runtime/Native/NativeTypeSpec.cs index 3771061dd..8b84df536 100644 --- a/src/runtime/Native/NativeTypeSpec.cs +++ b/src/runtime/Native/NativeTypeSpec.cs @@ -10,7 +10,7 @@ struct NativeTypeSpec : IDisposable public readonly StrPtr Name; public readonly int BasicSize; public readonly int ItemSize; - public readonly IntPtr Flags; + public readonly int Flags; public IntPtr Slots; public NativeTypeSpec(TypeSpec spec) @@ -20,7 +20,7 @@ public NativeTypeSpec(TypeSpec spec) this.Name = new StrPtr(spec.Name, Encoding.UTF8); this.BasicSize = spec.BasicSize; this.ItemSize = spec.ItemSize; - this.Flags = new IntPtr((long)spec.Flags); + this.Flags = (int)spec.Flags; unsafe { diff --git a/tests/conftest.py b/tests/conftest.py index 99ee07f2f..89db46eca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -86,7 +86,11 @@ def pytest_configure(config): else: domain_tests_dir = os.path.join(os.path.dirname(__file__), "domain_tests") bin_path = os.path.join(domain_tests_dir, "bin") - check_call(["dotnet", "build", domain_tests_dir, "-o", bin_path]) + build_cmd = ["dotnet", "build", domain_tests_dir, "-o", bin_path] + is_64bits = sys.maxsize > 2**32 + if not is_64bits: + build_cmd += ["/p:Prefer32Bit=True"] + check_call(build_cmd)