dsv41 smoke: utf-8 output (the reply has DeepSeek's special tokens; a Windows console code page failed on them)

This commit is contained in:
Niko1221 committed 2026-10-23 21:09:46 +02:00
1 parent b6cc7e681b
commit 8de8d90287
2 files changed
+9 -3

No files matched your search

+3 -2
View File
@@ -7355,7 +7355,7 @@ def dsv41_engine_env(lib_dirs) -> dict:
def dsv41_pack_info(exe: Path, pack: Path, lib_dirs) -> tuple[bool, str]:
"""`strata-dsv41 --pack-info --pack P`: (True, text) when every file of the pack is there (no MISSING line), else (False, text)."""
try:
r = subprocess.run([str(exe), "--pack-info", "--pack", str(pack)], capture_output=True, text=True, timeout=300,
r = subprocess.run([str(exe), "--pack-info", "--pack", str(pack)], capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=300,
env=dsv41_engine_env(lib_dirs))
except (OSError, subprocess.TimeoutExpired) as e:
return False, f"the engine could not read the pack: {e}"
@@ -7370,7 +7370,8 @@ def dsv41_smoke(exe: Path, pack: Path, lib_dirs, gpus=None, timeout: int = 5400)
if gpus:
cmd += ["--gpus", ",".join(str(g) for g in gpus)]
try:
r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout, env=dsv41_engine_env(lib_dirs))
r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=timeout,
env=dsv41_engine_env(lib_dirs))
except (OSError, subprocess.TimeoutExpired) as e:
return False, f"the test run did not finish: {e}"
text = ((r.stdout or "") + (r.stderr or "")).strip()
+6 -1
View File
@@ -59,6 +59,11 @@ def sensible(text: str) -> tuple[bool, str]:
def main() -> int:
for st in (sys.stdout, sys.stderr): # the reply has DeepSeek's special tokens (fullwidth bars): a Windows console code page cannot print them
try:
st.reconfigure(encoding="utf-8", errors="replace")
except (AttributeError, OSError):
pass
ap = argparse.ArgumentParser()
ap.add_argument("--exe", required=True)
ap.add_argument("--pack", required=True)
@@ -77,7 +82,7 @@ def main() -> int:
if a.gpus:
cmd += ["--gpus", a.gpus]
try:
r = subprocess.run(cmd, capture_output=True, text=True, timeout=a.timeout, env=dict(os.environ))
r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=a.timeout, env=dict(os.environ))
except (OSError, subprocess.TimeoutExpired) as e:
print(f"the engine did not finish the test run: {e}")
return 2