Conformance tests: record mode reads the host's macOS release from the side, so its tests run on any Mac

CI run 47018745061 (at 9186e2fe46) passes macOS's validation suite. Its next
step, "Test the conformance suite", fails 2 of 1054 on the macos-26 runner
(macOS 26.7.2, 25G332):
- record_mode_counts_the_outcomes_it_saw_with_their_runs unwraps
  Err(HostMoved { found: "macOS 26.7.2 (25G332)", named: "apple-m3-max on
  macOS 27.0.1 (26A434)" });
- record_mode_refuses_a_case_whose_metal_run_stopped gets the same
  HostMoved where it expects Refused.
These tests check record mode's logic through a stub side, but record mode
read the host's sw_vers directly. So on any Mac but the oracle, the host
check stopped them first.

Form:
- The Side trait gains macos_release (macOS only). Its default answers this
  host's sw_vers -productVersion and -buildVersion (record::sw_vers, the
  same reads check_host made). Metal's side and the runtime's side keep the
  default.
- check_host takes the side and holds its release against ORACLE_OS_VERSION
  and ORACLE_OS_BUILD as before. HostMoved and its text are unchanged. Off
  macOS it is NoMetal, as before.
- watch::Watching forwards macos_release to the side it wraps, as it
  forwards every Side call (the_announcing_side_forwards_every_call reads
  the trait). docs/CONFORMANCE-COVERAGE.md is regenerated: the Side method
  count is 135.
- The test StubSide states the oracle's release, so the record-mode tests
  check record mode's logic on any Mac. on_release moves it.
- New test record_mode_refuses_a_host_that_is_not_the_oracle (macOS):
  - a stub on macOS 26.7.2 (25G332) is HostMoved, naming both hosts;
  - the oracle's release on another build is HostMoved too.

The rest of the macOS job after this step: only "Doc tests" (cargo test
--workspace --all-features --doc). Every later step is Linux-only. No
running doctest touches the host: the only doc code fence in macOS-gated
code is a text block in the conformance binary. Packaging and the
documentation steps run before this one, and passed in run 47018745061.

Verified: see the hand-over. The M3 runs no tests, so the macOS proof is
the next CI run.
This commit is contained in:
Anees Iqbal committed 2026-12-02 20:00:52 -08:00
1 parent 208360ab6d
commit 9ce9960452
5 files changed
+89 -16

No files matched your search

@@ -788,6 +788,16 @@ pub trait Side {
/// Where the side runs.
fn venue(&self) -> Venue;
/// The macOS release and build the side runs on, as `sw_vers -productVersion` and
/// `-buildVersion` answer them on this host (empty where it does not answer): what record mode
/// holds against the oracle the suite names before it takes an answer
/// ([`crate::record::record`]). Every side runs on its host's; a test's stub states the one it
/// stands for.
#[cfg(target_os = "macos")]
fn macos_release(&self) -> (String, String) {
crate::record::sw_vers()
}
/// A library of the shader's AIR, from whichever of its forms the side reads
/// ([`ShaderSource`]).
fn library(&mut self, source: &ShaderSource<'_>) -> Answer<Handle>;
+22 -15
View File
@@ -93,7 +93,7 @@ pub fn record(
reason: reason.to_owned(),
});
}
check_host()?;
check_host(&*side)?;
let inputs = case.inputs().map_err(|why| RecordError::Case {
case: case.name().to_owned(),
why,
@@ -213,21 +213,12 @@ fn add(outcomes: &mut Vec<Outcome>, transcript: Transcript) {
}
}
/// Refuse to record on a host that is not the oracle the suite names.
/// Refuse to record on a host that is not the oracle the suite names: `side`'s macOS release and
/// build ([`Side::macos_release`]).
#[cfg(target_os = "macos")]
fn check_host() -> Result<(), RecordError> {
let read = |flag: &str| {
std::process::Command::new("/usr/bin/sw_vers")
.arg(flag)
.output()
.ok()
.filter(|output| output.status.success())
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_owned())
.unwrap_or_default()
};
fn check_host(side: &dyn Side) -> Result<(), RecordError> {
use crate::recording::{ORACLE_CHIP, ORACLE_OS_BUILD, ORACLE_OS_VERSION};
let version = read("-productVersion");
let build = read("-buildVersion");
let (version, build) = side.macos_release();
if version == ORACLE_OS_VERSION && build == ORACLE_OS_BUILD {
return Ok(());
}
@@ -237,8 +228,24 @@ fn check_host() -> Result<(), RecordError> {
})
}
/// This host's macOS release and build, as `sw_vers -productVersion` and `-buildVersion` answer
/// them; each empty where it does not answer.
#[cfg(target_os = "macos")]
pub(crate) fn sw_vers() -> (String, String) {
let read = |flag: &str| {
std::process::Command::new("/usr/bin/sw_vers")
.arg(flag)
.output()
.ok()
.filter(|output| output.status.success())
.map(|output| String::from_utf8_lossy(&output.stdout).trim().to_owned())
.unwrap_or_default()
};
(read("-productVersion"), read("-buildVersion"))
}
/// There is no Metal to record from off macOS.
#[cfg(not(target_os = "macos"))]
fn check_host() -> Result<(), RecordError> {
fn check_host(_side: &dyn Side) -> Result<(), RecordError> {
Err(RecordError::NoMetal)
}
@@ -41,6 +41,10 @@ struct StubSide {
/// The device name the side's venue answers, so a test can hold a venue-scoped ledger row
/// against one venue and not another.
device: &'static str,
/// The macOS release and build the side stands for (`Side::macos_release`): the oracle's,
/// so record mode's logic runs on any Mac, where a test does not move it (`on_release`).
#[cfg(target_os = "macos")]
release: (&'static str, &'static str),
made: u32,
}
@@ -52,10 +56,22 @@ impl StubSide {
notices: Vec::new(),
refuse: Vec::new(),
device: "stub",
#[cfg(target_os = "macos")]
release: (
crate::recording::ORACLE_OS_VERSION,
crate::recording::ORACLE_OS_BUILD,
),
made: 0,
}
}
/// The same side on another macOS release and build.
#[cfg(target_os = "macos")]
fn on_release(mut self, version: &'static str, build: &'static str) -> Self {
self.release = (version, build);
self
}
/// The same side on a venue of another name.
fn on(mut self, device: &'static str) -> Self {
self.device = device;
@@ -91,6 +107,11 @@ impl Side for StubSide {
venue_named(self.device)
}
#[cfg(target_os = "macos")]
fn macos_release(&self) -> (String, String) {
(self.release.0.to_owned(), self.release.1.to_owned())
}
fn library(&mut self, _source: &ShaderSource<'_>) -> Answer<Handle> {
match self.refusal("library") {
Some(failure) => Err(failure),
@@ -2367,6 +2388,36 @@ fn record_mode_counts_the_outcomes_it_saw_with_their_runs() {
}
}
/// Record mode refuses to take an answer on a Mac that is not the oracle the suite names, naming
/// both, and the host it holds is the side's (`Side::macos_release`): Metal's side reads this
/// host's, and the stub states the oracle's but here, so the record-mode tests above check record
/// mode's logic on any Mac, the CI runner's macOS among them.
#[cfg(target_os = "macos")]
#[test]
fn record_mode_refuses_a_host_that_is_not_the_oracle() {
use crate::recording::{ORACLE_CHIP, ORACLE_OS_BUILD, ORACLE_OS_VERSION};
let case = WordsCase::new("words", 2);
let mut moved = StubSide::new(words(&[1, 2])).on_release("26.7.2", "25G332");
let error = record(&case, &mut moved, 1, Validated::Ran).unwrap_err();
assert_eq!(
error,
RecordError::HostMoved {
found: "macOS 26.7.2 (25G332)".to_owned(),
named: format!("{ORACLE_CHIP} on macOS {ORACLE_OS_VERSION} ({ORACLE_OS_BUILD})"),
}
);
assert!(
format!("{error}").contains("re-record every case"),
"{error}"
);
// The oracle's release on another build is moved too: a recording is keyed by both.
let mut rebuilt = StubSide::new(words(&[1, 2])).on_release(ORACLE_OS_VERSION, "26A999");
assert!(matches!(
record(&case, &mut rebuilt, 1, Validated::Ran),
Err(RecordError::HostMoved { .. })
));
}
#[test]
fn a_set_diff_prints_what_is_missing_and_what_is_extra() {
let metal = Transcript::new(vec![Node::leaf(
@@ -111,6 +111,11 @@ impl<S: Side, W: Watcher> Side for Watching<S, W> {
self.inner.venue()
}
#[cfg(target_os = "macos")]
fn macos_release(&self) -> (String, String) {
self.inner.macos_release()
}
fn library(&mut self, source: &ShaderSource<'_>) -> Answer<Handle> {
let _span = self.watch("library");
self.inner.library(source)
+1 -1
View File
@@ -522,7 +522,7 @@ An implemented container no case's Metal leg touches. These are the families of
| loosenings used | `Unchecked`, `AnyOf`, `Nonzero`, `Absolute` |
| justifications named | `Degradation`, `AcceptedDifference`, `WithoutCompression` |
| modules forbidding a re-record | 8 |
| `Side` methods (the suite's whole device vocabulary) | 134 |
| `Side` methods (the suite's whole device vocabulary) | 135 |
| `Side` methods the Metal leg reaches an SDK item through | 128 |
| SDK items a case's Metal leg reaches, median | 52 |
| the same, least and most | 0 and 214 |