mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 11:06:11 -10:00
Use shared scratch environment for relocated benchmark
Co-Authored-By: Codex gpt-6.1-sol <[email protected]>
This commit is contained in:
1 parent
f41d7a6f43
commit
78ef64dbb7
2 files changed
+7
-6
No files matched your search
+1
-4
@@ -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
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user