[CI] Pin the Rust TreeCore build to the resolved libtorch instead of interpreter discovery (#37696)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alex Nails
2026-09-05 15:30:32 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent 77aee20259
commit 6a0c55fd6c
4 changed files with 11 additions and 63 deletions
+6 -1
View File
@@ -441,10 +441,15 @@ crate-type = ["cdylib"]
"PATH": "/usr/bin",
"CXXFLAGS": "-O2",
"RUSTFLAGS": "-Ctarget-cpu=x86-64",
"LIBTORCH_USE_PYTORCH": "1",
},
)
self.assertEqual(build.environment["LIBTORCH_USE_PYTORCH"], "1")
self.assertNotIn("LIBTORCH_USE_PYTORCH", build.environment)
self.assertEqual(build.environment["LIBTORCH"], str(torch_root))
self.assertEqual(build.environment["LIBTORCH_INCLUDE"], str(torch_root))
self.assertEqual(build.environment["LIBTORCH_LIB"], str(torch_root))
self.assertEqual(build.environment["LIBTORCH_CXX11_ABI"], "1")
self.assertEqual(build.environment["LIBTORCH_BYPASS_VERSION_CHECK"], "1")
self.assertIn(str(compat_header), build.environment["CXXFLAGS"])
self.assertIn(
@@ -1,46 +0,0 @@
import importlib.util
import re
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[4]
CI_REGISTER_PATH = REPO_ROOT / "python" / "sglang" / "test" / "ci" / "ci_register.py"
INSTALL_SCRIPT = REPO_ROOT / "scripts" / "ci" / "cuda" / "ci_install_dependency.sh"
def _load_module(name, path):
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
register_cpu_ci = _load_module("ci_register", CI_REGISTER_PATH).register_cpu_ci
register_cpu_ci(est_time=0, suite="base-a-test-cpu")
class TestCudaCiInstallDependencyTorchCache(unittest.TestCase):
def test_rebuilds_torch_extensions_before_editable_install(self):
script = INSTALL_SCRIPT.read_text()
self.assertRegex(
script,
re.compile(
r"setup_cargo_cache\s*\n"
r"\s*invalidate_torch_rust_cache\s*\n"
r"\s*install_sglang"
),
)
self.assertIn('"${SGLANG_BUILD_RUST_EXTS:-}" = "none"', script)
self.assertRegex(
script,
re.compile(
r"cargo clean --release --manifest-path "
r"\"\$\{REPO_ROOT\}/rust/sglang-radix-tree/Cargo\.toml\"\s*\\\n"
r"\s*-p torch-sys -p sglang-radix-tree"
),
)
if __name__ == "__main__":
unittest.main()