This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch jenkins-sccache-diagnostics
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/jenkins-sccache-diagnostics by
this push:
new 41d5da2527 [CI] Check sccache socket support before diagnostics
41d5da2527 is described below
commit 41d5da25276281d25fd4d018192785641efb3bad
Author: Tianqi Chen <[email protected]>
AuthorDate: Fri Oct 16 01:36:44 2026 +0000
[CI] Check sccache socket support before diagnostics
---
ci/README.md | 4 ++--
tests/python/ci/test_sccache_diagnostics.py | 22 ++++++++++++++++++++--
tests/scripts/task_sccache_diagnostics.py | 10 ++++++++++
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/ci/README.md b/ci/README.md
index aa9b7a98c0..17e5a2d819 100644
--- a/ci/README.md
+++ b/ci/README.md
@@ -116,8 +116,8 @@ unauthenticated role-list request records whether IMDS
returns an HTTP response
(such as 401) or also times out. No token, role name, credential value, raw
subprocess output, or raw error log is printed or archived.
-The cache probe requires sccache with Unix-domain socket support (the image
-installer pins 0.14.0) and `/usr/bin/gcc`. It resets sccache-specific settings,
+The cache probe requires sccache 0.14.0 or newer with Unix-domain socket
+support (the image installer pins 0.14.0) and `/usr/bin/gcc`. It resets
sccache-specific settings,
selects the given S3 bucket and region, and retains the current AWS credential
sources. It does not forward host credentials into Docker. A private temporary
directory and socket isolate its server from other builds. A unique tiny C
diff --git a/tests/python/ci/test_sccache_diagnostics.py
b/tests/python/ci/test_sccache_diagnostics.py
index 16fbd63ae5..6b82f891fe 100644
--- a/tests/python/ci/test_sccache_diagnostics.py
+++ b/tests/python/ci/test_sccache_diagnostics.py
@@ -125,6 +125,8 @@ def
test_s3_roundtrip_restarts_server_and_keeps_credentials_private(
def run(command, *, env, cwd, **kwargs):
calls.append(command[1:])
+ if command[1:] == ["--version"]:
+ return subprocess.CompletedProcess(command, 0, b"sccache
0.14.0\n", b"")
assert env["AWS_SECRET_ACCESS_KEY"] == SECRET
assert "SCCACHE_SERVER_PORT" not in env
assert "SCCACHE_IGNORE_SERVER_IO_ERROR" not in env
@@ -144,7 +146,23 @@ def
test_s3_roundtrip_restarts_server_and_keeps_credentials_private(
mock.patch.object(diag.subprocess, "run", side_effect=run),
):
assert diag.cache_probe("test-bucket", "us-west-2", "/usr/bin/gcc") is
expected
- assert calls[3] == ["--stop-server"]
- assert calls[4] == ["--start-server"]
+ assert calls[4] == ["--stop-server"]
+ assert calls[5] == ["--start-server"]
assert calls[-1] == ["--stop-server"]
assert SECRET not in capsys.readouterr().out
+
+
[email protected]("output", [b"sccache 0.13.0\n", SECRET.encode()])
+def test_unknown_server_protocol_never_starts_or_stops_a_server(output,
capsys):
+ with (
+ mock.patch.object(diag.shutil, "which", return_value="sccache"),
+ mock.patch.object(
+ diag.subprocess,
+ "run",
+ return_value=subprocess.CompletedProcess(["sccache", "--version"],
0, output, b""),
+ ) as run,
+ ):
+ assert not diag.cache_probe("test-bucket", "us-west-2", "/usr/bin/gcc")
+ assert run.call_count == 1
+ assert run.call_args.args[0] == ["sccache", "--version"]
+ assert SECRET not in capsys.readouterr().out
diff --git a/tests/scripts/task_sccache_diagnostics.py
b/tests/scripts/task_sccache_diagnostics.py
index a9335f93d1..2953fa3387 100644
--- a/tests/scripts/task_sccache_diagnostics.py
+++ b/tests/scripts/task_sccache_diagnostics.py
@@ -203,6 +203,16 @@ def cache_probe(bucket, region, compiler):
SCCACHE_ERROR_LOG=str(directory / "errors"),
SCCACHE_DIRECT="false",
)
+ # Older binaries can ignore SCCACHE_SERVER_UDS and use a shared TCP
+ # server instead. Refuse them before any start/stop/compile operation.
+ version_code, output = run_sccache(
+ executable, ["--version"], env, directory, "version_command"
+ )
+ version = re.fullmatch(rb"sccache ([0-9]+\.[0-9]+\.[0-9]+)\s*", output)
+ if version_code or not version or tuple(map(int,
version[1].split(b"."))) < (0, 14, 0):
+ emit("sccache_version", result="unsupported_version")
+ return False
+ emit("sccache_version", version=version[1].decode("ascii"))
# A fresh source forces a miss without deleting existing cache objects.
(directory / "probe.c").write_text(
"int sccache_probe_" + uuid.uuid4().hex + "(void) { return 0; }\n"