From 320a0ded3abcbf3c26bf8ea6580d26536db599a6 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 11 Nov 2026 01:54:58 -0800 Subject: [PATCH] told_once, heap_refused_notice: ETC2RGB8, and no second lock inside an assertion The pixel format is PixelFormat::ETC2RGB8; and an assertion whose message locked the sink's list again while its condition held the lock would wait on itself where it failed: each reads the list once. --- .../metal2vulkan-runtime/src/tests/heap_refused_notice.rs | 7 +++---- crates/metal2vulkan-runtime/src/tests/told_once.rs | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs b/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs index 82969d773..39e4f34c8 100644 --- a/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs +++ b/crates/metal2vulkan-runtime/src/tests/heap_refused_notice.rs @@ -88,13 +88,12 @@ fn a_placement_heap_names_a_texture_it_does_not_make_inside_it() { let size = heap.size(); // Made at the heap's start: nothing said. assert!(heap.new_texture_at_offset(&d, 0).is_ok()); + let named = || lock(&heard).len(); refused(&heap, &d, 1); - assert_eq!(lock(&heard).len(), 1, "{:?}", lock(&heard)); - assert_eq!(withheld(&device), 0); + assert_eq!((named(), withheld(&device)), (1, 0)); // A second refusal: counted, not named. refused(&heap, &d, last); - assert_eq!(lock(&heard).len(), 1, "{:?}", lock(&heard)); - assert_eq!(withheld(&device), 1); + assert_eq!((named(), withheld(&device)), (1, 1)); // Outside the heap: neither. refused(&heap, &d, size); assert_eq!(withheld(&device), 1); diff --git a/crates/metal2vulkan-runtime/src/tests/told_once.rs b/crates/metal2vulkan-runtime/src/tests/told_once.rs index 5bdf0a588..60579d68f 100644 --- a/crates/metal2vulkan-runtime/src/tests/told_once.rs +++ b/crates/metal2vulkan-runtime/src/tests/told_once.rs @@ -73,7 +73,7 @@ fn withheld(counts: &WorkCounts, told: Told) -> u64 { fn message(told: Told, name: &str) -> DebugMessage { if told == Told::TwinDecodeFailed { let failed = crate::error::internal("a decode that failed"); - return twin_decode_failed(PixelFormat::ETC2_RGB8, [8, 8, 1], &failed); + return twin_decode_failed(PixelFormat::ETC2RGB8, [8, 8, 1], &failed); } DebugMessage { severity: MessageSeverity::Info, @@ -131,7 +131,7 @@ fn a_second_late_reservation_is_counted_not_said() { }; let late = || device.work_counts().late_reservation_withheld; reserve(2); - assert!(lock(&heard).is_empty(), "{:?}", lock(&heard)); + assert_eq!(*lock(&heard), Vec::::new()); reserve(4); assert_eq!(*lock(&heard), ["metal2vulkan-late-reservation"]); assert_eq!(late(), 0);