mirror of
https://gitlab.isc.org/isc-projects/bind9.git
synced 2025-04-18 09:44:09 +03:00
fix: test: 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. Closes #5287 Merge branch '5287-pthread-rwlock-tryupgrade-test-fix' into 'main' See merge request isc-projects/bind9!10398
This commit is contained in:
commit
b3208da958
@ -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 *
|
||||
|
Loading…
x
Reference in New Issue
Block a user