Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*m4n100k0p100t3000_cr_lf.inp -text
*.test text eol=lf
35 changes: 35 additions & 0 deletions .github/workflows/moocore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,38 @@ jobs:
name: failed-tests-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}
path: failed-test-outputs/
if-no-files-found: ignore

test-windows:
name: Run testsuite on Windows (MSYS2)
runs-on: windows-latest
env:
PYTHONIOENCODING: utf-8
defaults:
run:
shell: msys2 {0}

steps:
- name: Checkout moocore
uses: actions/checkout@v6
with:
repository: multi-objective/moocore
sparse-checkout: c

- name: Checkout testsuite
uses: actions/checkout@v6
with:
path: testsuite

- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: >-
make
xz
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-python
mingw-w64-ucrt-x86_64-python-joblib
mingw-w64-ucrt-x86_64-python-rich

- name: make test (DEBUG=1, -O3 -flto)
run: make -C c test OPT_CFLAGS="-O3 -flto"
27 changes: 23 additions & 4 deletions regtest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import os
import pathlib
import subprocess
import sys
import glob
Expand Down Expand Up @@ -121,9 +122,18 @@ def runcmd(command, cwd=None, env=None, outfile=subprocess.DEVNULL):
full_env["ASAN_OPTIONS"] = ASAN_OPTIONS
full_env["UBSAN_OPTIONS"] = UBSAN_OPTIONS
stdout = outfile if outfile == subprocess.DEVNULL else subprocess.PIPE
bash = "bash"
if os.name == "nt":
msys_bash = (
pathlib.Path(sys.executable).parent.parent.parent
/ "usr"
/ "bin"
/ "bash.exe"
)
if msys_bash.is_file():
bash = str(msys_bash)
result = subprocess.run(
command,
shell=True,
[bash, "-c", command],
env=full_env,
check=False,
cwd=cwd,
Expand Down Expand Up @@ -194,7 +204,13 @@ def main():
print("\t for example:", sys.argv[0], "../bin/hv")
sys.exit(1)

program = os.path.realpath(os.path.expanduser(sys.argv[1]))
program = pathlib.Path(os.path.realpath(os.path.expanduser(sys.argv[1]))).as_posix()
if (
os.name == "nt"
and not os.path.isfile(program)
and os.path.isfile(program + ".exe")
):
program += ".exe"
if not is_exe(program):
print(f"error: '{program}' not found or not executable!")
sys.exit(1)
Expand All @@ -214,7 +230,10 @@ def main():

ntotal = len(tests)
elapsed_time = time.time()
ok = Parallel(n_jobs=-2)(delayed(run_test)(test, program=program) for test in tests)
prefer = "threads" if os.name == "nt" else "processes"
ok = Parallel(n_jobs=-2, prefer=prefer)(
delayed(run_test)(test, program=program) for test in tests
)
elapsed_time = time.time() - elapsed_time
npassed = sum(ok)
nfailed = ntotal - npassed
Expand Down
Loading