Repository navigation
tests: stop the installer constraint test counting occurrences - #7503
Merged
Merged
Conversation
test_torch_constraint.sh asserted how many times each pin appears in install.sh. Every hardware branch assigns its own torch/torchvision/torchaudio triple, so #7354 adding gfx906 pushed three of those counts up by one and Backend CI has been red on main since: FAIL: default TORCH_CONSTRAINT assignment exists (expected '1', got '2') FAIL: hardcoded torch>=2.4 appears exactly once (expected '1', got '2') FAIL: torchvision bounded (<0.26) at default + custom-leaf (expected '2', got '3') FAIL: torchaudio bounded (<2.11) at default + custom-leaf (expected '2', got '3') install.sh is correct; the numbers were the stale part. Assert the invariants instead, so the next hardware branch is not a test edit: - the default assignment is the top-level one, so anchor the grep at column 0 rather than counting every occurrence. An indented branch pin no longer satisfies it, which the old count did not distinguish either. - what "appears exactly once" really guarded is that no pip install line spells a pin out instead of using "$TORCH_CONSTRAINT", so check that directly. - companions must be bounded everywhere, so compare bounded assignments against total assignments rather than pinning a count of 2. That is strictly stronger: it now covers all 7, not the 2 the old numbers happened to name. 45 pass, 0 fail. Each new assertion fails when its property is broken: a bare or unbounded companion, a hardcoded pin on an install line, or a missing top-level default.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
danielhanchen
added a commit
that referenced
this pull request
Jul 27, 2026
Picks up #7503, which unbreaks the Backend CI shell installer tests. No conflicts.
danielhanchen
added a commit
that referenced
this pull request
Jul 27, 2026
Resolve tests/sh/test_torch_constraint.sh by keeping main's invariant based structure from #7503 and restating it against this branch's composed ceiling variables. Both sides rewrote the same assertions in the same spirit. #7503 replaced brittle occurrence counts with invariants after #7354's gfx906 branch pushed three counts up by one and left Backend CI red. This branch had independently rewritten them because the default torch range is no longer a literal, it is composed from _TORCH_CEILING="2.12.0". The resolution keeps both: - The column 0 anchor for the default assignment now reads the composed form TORCH_CONSTRAINT="torch>=2.4,<${_TORCH_CEILING}", so an indented per branch pin still cannot satisfy it. _TORCH_CEILING="2.12.0" is asserted separately so the anchor keeps its teeth. - The tightened macOS py3.13 assignment is an existence check rather than a count, per #7503. - Both stray literal checks are kept. They are complementary: #7503's sees through shell escaped quotes on an install or echoed command line, this branch's catches the two default ranges copied onto any assignment that is not TORCH_CONSTRAINT=. - The gfx906 sub 2.11 cap assertion is kept, converted from a count to an indented existence check so a second hardware branch adding its own sub 2.11 cap is not a test edit. - #7503's every assignment upper bound checks for torchvision and torchaudio are kept, widened to accept the composed ceiling alongside a literal bound. install.sh, install.ps1, studio/setup.ps1 and studio/install_python_stack.py are untouched by this merge. The gfx906 literal cap and the three ROCm 2.11 floors stay literal, and the test permits them without forcing them to track the ceiling. tests/sh/test_torch_constraint.sh: 49 pass, 0 fail.
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.
tests/sh/test_torch_constraint.shasserts how many times each pin literal appears ininstall.sh. Every hardware branch assigns its own torch / torchvision / torchaudio triple, so #7354 adding the gfx906 branch pushed three of those counts up by one, and the Backend CI "Shell installer tests" step has been failing on main since:Every expectation is off by exactly one, which is the three lines #7354 added:
install.shis right; the numbers were the stale part. Rather than bump them to 2 and 3 and have the next hardware branch break the file again, this asserts the invariants the counts were standing in for.What changed
uv pip installline spells a pin out instead of using"$TORCH_CONSTRAINT", since a literal there ignores whatever the branch above it chose. Checked directly now, because the premise that the literal can only appear once is no longer true.<2.11-capped torch resolves a mismatched 2.11 build, and that has to hold for every assignment. It now covers all 7 rather than the 2 the old numbers happened to name.Testing
bash tests/sh/test_torch_constraint.shgoes from 41 pass / 4 fail to 45 pass / 0 fail.Each new assertion was checked by breaking the property it guards and confirming it reddens:
"torch>=2.4,<2.11.0"on a pip install lineThe whole
tests/shsuite was run against this branch and againstmain: the only difference istest_torch_constraint.shgoing green.test_install_host_defaults.shfails on both, and the Backend CI workflow skips it deliberately.