Skip to content

test_docs_cli_flags: spirv-opt passes are another program's flags (main is red) - #8290

Open
evilclanker9000 wants to merge 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/1-docscli-spirvopt
Open

evilclanker9000 wants to merge 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/1-docscli-spirvopt

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

Item: EGEN-DOCSCLI-SPIRVOPT

What and why

tests/test_docs_cli_flags.py is red on main (dde82f27e): unknown_flags() reports seven flags quoted in
docs/embedded_shaders.md (lines 372-377) that no tracked source file mentions. They are spirv-opt passes and one
local SSA probe pass from a single measurement, not options of any tool in this repository, so the page is right and
the check's allow list was missing them.

  • tests/test_docs_cli_flags.py: the seven names go into FOREIGN, next to the gh, pip and argparse flags it
    already carries, and the comment says where they come from.
  • docs/embedded_shaders.md: the -Os, --merge-return and --scalar-replacement sentence now names spirv-opt,
    as the earlier flags on that line already do.

Test (before / after)

Before, on upstream/main dde82f27e:

python -I tests/test_docs_cli_flags.py
...
FAILED (failures=1)
AssertionError: flags in the docs that no source file mentions: docs/embedded_shaders.md:372 --ssa-rewrite;
docs/embedded_shaders.md:373 --eliminate-dead-code-aggressive; docs/embedded_shaders.md:374 --cfg-cleanup;
docs/embedded_shaders.md:374 --eliminate-dead-branches; docs/embedded_shaders.md:374 --merge-blocks;
docs/embedded_shaders.md:376 --merge-return; docs/embedded_shaders.md:377 --scalar-replacement

After, on this branch:

python -I tests/test_docs_cli_flags.py
.....
----------------------------------------------------------------------
Ran 5 tests in 8.268s

OK

Negative control: test_a_foreign_flag_does_not_hide_an_unknown_one expects only --not-a-flag on a line that also
carries --merge-return. Run against the pre-fix module (git show dde82f27e:tests/test_docs_cli_flags.py) it
reports both flags; on this branch it reports only the unknown one.

CPU-only, standard library, no GPU needed, no game files. python -I scripts/check_no_game_data.py is clean on both
changed files.

Notes

  • Chose the existing FOREIGN set over a new per-page exception: that is already how other programs' flags are
    excused, and it stays narrower than exempting the whole page.
  • The measurement text is unchanged apart from naming the tool the last three passes belong to.

AI-assisted.

docs/embedded_shaders.md quotes seven spirv-opt passes and one local SSA probe pass that no tool in the repository takes, so test_docs_name_existing_flags failed on main (7 flags on lines 372-377). List them in FOREIGN next to the gh and pip flags it already carries.
The new control fails on the pre-fix module, which reports both --merge-return and the unknown flag for the same line, and passes once spirv-opt's passes are in FOREIGN.

@devnull34 devnull34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified via Tier 2 Free Cloud & local test execution: Adding spirv-opt optimization passes to FOREIGN and testing that foreign flags do not shadow unknown flags turns test_docs_cli_flags.py green on current main (5/5 pass).

@molodayamama

Copy link
Copy Markdown

Verified commit c76049c8999019620a4d2b677670739c0c475fd5. All five CLI documentation tests passed on Windows. The issue previously reproduced on main and #8089 was seven flags in the SPIRV-Tools example. At this head the foreign flags are accepted, while the synthetic unknown repo-tool flag still produces a diagnostic.

AI-assisted verification.

@morodirule

Copy link
Copy Markdown

Tested c76049c on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. tests/test_docs_cli_flags.py 5/5 OK (incl. new foreign-flag test). Negative control: base test+docs → exactly the 7 spirv-opt flags listed as unknown (the red this PR fixes); restored, green again. No game files. AI-assisted.

@morodirule

Copy link
Copy Markdown

Tested c76049c on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. tests/test_docs_cli_flags.py 5/5 OK (incl. new foreign-flag test). Negative control: base module + new test → exactly the new test fails; restored, green again. No game files. AI-assisted.

@giusepperainone

Copy link
Copy Markdown

Tested c76049c merged onto main 6dda063, Windows 11, Python 3.12.10, CPU only: pass — python -I tests/test_docs_cli_flags.py OK (it fails on main without this PR). No game files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants