Skip to content

Shader tests: name the reason each native blob is refused - #330

Closed
SkippySteve wants to merge 1 commit into
Marvisak:mainfrom
SkippySteve:SkippySteve/shader-native-refusals
Closed

SkippySteve wants to merge 1 commit into
Marvisak:mainfrom
SkippySteve:SkippySteve/shader-native-refusals

Conversation

@SkippySteve

Copy link
Copy Markdown

rejects_corrupt_blobs in victory-shader/src/native.rs only asserts is_err(). So if one check stopped firing, the test would still pass whenever a later check happened to catch the same bytes.

This adds tests only (no behaviour change). Each Malformed reason native_programs can return now has a case that expects that exact message:

  • XDAT: implausible entry count, entry out of bounds. Entries of other kinds are never read, so their bounds don't matter; that is pinned too.
  • XBCH: magic, version, implausible unpacked size, stream out of bounds, a stated size one byte either side of the inflated length, truncated header.
  • FSSM header: magic, version, payload size, slot count, record out of bounds.
  • Record: code out of bounds, VGPR count 257 (256 still passes), root table out of bounds.
  • Stage data: VS input/output and PS input semantic counts, export patch size, and a patch at the code's last dword (passes) versus one past it (refused).

All blobs are built in the test by the existing synthetic fssm/xbch/part helpers. There is no title data.

Tested on Linux:

  • cargo test -p victory-shader: 61 passed
  • cargo clippy -p victory-shader --all-targets: no new warnings. The one warning, constant_color unused in emit/mod.rs, is already on main.
  • cargo fmt --check: clean

The corrupt-blob test only checked that native_programs fails, so a
check could stop firing while an earlier one caught the same bytes.
Each XDAT, XBCH, FSSM, record and stage-data refusal now has a case that
expects its own message, with the boundaries that still pass (256
VGPRs, a patch ending at the code's last dword, out-of-range entries
of other kinds).
@SkippySteve

Copy link
Copy Markdown
Author

superseded by #333 (combined native.rs: SGPR bound + refusal tests)

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.

1 participant