Files
metal2vulkan/crates
Anees Iqbal 0912a69508 rt test: rule 2's scan reads the translator's product sources, and the identity spellings it missed
the_product_sources_take_one_path_for_every_device (rt's tests::one_path) enforces rule 2: product
code names no vendor, device or driver identity, reads no environment variable and declares no
policy type. Until now it read only the runtime's sources and missed several spellings. It now
reads the translator's two crates too, and it catches:
- driver_version, conformance_version, the device, driver and pipeline-cache UUIDs and
  PhysicalDeviceIDProperties;
- ash's device_name_as_c_str, driver_name_as_c_str and driver_info_as_c_str accessors, and
  vk::VendorId;
- the vendor IDs written in decimal;
- getenv;
- the device type, which rule 2 lets decide unified memory alone.

The translator's tests are left out: its tests directories, its tests.rs and *_tests.rs files, the
modules it declares under #[cfg(test)], and its inline #[cfg(test)] modules. A test checks that
exclusion.

The lines the scan may find something on are listed in ALLOWED, by file and text, each with its
reason:
- the device type where unified memory is decided;
- the stage cache's key;
- the translator's DeviceDescription and its two readers;
- DevicePolicy;
- Vulkan's driver enum, mirrored;
- the environment variables' registry;
- the command line's device file;
- three table and grammar numbers that equal a vendor's ID.
A listed line that no longer holds a finding fails the test, so the list cannot go stale. The
module docs say what a scan cannot see: a policy switch spelled as a bool field, a constant or a
cfg(feature) gate, and code after a // inside a string literal.

from_queries_derives_one_profile_whatever_the_identity now also varies the device's name and the
driver's version, and the profile stays the same.

Verified on the CPU with no device, in job m3-max-82544. Probe files were put beside the product
sources; no module declares them, so they were never compiled. They hold one line of each new
form (nine in the runtime's src, one in the translator's):
- the scan at a0d2d2efdd passes over them, which is the gap;
- this change's scan fails, naming all ten lines;
- without the probes, the four one_path tests and the identity test pass;
- the runtime's and the translator's suites: 3091 passed, 22 skipped.
Gate A ran in job m3-max-82570 at a commit of this tree (0339453fe7): signatures, clippy plain,
m2v_gpu and m2v_cpu_icd, doc and privdoc, and the one_path tests again after the one clippy fix
(an explicit auto-deref).
2026-12-03 00:05:10 -08:00
..