Merge branch '3764-adjust-descriptors-for-some-unit-tests' into 'main'

Resolve "Adjust descriptor limit for some unit tests"

Closes #3764

See merge request isc-projects/bind9!7294
This commit is contained in:
Mark Andrews 2023-01-11 11:04:07 +00:00
commit 40077f6f75

View file

@ -17,6 +17,7 @@
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <time.h>
#include <isc/buffer.h>
@ -40,6 +41,18 @@ isc_taskmgr_t *taskmgr = NULL;
isc_nm_t *netmgr = NULL;
unsigned int workers = -1;
static void
adjustnofile(void) {
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
if (rl.rlim_cur != rl.rlim_max) {
rl.rlim_cur = rl.rlim_max;
setrlimit(RLIMIT_NOFILE, &rl);
}
}
}
int
setup_mctx(void **state __attribute__((__unused__))) {
isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
@ -107,6 +120,8 @@ int
setup_netmgr(void **state __attribute__((__unused__))) {
REQUIRE(loopmgr != NULL);
adjustnofile();
isc_netmgr_create(mctx, loopmgr, &netmgr);
return (0);