tests: cover x2w_bcpack diagnostics, layouts, and failure classes #3862
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3862
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3860"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Ammmae0x on GitHub · 2026-12-02 14:41 UTC · original
Ammmae0x:tests/bcpack-inspect-unit→main· +1416 −0 · 5 files · 2 commits · merged 2026-12-02 15:32 UTCRefs #1149
Portable C++17 unit and header-mutation tests for
x2w_bcpack::inspect_layout,inspect_class,inspect_class_nameandinspect_bcpack(src/startup_stubs/bcpack_inspect.h, Refs #1198), matchingtests/cmake/logical_view_table_unit.cmake. The source is unchanged; only 5 new files are added (+1416/-0), and the existingtests/bcpack_inspect_check.cppcoverage is untouched. The new check uses the disjointbcpack_inspect_unitprefix so test names do not collide.What landed
tests/bcpack_inspect_unit_check.cpp— 12 cases, header-only againstsrcplus the test-only encoder and fixtures intests, no device, no loader, no title data. The BC1 and BC7 streams are the synthetic vectors already in the repository; the BC3/BC4/BC5 streams come from the test-only encoder and the BC2/BC6/BC7 fixtures from the fixture encoder. Every class is also checked againstdecode_bcpack: it decodes exactly when the class isok.tests/cmake/bcpack_inspect_unit.cmake— one CTest test per case plusbcpack_inspect_unit_all, and 6WILL_FAIL TRUEcontrols (BEFORE PRIVATEmutated header copies, 1:1 with the meta check). Mutant targets also addsrc/startup_stubsto the include path, mirroringd3d12_teardown, so the mutated header's sibling include ofbcpack_decoder.hresolves.tests/bcpack_inspect_unit_meta_check.py— audits the contract, compiles and runs the real C++ check and every mutation natively withg++ -std=c++17 -Wall -Wextra -Wpedantic -Werror(orclwith/W4).tests/checks/python-linux/bcpack_inspect_unit.txt— lists exactly the meta check.docs/experiments/bcpack-inspect-unit.md— cases, controls, and verification.Cases
layout_formats: seven layouts, one per format BC1 through BC7, each the table entry for its format, with the fixture lane count, block size, symbols per block and alphabet index per lane; formats 0, 8, 9 and 255 have no layout.class_and_names:inspect_classmaps all tenLaneFailurevalues to theirInspectClass;inspect_class_namenames all fourteen classes, and an out-of-range value reads asunknown.bad_arguments: null input, empty input, zero destination, and null/empty input with an unsupported format (the argument check runs first); the cap is the 16 MiB chunk window, andinspect_max_output + 1/+ 8(BC1) and+ 16/256 MiB (BC7) are refused before anything is allocated, with no lane counts reported.unsupported_format: a BC1 stream read as format 0, 8 or 9, and a BC7 stream read as format 8, refused before the lanes run, with no lane counts reported.destination_misaligned: BC1 at 510, 12 and 1 bytes, BC7 at 15 and 24 bytes, and the BC1 bytes as BC2 (24 bytes) and as BC6 (8 bytes); refused before the lanes run, with no lane counts reported.bc1_ok_counts: the 64-block BC1 vector decodes (ok, 515 bytes read, 64 symbols per lane, target 64), including with zero padding; a shorter request reads asrequest_shorter_than_stream(1, 16 and 63 blocks) and a longer one asrequest_longer_than_stream(65 and 1000 blocks).bc1_lane_failures: a cut stream reads astruncated_in_fragment(cut at 514, 300, 100 and 1); one byte after the end reads astrailing_input; first byte 0 reads asfragment_not_home; byte 2 set to 11 reads ascycle_limit; byte 382 flipped reads asend_state_invalid; the BC1 stream read with the BC7 layout reads asfragment_not_home.bc7_ok_failures: the one- and two-block BC7 vectors decode (ok, 104 and 132 bytes read, 2 and 4 symbols per lane); a shorter request reads asrequest_shorter_than_stream, a longer one asrequest_longer_than_stream, a cut stream astruncated_in_fragment; first byte 1 reads asend_state_invalid, byte 8 zero asfragment_not_home; the single mode 6 block decodes to the block the vector was made from.bc345_encoder_streams: encoder streams for BC3, BC4 and BC5 (40 blocks, unflushed fragments) decode exactly; half the blocks read asrequest_shorter_than_stream, one byte after the end astrailing_input, a misaligned size asdestination_misaligned, twice the blocks asrequest_longer_than_streamortruncated_in_fragment, half the stream astruncated_in_fragmentorrequest_longer_than_stream.bc2_bc6_bc7_fixtures: the BC2 and BC6 fixture streams decode exactly; a BC6 fixture with mode 14 reads asbc6_mode_invalid; a BC7 fixture whose control code is0x07freads ascontrol_code_unmapped.lane_report:decode_laneswith a report namesheader_invalidfor a fragment header at alphabet index 2,bad_argumentsfor no lanes and for an alphabet index above 8, and the report'sheader_invalidmaps toInspectClass::header_invalid.inspection_cap_boundary: a BC1 request at exactlyinspect_max_outputis inspected, not refused, and reads asrequest_longer_than_stream(515 bytes read, 64 symbols per lane, target 2,097,152).Mutation controls (6/6 killed)
layout_null_mut: the layout lookup returns the BC1 layout instead of null;unsupported_formatthen decodes format 8 as BC1 instead of refusing it.class_map_mut: the class mapping reports a bad fragment header asok;class_and_namesthen mapsheader_invalidtook.class_name_mut: theokclass is namedbad_arguments;class_and_namesthen readsinspect_class_name(ok)asbad_arguments.cap_guard_mut: the inspection cap is eight bytes too high;bad_argumentsthen readsinspect_max_output + 1asdestination_misaligned(and+ 8asrequest_longer_than_stream).misaligned_guard_mut: the misaligned-destination test is weakened to a remainder above 1;destination_misalignedthen reads a 510-byte BC1 request asrequest_shorter_than_stream.bc6_result_mut: a BC6 block with an undefined mode is reported asok;bc2_bc6_bc7_fixturesthen reads the mode-14 fixture asokinstead ofbc6_mode_invalid.There is no control for dropping the destination-misaligned guard outright, or for the BC7 control-code assignment: dropping the misaligned guard is covered by weakening its remainder test instead, and the BC7 assignment is the mirror of the BC6 one.
Linux-only notes, flagged explicitly
bcpack_decoder.h(included bybcpack_inspect.h) includes MSVC-only<intrin.h>, sog++cannot compile the header as-is. The meta check writes a minimalintrin.hshim into its own temporary directory (never into the repository) for_BitScanReverseand_BitScanForward, the two scan intrinsics the non-AVX2 paths use, implemented with__builtin_clzand__builtin_ctzwith MSVC semantics. On Windows,cluses the real<intrin.h>and no shim is involved. Windows CTest remains the arbiter for the MSVC build.header_invalidcannot arise throughinspect_bcpackitself: the BC1 through BC7 layouts never use an alphabet index below 3, and a fragment header's top two bits are at most 3, so the derived alphabet index never wraps above 8. The check reaches it throughdecode_lanesdirectly, with a one-lane decode at alphabet index 2, and pins theinspect_classmapping from that report.Verification (Linux, this host,
g++ -std=c++17, baseorigin/main5770f14e)Full configure needs DXC, unavailable on Linux, so the fragment was configured standalone via symlinked
src/tests(19 tests: 12 cases + all + 6 controls).Full Linux CI list from
.github/workflows/windows.yml(tools/run_checks_parallel.py --from-dir tests/checks/python-linux ...):all 329 checks passed.git diff --checkclean;git merge-tree --write-tree origin/main HEADexits 0.Windows Verification (
6aa0f7a0aeef2d475f00d701d0fc8ff48472f0b9)AI-assisted.
@R0Y00 on GitHub · 2026-12-02 14:56 UTC · original · approved these changes
Reviewed the five-file test-only diff and verified a clean trial merge. On
6aa0f7a0,python3 -B tests/bcpack_inspect_unit_meta_check.pypassed all 12 original cases on GCC and caught all six mutations. I also built the unmodified CMake fragment in a standalone harness with MSVC 19.51 and ranctest --test-dir build --output-on-failure. All 19 tests passed, including the expected mutation failures. The cases cover synthetic BC1–BC7 data, layout and classification, output limits and malformed lane reports. Hosted Windows CI still fails in the sharednative_direct_meshfixture tracked by #3853.github-bot referenced this pull request2026-12-03 15:22:31 +00:00