diff --git a/test_engine.py b/test_engine.py index aa15480..32ea17d 100644 --- a/test_engine.py +++ b/test_engine.py @@ -25,7 +25,7 @@ import tempfile HERE = os.path.dirname(os.path.abspath(__file__)) PREFLIGHT = os.path.join(HERE, "preflight.py") -ENTRYPOINT = os.path.join(HERE, "entrypoint.sh") +WRAPPER = os.path.join(HERE, "vllm_wrapper.sh") DETECT = os.path.join(HERE, "detect_tokenizer.py") PASS, FAIL = [], [] @@ -163,11 +163,13 @@ def main(): # ---- 9:entrypoint 语法 + detect ---- print("[8] entrypoint.sh / detect_tokenizer.py") - p = subprocess.run(["bash", "-n", "entrypoint.sh"], capture_output=True, text=True, cwd=HERE) - check("entrypoint.sh bash 语法正确", p.returncode == 0, p.stderr[:200]) - shutil.copy2(ENTRYPOINT, os.path.join(tmp, "ep.sh")) - p1 = subprocess.run(["bash", "-n", "ep.sh"], capture_output=True, text=True, cwd=tmp) - check("entrypoint.sh 复制后语法仍正确", p1.returncode == 0, p1.stderr[:200]) + p1 = subprocess.run(["bash", "-n", "vllm_wrapper.sh"], capture_output=True, text=True, cwd=HERE) + check("vllm_wrapper.sh bash 语法正确", p1.returncode == 0, p1.stderr[:200]) + # wrapper 必须拦截 serve 且不外改其它子命令 + wr = io.open(os.path.join(HERE, "vllm_wrapper.sh"), encoding="utf-8").read() + check("wrapper 拦截 serve ", 'serve' in wr and 'MODEL_DIR="$2"' in wr) + check("wrapper 里 preflight 失败不阻断(有 try/兜底)", 'preflight 非 0 退出' in wr) + check("wrapper 最终 exec 的是 vllm_real", 'exec "$REAL" serve' in wr) p2 = subprocess.run([sys.executable, DETECT, d], capture_output=True, text=True) check("detect_tokenizer 可执行且报 fast", "fast" in p2.stdout, p2.stdout[:100] + p2.stderr[:200])