From: Aram Sargsyan Date: Wed, 16 Apr 2025 12:56:18 +0000 (+0000) Subject: Fix the isc_rwlock_tryupgrade() function's unit test X-Git-Tag: v9.21.8~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c27659bc623f2d58bccc9e0d99ca1ad180e8180b;p=thirdparty%2Fbind9.git Fix the isc_rwlock_tryupgrade() function's unit test The pthread-based implementation of the isc_rwlock_tryupgrade() function always returns ISC_R_LOCKBUSY. Fix the test by adding conditional checks. --- diff --git a/tests/isc/rwlock_test.c b/tests/isc/rwlock_test.c index 74f9e4ca22a..893f8cfc4d4 100644 --- a/tests/isc/rwlock_test.c +++ b/tests/isc/rwlock_test.c @@ -138,8 +138,17 @@ ISC_RUN_TEST_IMPL(isc_rwlock_tryupgrade) { isc_result_t result; isc_rwlock_lock(&rwlock, isc_rwlocktype_read); result = isc_rwlock_tryupgrade(&rwlock); +#if USE_PTHREAD_RWLOCK + /* + * Our pthread-based rwlock implementation does not support tryupgrade, + * and always returns ISC_R_LOCKBUSY. + */ + assert_int_equal(result, ISC_R_LOCKBUSY); + isc_rwlock_unlock(&rwlock, isc_rwlocktype_read); +#else assert_int_equal(result, ISC_R_SUCCESS); isc_rwlock_unlock(&rwlock, isc_rwlocktype_write); +#endif /* USE_PTHREAD_RWLOCK */ } static void *