Repository navigation
ci: Run the sanitizer harness from Python (#962) - #2605
Merged
Merged
Conversation
…e shell (#962) RED: ci/test_sanitize_harness.py (11 tests, including one whole stub-toolchain run) and ci/test_sanitize_deps.py (3 tests) load rust/tools/sanitize/sanitize.py and install_ubuntu_deps.py by path and drive their decisions. On the unfixed tree neither module exists, so every test errors with FileNotFoundError.
GREEN: rust/tools/sanitize/sanitize.py (178-line sanitize.sh) and install_ubuntu_deps.py (16-line install-ubuntu-deps.sh) replace the shell, and the ci.toml GEN-005 exceptions for both are gone. - sanitizers.yaml runs both through `uv run --no-project`, the way it already runs rust/tools/sanitize/triage.py; the job sets uv up before either step, so no container needs a new interpreter. - The port keeps the shell's behavior: the per-tool flags and build type, the `ctest --show-only=json-v1` to per-test mapping (wrapper dropped, WORKING_DIRECTORY honored, unregistered or non-executable commands skipped), the two tests only the asan pass may run, the per-test ASan/UBSan/TSan log paths, the zccache launcher and `zccache stop` on the way out, the 10-minute per-test bound, and the SIGINT/SIGKILL launch window with the gdb backtrace when it hangs. jq is gone: the ctest JSON is parsed directly. - ci/test_tool_guard.py allowlists the port (it still runs bare `rustup toolchain install`, in the sanitizer image), ci/test_zccache.py reads it for the zccache launcher and daemon stop, and shell.nix/triage.py name it. Refs #962
zackees
force-pushed
the
infra/962-gen-005-sanitize-python
branch
from
October 27, 2026 10:58
6be80f1 to
6fa462c
Compare
Member
Author
|
Handed off to the coordinator.
|
zackees
added a commit
that referenced
this pull request
Oct 27, 2026
This was referenced Oct 27, 2026
zackees
added a commit
that referenced
this pull request
Oct 27, 2026
MCPVOT
pushed a commit
to MCPVOT/obs-studio
that referenced
this pull request
Oct 30, 2026
* test: Point the zccache installer test at the Python port (obs-rust#962) The zccache installer is being ported from install-zccache.sh to install_zccache.py. This changes ci/test_zccache.py to read the Python module, to assert the Python port's shapes (a pinned ZCCACHE_VERSION, two SHA-256 digests, hashlib.sha256) and to pin the wiring: the shell script is gone, ci.toml keeps no GEN-005 exception for it, and every caller (Dockerfiles, .dockerignore, setup_zccache, build-project.yaml, sanitize.sh) runs the Python through uv run. A new PortTest exercises the port offline: the arch map (and the unsupported-arch failure), the archive digest, and the already-installed early return. RED: uv run python -m unittest ci/test_zccache.py -> 9 failures, 8 errors (install_zccache.py does not exist yet; the Dockerfile and the other callers still name install-zccache.sh). * ci: Port the zccache installer to Python (obs-rust#962) install-zccache.sh (38 lines) installs the pinned zccache 1.15.5 static-musl release into a destination dir, mapping uname -m x86_64/amd64 and aarch64/arm64 to their pinned SHA-256, returning early when the installed binary already reports the version, and failing on any other arch. install_zccache.py is a faithful port: same version, same two digests, same messages and exit codes. The download keeps curl's retry, the digest is checked before install, the binary lands at mode 0755, and the final step prints --version. The arch map, digest and installed-check are exercised offline by ci/test_zccache.py. Every caller now runs the Python through uv (TOOL-003): - rust/tools/linux-validate/Dockerfile (uv run --no-project --python /usr/bin/python3, uv is already in the image) - build-aux/appimage/manylinux/Dockerfile (uv arrives later in that Dockerfile, so the manylinux interpreter runs it) - .github/scripts/utils.zsh/setup_zccache and both build-project.yaml steps (uv run --no-project) - rust/tools/sanitize/sanitize.sh (uv run --no-project) - .dockerignore lists the .py; the GEN-005 exception for the .sh is gone from ci.toml, and docs/ci-tooling.md names install_zccache.py. No docs/features.md line: a pure tooling port with no user-visible change. GREEN: uv run python -m unittest ci/test_zccache.py -> 22 tests, OK; ci.test_uv_run, ci.test_dockerignore_copies and ci.test_tool_guard -> OK; ./lint -> ok (its ci/test_local_gate_probe and test_gate_dylint failures were this shell's empty CARGO_TARGET_DIR, gone with it unset). * ci: Run the sanitizer's zccache install from Python after obs-rust#2605 (obs-rust#2606)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #962
GEN-005 burn-down:
rust/tools/sanitize/sanitize.sh(178 lines) →rust/tools/sanitize/sanitize.pyandrust/tools/sanitize/install-ubuntu-deps.sh(16 lines) →rust/tools/sanitize/install_ubuntu_deps.py. Both shell scripts are deleted, the sanitizers workflow runs the Python, and bothci.tomlGEN-005 exceptions are gone.RED
127bf4aef(local evidence — a focused CI/config change, so RED and GREEN are pushed together):uv run python -m unittest ci/test_sanitize_harness.py ci/test_sanitize_deps.py→ 14 tests, 14 errors. Neither module exists on that tree, so every test that loads one by path errors withFileNotFoundError.GREEN
6be80f1ab:rust/tools/sanitize/sanitize.py— the harness port.rust/tools/sanitize/install_ubuntu_deps.py— the dependency port. It reads the shared Tier 2 listrust/tools/linux-validate/apt-packages.txt(ci: Run Tier 2 Linux natively on the runner #967 moved the packages there) instead of scraping the Dockerfile, adds the sanitizer-only extras (valgrind, gdb, xvfb, xauth, libgl1-mesa-dri, dbus-daemon, dbus-x11, qt6-image-formats-plugins), and keeps the shell'ssudo-unless-root andDEBIAN_FRONTEND=noninteractivehandling..github/workflows/sanitizers.yaml— both steps nowuv run --no-project rust/tools/sanitize/…, the way the job already runstriage.py; it sets uv up before either step, so no image needs a new interpreter.ci.toml— the GEN-005 exceptions forsanitize.shandinstall-ubuntu-deps.shremoved.ci/test_tool_guard.py— the port replaces the shell script inSCAN_ALLOWLIST(it still runs barerustup toolchain install, in the sanitizer image),ci/test_zccache.pyreads it for the launcher and the daemon stop, andshell.nixandtriage.pyname the Python file.What the port keeps
Every branch, argument and output of the shell:
RelWithDebInfo+-fsanitize=…, tsan:RelWithDebInfo+-fsanitize=thread,RUST_LIBOBS=ONdefault,SKIP_TESTS), the sharedrustup toolchain installline, theinstall-zccache.shcall, and theSAN_OUTdefault of/tmp/obs-sanitize;configure.log/build.logartifacts;ctest --show-only=json-v1parsed directly (jq is gone) into the per-test commands: the wrapper in front of the named binary is dropped,WORKING_DIRECTORYis honoured, and an unregistered or non-executable command is not run;dbus-run-sessionaroundobs, the launch window, and on a hang the gdb backtrace (sudo -nfirst, plain gdb as a fallback) before SIGKILL — withapp-exit.txtwritten either way;zccache stopon the way out, so the cache directory the job saves is flushed.Tests
ci/test_sanitize_harness.py(11 tests) andci/test_sanitize_deps.py(3 tests) load the modules by path (nosys.pathedit —ci/test_no_sys_path_edits.pyforbids one) and drive their decisions: the per-tool flags, the arg check, the ctest JSON → per-test mapping (wrapper dropped,WORKING_DIRECTORY, unregistered/non-executable skipped), the asan-only tests, the per-test log paths, the configure line's zccache launcher and libobs backend, the valgrind launch window, and the dependency list plus its usage errors. One test runsmain()end to end against a stub toolchain onPATH(rustup, cmake, ctest, Xvfb, dbus-run-session, pgrep) and asserts the artifactstriage.pyreads:tests/summary.txtwithtest_core exit=0,tests/ctest.tsv,app-exit.txt=app exit=0 (exited), and the four logs.Local:
uv run python -m unittest ci/test_sanitize_harness.py ci/test_sanitize_deps.py→ 14 OK.uv run python -m unittest ci/test_sanitize_triage.py ci/test_sanitizers_schedule.py ci/test_zccache.py ci/test_tool_guard.py ci/test_ci_toml.py ci/test_no_sys_path_edits.py ci/test_uv_run.py→ OK.uvx --from ruff==0.14.0 ruff check --no-cache --quiet $(git ls-files '*.py')→ clean.uv run --no-project rust/tools/sanitize/sanitize.py(no arguments, and an unknown tool) → the usage message and exit 2, i.e. the exact commandsanitizers.yamlnow runs.ci/local_gate.py --only self-test→ every file green exceptci/test_gate_dylint.pyandci/test_local_gate_probe.py.Not run locally
./lint's rust lane errors in this environment, unrelated to this change:test_local_gate_probefails against the host'ssoldr(0.9.35 broker vs the repo's 0.9.41) andtest_gate_dylintassertsCARGO_TARGET_DIRis unset, which this shell sets to''. Both fail onmasterhere too; PR CI is the gate.No user-visible change: CI tooling only, so no
docs/features.mdline.