Skip to content

Commit 83cc4fc

Browse files
test(websem): report every oracle divergence in one gate run
The pixel gate accumulated its first cross-platform finding: a gradient cell byte-exact on the macOS Skia build differs by one code value at 18 ramp knife-edge pixels under the Linux build. Failing fast reports one fixture per CI round-trip; the gate now sweeps the whole suite and fails with the complete divergence list, so a platform difference is mapped in a single run before its measured tolerances are declared.
1 parent dcb3376 commit 83cc4fc

1 file changed

Lines changed: 33 additions & 22 deletions

File tree

crates/websem/tests/reftest_oracle.rs

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ fn primitive_oracle_provenance_is_current() {
277277
#[test]
278278
fn every_primitive_is_pixel_exact_to_chromium_and_deterministic() {
279279
let root = fixture_root();
280+
let mut divergences: Vec<String> = Vec::new();
280281
for fixture in suite().fixtures {
281282
let source = fs::read_to_string(root.join(&fixture.source))
282283
.unwrap_or_else(|e| panic!("read {}: {e}", fixture.source));
@@ -346,12 +347,20 @@ fn every_primitive_is_pixel_exact_to_chromium_and_deterministic() {
346347
}
347348
}
348349

350+
// Divergences accumulate across the whole suite instead of failing
351+
// fast: one run reports every departing fixture with its measured
352+
// bounds, so a cross-platform Skia difference is fully mapped in a
353+
// single CI round-trip.
349354
match &fixture.tolerance {
350-
None => assert_eq!(
351-
differing_pixels, 0,
352-
"{} has {differing_pixels} pixels differing from Chromium; first: {first_difference:?}",
353-
fixture.id
354-
),
355+
None => {
356+
if differing_pixels != 0 {
357+
divergences.push(format!(
358+
"{}: {differing_pixels} pixels differ (worst channel delta \
359+
{worst_channel_delta}); first: {first_difference:?}",
360+
fixture.id
361+
));
362+
}
363+
}
355364
Some(tolerance) => {
356365
assert!(
357366
matches!(
@@ -361,19 +370,16 @@ fn every_primitive_is_pixel_exact_to_chromium_and_deterministic() {
361370
"{} declares an unknown tolerance kind",
362371
fixture.id
363372
);
364-
assert!(
365-
differing_pixels <= tolerance.max_differing_pixels,
366-
"{} differs from Chromium in {differing_pixels} pixels, over its declared \
367-
{}; first: {first_difference:?}",
368-
fixture.id,
369-
tolerance.max_differing_pixels
370-
);
371-
assert!(
372-
worst_channel_delta <= tolerance.max_channel_delta,
373-
"{} differs by {worst_channel_delta} in a channel, over its declared {}",
374-
fixture.id,
375-
tolerance.max_channel_delta
376-
);
373+
if differing_pixels > tolerance.max_differing_pixels
374+
|| worst_channel_delta > tolerance.max_channel_delta
375+
{
376+
divergences.push(format!(
377+
"{}: {differing_pixels} pixels differ (worst channel delta \
378+
{worst_channel_delta}), over its declared {}/{}; first: \
379+
{first_difference:?}",
380+
fixture.id, tolerance.max_differing_pixels, tolerance.max_channel_delta
381+
));
382+
}
377383
if tolerance.kind == "aa-boundary-ring" {
378384
assert!(
379385
worst_boundary_distance <= 1.0,
@@ -385,10 +391,10 @@ fn every_primitive_is_pixel_exact_to_chromium_and_deterministic() {
385391
// "ramp-quantization" has no geometric confinement to
386392
// declare: a gradient ramp fills its region, and the
387393
// departure is a rounding flip at a ramp knife-edge where
388-
// the two Skia builds' float paths differ by an ulp
389-
// (delta 1, measured count). A wrong gradient still fails
390-
// loudly — misplaced geometry moves far more pixels than
391-
// the declared count and further than the declared delta.
394+
// two Skia builds' float paths differ by an ulp (delta 1,
395+
// measured counts). A wrong gradient still fails loudly —
396+
// misplaced geometry moves far more pixels than the
397+
// declared count and further than the declared delta.
392398
}
393399
}
394400

@@ -406,6 +412,11 @@ fn every_primitive_is_pixel_exact_to_chromium_and_deterministic() {
406412
fixture.id
407413
);
408414
}
415+
assert!(
416+
divergences.is_empty(),
417+
"fixtures diverging from their Chromium oracles:\n{}",
418+
divergences.join("\n")
419+
);
409420
}
410421

411422
/// Formerly the both-downstreams byte-identity gate. Its replacement purpose

0 commit comments

Comments
 (0)