From 1513f4753c2c29856a95036c45a010645a4ae6b1 Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 26 Mar 2024 16:09:15 +0100 Subject: [PATCH 1/2] windows: Improve MSYS2-based CI builds. Install the mingw variant of Python since it behaves more like a 'real' Windows CPython than the msys2 variant: os.name == 'nt', not 'posix'. Note that os.sep is still '/' though so we don't actually need to skip the import_file test. This way one single Python version can be used both for running run-tests.py and getting the expected test output. Signed-off-by: stijn --- .github/workflows/ports_windows.yml | 15 ++------------- ports/windows/Makefile | 3 +++ ports/windows/README.md | 2 +- tests/run-tests.py | 9 ++++----- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index be2a2a8dac..7647749f77 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -108,16 +108,6 @@ jobs: run: shell: msys2 {0} steps: - - name: Get Python path - id: python_path - shell: python - run: | - import os - import sys - output = f"python={os.fspath(sys.executable)}" - print(output) - with open(os.environ["GITHUB_OUTPUT"], "w") as f: - f.write(output) - uses: msys2/setup-msys2@v2 with: msystem: ${{ matrix.sys }} @@ -126,7 +116,7 @@ jobs: make mingw-w64-${{ matrix.env }}-gcc pkg-config - python3 + mingw-w64-${{ matrix.env }}-python3 git diffutils - uses: actions/checkout@v4 @@ -138,8 +128,7 @@ jobs: run: make -C ports/windows -j2 VARIANT=${{ matrix.variant }} - name: Run tests id: test - # msys python breaks tests so we need to use "real" windows python - run: MICROPY_CPYTHON3=$(cygpath "${{ steps.python_path.outputs.python }}") make -C ports/windows test_full VARIANT=${{ matrix.variant }} + run: make -C ports/windows test_full VARIANT=${{ matrix.variant }} - name: Print failures if: failure() && steps.test.conclusion == 'failure' working-directory: tests diff --git a/ports/windows/Makefile b/ports/windows/Makefile index bb635167da..cf0a927014 100644 --- a/ports/windows/Makefile +++ b/ports/windows/Makefile @@ -101,6 +101,9 @@ include $(TOP)/py/mkrules.mk .PHONY: test test_full +# Note for recent gcc versions like 13.2: +# - mingw64-x86_64 gcc builds will pass the math_domain_special test +# - mingw64-ucrt64 gcc builds will pass all of the below tests RUN_TESTS_SKIP += -e math_fun -e float2int_double -e float_parse -e math_domain_special test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py diff --git a/ports/windows/README.md b/ports/windows/README.md index 2b3ed44599..57ec0e1914 100644 --- a/ports/windows/README.md +++ b/ports/windows/README.md @@ -45,7 +45,7 @@ Install MSYS2 from http://repo.msys2.org/distrib, start the msys2.exe shell and install the build tools: pacman -Syuu - pacman -S make mingw-w64-x86_64-gcc pkg-config python3 + pacman -S make mingw-w64-x86_64-gcc pkg-config mingw-w64-x86_64-python3 Start the mingw64.exe shell and build: diff --git a/tests/run-tests.py b/tests/run-tests.py index 4f55cdd398..59ed179621 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -3,6 +3,7 @@ import os import subprocess import sys +import sysconfig import platform import argparse import inspect @@ -583,10 +584,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): # fails with stack overflow on Debug builds skip_tests.add("misc/sys_settrace_features.py") - if os.getenv("MSYSTEM") is not None: - # fails due to wrong path separator - skip_tests.add("import/import_file.py") - if upy_float_precision == 0: skip_tests.add("extmod/uctypes_le_float.py") skip_tests.add("extmod/uctypes_native_float.py") @@ -699,7 +696,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): # Some tests use unsupported features on Windows if os.name == "nt": - skip_tests.add("import/import_file.py") # works but CPython prints forward slashes + if not sysconfig.get_platform().startswith("mingw"): + # Works but CPython uses '\' path separator + skip_tests.add("import/import_file.py") # Some tests are known to fail with native emitter # Remove them from the below when they work From ea145374e390e89c0d0ba28da447a2951081b91b Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 26 Mar 2024 16:11:11 +0100 Subject: [PATCH 2/2] windows: Make test skipping more granular. Signed-off-by: stijn --- .github/workflows/ports_windows.yml | 2 ++ tests/run-tests.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index 7647749f77..91a3192a10 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -42,6 +42,8 @@ jobs: configuration: Debug - visualstudio: '2019' configuration: Debug + env: + CI_BUILD_CONFIGURATION: ${{ matrix.configuration }} runs-on: ${{ matrix.runner }} steps: - name: Install Visual Studio 2017 diff --git a/tests/run-tests.py b/tests/run-tests.py index 59ed179621..079b9a3259 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -580,7 +580,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if os.getenv("GITHUB_ACTIONS") == "true": skip_tests.add("thread/stress_schedule.py") # has reliability issues - if os.getenv("RUNNER_OS") == "Windows": + if os.getenv("RUNNER_OS") == "Windows" and os.getenv("CI_BUILD_CONFIGURATION") == "Debug": # fails with stack overflow on Debug builds skip_tests.add("misc/sys_settrace_features.py")