@@ -1211,17 +1211,15 @@ UT_TEST(test_retained_image_release_and_writeback_gates_are_exact)
12111211 if (conditional != NULL ) {
12121212 const char * content
12131213 = strstr (conditional , "LWLockConditionalAcquire(BufferDescriptorGetContentLock(buf)" );
1214- const char * ownership = strstr (conditional , "buf->pcm_state != (uint8) PCM_STATE_X" );
1215- const char * flags = strstr (conditional , "cluster_pcm_own_flags_get(buf->buf_id) != 0" );
1214+ const char * ownership = strstr (conditional , "cluster_pcm_x_conditional_lock_allowed(" );
12161215 const char * release
12171216 = strstr (conditional , "LWLockRelease(BufferDescriptorGetContentLock(buf))" );
12181217
12191218 UT_ASSERT_NOT_NULL (content );
12201219 UT_ASSERT_NOT_NULL (ownership );
1221- UT_ASSERT_NOT_NULL (flags );
12221220 UT_ASSERT_NOT_NULL (release );
1223- if (content != NULL && ownership != NULL && flags != NULL && release != NULL )
1224- UT_ASSERT (content < ownership && ownership < flags && flags < release );
1221+ if (content != NULL && ownership != NULL && release != NULL )
1222+ UT_ASSERT (content < ownership && ownership < release );
12251223 }
12261224 if (resident_stamp != NULL ) {
12271225 const char * content = strstr (
@@ -1659,6 +1657,18 @@ UT_TEST(test_current_image_shape_accepts_monotone_xcur_after_x_to_s_yield)
16591657 UT_ASSERT (!cluster_pcm_x_current_image_shape ((uint8 )PCM_STATE_S , (uint8 )BUF_TYPE_XCUR , false));
16601658}
16611659
1660+ UT_TEST (test_conditional_lock_preserves_native_off_and_enforces_tracked_x )
1661+ {
1662+ UT_ASSERT (cluster_pcm_x_conditional_lock_allowed (false, true, false, (uint8 )PCM_STATE_N , 0 ));
1663+ UT_ASSERT (cluster_pcm_x_conditional_lock_allowed (true, false, false, (uint8 )PCM_STATE_N , 0 ));
1664+ UT_ASSERT (!cluster_pcm_x_conditional_lock_allowed (true, true, false, (uint8 )PCM_STATE_N , 0 ));
1665+ UT_ASSERT (!cluster_pcm_x_conditional_lock_allowed (true, true, false, (uint8 )PCM_STATE_S , 0 ));
1666+ UT_ASSERT (cluster_pcm_x_conditional_lock_allowed (true, true, false, (uint8 )PCM_STATE_X , 0 ));
1667+ UT_ASSERT (!cluster_pcm_x_conditional_lock_allowed (false, false, true, (uint8 )PCM_STATE_X , 0 ));
1668+ UT_ASSERT (!cluster_pcm_x_conditional_lock_allowed (false, false, false, (uint8 )PCM_STATE_X ,
1669+ PCM_OWN_FLAG_GRANT_PENDING ));
1670+ }
1671+
16621672UT_TEST (test_queue_passive_n_mirror_is_never_gcs_ship_authority )
16631673{
16641674 static const char * const probe_contract []
@@ -1977,7 +1987,7 @@ UT_TEST(test_lockbuffer_pcm_x_writer_ledger_is_distinct_and_brackets_content_aut
19771987int
19781988main (void )
19791989{
1980- UT_PLAN (44 );
1990+ UT_PLAN (45 );
19811991 UT_RUN (test_shmem_initializes_complete_entry );
19821992 UT_RUN (test_begin_abort_is_exact_and_monotonic );
19831993 UT_RUN (test_invalid_live_flag_shapes_are_corrupt_not_busy );
@@ -2017,6 +2027,7 @@ main(void)
20172027 UT_RUN (test_queue_holder_snapshot_by_tag_is_mapping_and_header_exact );
20182028 UT_RUN (test_queue_passive_pinned_s_release_serializes_bytes_and_ownership );
20192029 UT_RUN (test_current_image_shape_accepts_monotone_xcur_after_x_to_s_yield );
2030+ UT_RUN (test_conditional_lock_preserves_native_off_and_enforces_tracked_x );
20202031 UT_RUN (test_queue_installed_image_publication_is_exact_and_content_locked );
20212032 UT_RUN (test_queue_self_source_handoff_is_single_lifecycle_and_readonly_drain );
20222033 UT_RUN (test_queue_passive_n_mirror_is_never_gcs_ship_authority );
0 commit comments