Repository navigation
Conversation
…ST-RED-GREEN-LOCAL) Green is current main with the pull request merged. Red is current main plus only the pull request's tests: its test files, and the hunks of other Rust files that change only #[cfg(test)] items, committed on the merge base and cherry-picked with a 3-way merge. It runs the touched D3D12 crates' cargo test and the changed tests/**/test*.py on both sides, in one worktree and one target dir under the git common dir, and prints per test: red then green, pass on red and fail on green, fail on both, on one side only, with a verdict and an exit code. docs/testing.md has it next to the fork-CI recipe.
Collaborator
|
Verified by OreoFR (another owner than TheGeogeo) on macOS 27.2.1, Apple M5, Python 3.12.16, Rust (rustup),
AI-assisted: Claude Code |
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.
Claimed in the coordination issue as: TEST-RED-GREEN-LOCAL (#2570 (comment))
What and why
CONTRIBUTING.md asks for a test that fails on
mainand passes with the change. Verifiers check that by hand today, each in their own way: a worktree, a cherry-pick of the test file, two builds, then reading two test logs. docs/testing.md describes it only for C++runtime/on fork CI. This addsscripts/red_green.py(standard library), which does it locally for the D3D12 crates and the Python tests:Green is current
main(it fetchesorigin/mainand the pull request) with the pull request merged.Red is current
mainplus only the pull request's tests:testsfolder,*_tests.rs,tests.rs;#[cfg(test)]items: a#[cfg(test)] mod x { ... }block, a#[cfg(test)] mod x_tests;line, a#[cfg(test)]function. Blank lines and comments around them are allowed. Braces in strings, raw strings, chars and comments do not end a block. A hunk that mixes test and other code stays on the green side only.That change is committed on the merge base and cherry-picked onto
mainwith a 3-way merge. A conflict, or a pull request with no test, is "red not constructible".It runs
cargo test --locked --no-fail-fast -p <crate>for every crate underd3d12/cratesord3d12/appsthe pull request touches. It runs fromd3d12/, so the pinned toolchain applies. It also runs each changedtests/**/test*.pywith unittest.Both sides run in one worktree with one cargo target dir under
<git common dir>/red-green, red first, never in parallel. A lock file refuses a second run. The worktree and the target dir stay, so the next run builds only what changed. Shared target dirs across worktrees were left out because they rebuild each other's crates.It prints, per test: red then green; pass on red and fail on green; fail on both (failing on
maintoo); found on one side only. Then the verdict:red then green(exit 0);no red,red does not build,green fails,red not constructible,green not constructible,no tests ran(exit 1);red does not buildis the case docs/testing.md calls "does not build without the pull request's new file".--jsongives everything.docs/testing.md has a new subsection next to the fork-CI recipe. C++
runtime/tests stay with that recipe.Tested
On Windows 11 Pro 10.0.26300, Python 3.12, git 2.56.1.windows.1:
tests/test_red_green.py, 13 tests, all passing. They use throwaway git repositories and a stub cargo, with no game data:no red;red not constructible;green fails;red does not build;mod x_tests;line,cfg(not(test)), a mixed hunk, braces in raw strings and chars.maind8ca18240:leonida-lua):red then greenfor its 5 new tests, 35 pass on both, in 29 s from a cold target dir. That matches the red/green its verifier reported (35 + 5 failing onmain, 40/40 with it).leonida-shader): the red side tooksource_hash_tests.rsand themod source_hash_tests;hunk oflib.rs, and leftbuild.rs(the fix) out. Result:red then greenfor 2 tests, 401 pass on both, in 792 s. That matches its verifier's check: 2 of the 3 new tests fail onmainby assertion.tests/test_docs_*.py,tests/test_tool_stdout_encoding.py,tests/test_ci_registration.py,scripts/check_no_game_data.pyon the changed files, andgit diff --checkare clean.GPUs tested: n/a (no GPU code)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)