Skip to content

Commit a0c7bf1

Browse files
stinosdpgeorge
authored andcommitted
github/workflows: 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 <[email protected]>
1 parent 233f5ce commit a0c7bf1

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

.github/workflows/ports_windows.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ jobs:
108108
run:
109109
shell: msys2 {0}
110110
steps:
111-
- name: Get Python path
112-
id: python_path
113-
shell: python
114-
run: |
115-
import os
116-
import sys
117-
output = f"python={os.fspath(sys.executable)}"
118-
print(output)
119-
with open(os.environ["GITHUB_OUTPUT"], "w") as f:
120-
f.write(output)
121111
- uses: msys2/setup-msys2@v2
122112
with:
123113
msystem: ${{ matrix.sys }}
@@ -126,7 +116,7 @@ jobs:
126116
make
127117
mingw-w64-${{ matrix.env }}-gcc
128118
pkg-config
129-
python3
119+
mingw-w64-${{ matrix.env }}-python3
130120
git
131121
diffutils
132122
- uses: actions/checkout@v4
@@ -138,8 +128,7 @@ jobs:
138128
run: make -C ports/windows -j2 VARIANT=${{ matrix.variant }}
139129
- name: Run tests
140130
id: test
141-
# msys python breaks tests so we need to use "real" windows python
142-
run: MICROPY_CPYTHON3=$(cygpath "${{ steps.python_path.outputs.python }}") make -C ports/windows test_full VARIANT=${{ matrix.variant }}
131+
run: make -C ports/windows test_full VARIANT=${{ matrix.variant }}
143132
- name: Print failures
144133
if: failure() && steps.test.conclusion == 'failure'
145134
working-directory: tests

ports/windows/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ include $(TOP)/py/mkrules.mk
101101

102102
.PHONY: test test_full
103103

104+
# Note for recent gcc versions like 13.2:
105+
# - mingw64-x86_64 gcc builds will pass the math_domain_special test
106+
# - mingw64-ucrt64 gcc builds will pass all of the below tests
104107
RUN_TESTS_SKIP += -e math_fun -e float2int_double -e float_parse -e math_domain_special
105108

106109
test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py

ports/windows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Install MSYS2 from http://repo.msys2.org/distrib, start the msys2.exe shell and
4545
install the build tools:
4646

4747
pacman -Syuu
48-
pacman -S make mingw-w64-x86_64-gcc pkg-config python3
48+
pacman -S make mingw-w64-x86_64-gcc pkg-config mingw-w64-x86_64-python3
4949

5050
Start the mingw64.exe shell and build:
5151

tests/run-tests.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import subprocess
55
import sys
6+
import sysconfig
67
import platform
78
import argparse
89
import inspect
@@ -583,10 +584,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
583584
# fails with stack overflow on Debug builds
584585
skip_tests.add("misc/sys_settrace_features.py")
585586

586-
if os.getenv("MSYSTEM") is not None:
587-
# fails due to wrong path separator
588-
skip_tests.add("import/import_file.py")
589-
590587
if upy_float_precision == 0:
591588
skip_tests.add("extmod/uctypes_le_float.py")
592589
skip_tests.add("extmod/uctypes_native_float.py")
@@ -711,7 +708,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
711708

712709
# Some tests use unsupported features on Windows
713710
if os.name == "nt":
714-
skip_tests.add("import/import_file.py") # works but CPython prints forward slashes
711+
if not sysconfig.get_platform().startswith("mingw"):
712+
# Works but CPython uses '\' path separator
713+
skip_tests.add("import/import_file.py")
715714

716715
# Some tests are known to fail with native emitter
717716
# Remove them from the below when they work

0 commit comments

Comments
 (0)