Use shared scratch environment for relocated benchmark

Co-Authored-By: Codex gpt-6.1-sol <[email protected]>
This commit is contained in:
rdbtCVSandCodex gpt-6.1-sol committed 2026-11-03 12:13:41 +00:00
1 parent f41d7a6f43
commit 78ef64dbb7
2 files changed
+7 -6

No files matched your search

+1 -4
View File
@@ -1,14 +1,11 @@
"""tools/bench.py: the parsers, the report table and the per-server setup (no server is started)."""
import importlib.util
from pathlib import Path
import tempfile
import types
import unittest
SPEC = importlib.util.spec_from_file_location('bench', Path(__file__).resolve().parent.parent / 'tools/bench.py')
bench = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(bench)
from tools import bench
def args(**kw):
+6 -2
View File
@@ -39,6 +39,11 @@ import tempfile
import threading
import time
try:
from . import lab
except ImportError:
import lab
ROOT = Path(__file__).resolve().parent.parent
EXE = '.exe' if os.name == 'nt' else ''
SERVERS = ('horizon', 'vanilla', 'pumpkin')
@@ -207,8 +212,7 @@ class Server:
self.lines = []
self.lock = threading.Lock()
self.log = log_path.open('w', encoding='utf-8')
env = dict(os.environ, HORIZON_NO_AUDIO='1', HORIZON_HOME=str(directory / 'horizon-home'),
HORIZON_LAUNCHER_NO_SELF_UPDATE='1')
env = lab.game_env(HORIZON_HOME=directory / 'horizon-home')
self.process = subprocess.Popen([str(c) for c in command], cwd=directory, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
encoding='utf-8', errors='replace', env=env)