From 6c44748cd93b2d03b003eacccbbed8dbcab159b5 Mon Sep 17 00:00:00 2001 From: rasptum <348594691+rasptum@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:06:31 -0500 Subject: [PATCH] tests: pass the placed-buffer controls only on their stated failure startup_placed_buffer_range_{region_only,walk_only}_control were WILL_FAIL tests whose mutated run exited 1 for the stated failure and 0 otherwise. CTest's WILL_FAIL inverts every nonzero exit, so a crash or an unrelated failure also passed them (the same mapping #2156's review found). The controls are now ordinary tests: the region-only run exits 0 only when decisions differ in the partly committed cases and nowhere else, the walk-only run only when the case-9 call count is its sole failure, and 1 otherwise. A refused allocation or mapping is still a capability skip (77). Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 4 ++-- docs/startup-runtime.md | 5 +++-- tests/startup_placed_buffer_range_check.cpp | 11 ++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17aa9d3505..4f46e83207 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -532,7 +532,7 @@ set_tests_properties(startup_placement_publish_shrink_control PROPERTIES WILL_FA # stops at the end of the buffer; every alias or refusal must equal the full walk's on the same memory, # including a decommitted page before the buffer and a block replaced at the same base, and a large # touched block must need no VirtualQuery (src/startup_stubs/placed_buffer_range.h). The mutated runs -# are the negative controls. +# are the negative controls; each passes only when it fails exactly for its stated reason. add_executable(startup_placed_buffer_range_check tests/startup_placed_buffer_range_check.cpp) target_compile_features(startup_placed_buffer_range_check PRIVATE cxx_std_17) target_include_directories(startup_placed_buffer_range_check PRIVATE src) @@ -540,7 +540,7 @@ add_test(NAME startup_placed_buffer_range COMMAND startup_placed_buffer_range_ch add_test(NAME startup_placed_buffer_range_region_only_control COMMAND startup_placed_buffer_range_check --mutate region-only) add_test(NAME startup_placed_buffer_range_walk_only_control COMMAND startup_placed_buffer_range_check --mutate walk-only) set_tests_properties(startup_placed_buffer_range_region_only_control startup_placed_buffer_range_walk_only_control - PROPERTIES WILL_FAIL TRUE SKIP_RETURN_CODE 77) + PROPERTIES SKIP_RETURN_CODE 77) add_executable(startup_storage_file_range tests/startup_storage_file_range.cpp) target_compile_features(startup_storage_file_range PRIVATE cxx_std_17) target_include_directories(startup_storage_file_range PRIVATE src) diff --git a/docs/startup-runtime.md b/docs/startup-runtime.md index 52a640efbc..d9b1080143 100644 --- a/docs/startup-runtime.md +++ b/docs/startup-runtime.md @@ -1947,8 +1947,9 @@ memory-type and state rules are unchanged. The five-second `x2w-d3d12 views note between placements would show up as a mismatch. A 512 MiB committed block with one touched page per 64 KiB must be proven without any `VirtualQuery` call; the check prints the time per placement of the full walk, the bounded walk and the proof. `_region_only_control` trusts the allocation size - without the committed-bytes check and must fail only in the partly committed cases; - `_walk_only_control` never uses the region information and must fail only that call count. A + without the committed-bytes check and passes only when its decisions differ in the partly committed + cases and nowhere else; `_walk_only_control` never uses the region information and passes only when + that call count is its sole failure. Neither is `WILL_FAIL`, so a crash cannot pass them. A refused allocation or mapping is a capability skip (77) in the controls. ## Buffer memory SRVs (device slot 70) diff --git a/tests/startup_placed_buffer_range_check.cpp b/tests/startup_placed_buffer_range_check.cpp index 800c1a0ca0..2b395c9456 100644 --- a/tests/startup_placed_buffer_range_check.cpp +++ b/tests/startup_placed_buffer_range_check.cpp @@ -29,10 +29,11 @@ // proof is printed. // // --mutate region-only trusts the allocation size without checking that every page is committed: it -// exits 1 only if decisions differ in the partly committed cases and nowhere else. -// --mutate walk-only never uses the region information: it exits 1 only if the call count of case 9 -// fails and nothing else does. Either exits 0 otherwise, so its WILL_FAIL test fails. A refused -// allocation or mapping is a capability skip (77) in the controls and a failure in the main check. +// passes (exits 0) only if decisions differ in the partly committed cases and nowhere else. +// --mutate walk-only never uses the region information: it passes only if the call count of case 9 +// fails and nothing else does. Either exits 1 otherwise. The controls are ordinary tests, not +// WILL_FAIL, so a crash or another failure cannot pass them. A refused allocation or mapping is a +// capability skip (77) in the controls and a failure in the main check. #include "startup_stubs/placed_buffer_range.h" #include @@ -421,7 +422,7 @@ int main(int argc, char** argv) std::fprintf(stderr, "placed buffer range control: failures other %d, partly committed %d, cost %d -> %s\n", failures[other], failures[partial], failures[cost], stated ? "failed for the stated reason" : "did NOT fail for the stated reason"); - return stated ? 1 : 0; + return stated ? 0 : 1; } if (total || setup_failures) { std::fprintf(stderr, "placed buffer range: %d failure(s), %d setup failure(s)\n", total, setup_failures);