From 9bba50dd4ade8444469bcf3d374c3358ded44ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Wed, 27 Jan 2021 14:36:55 +0100 Subject: [PATCH] Set ulimit only with many CPUs Allow ulimit setting fail without breaking the build. Some builders do not allow changing ulimit, that would not be a problem on most of builders. Use it more a hint than requirement. --- bind.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bind.spec b/bind.spec index c67b140..4e3ad7e 100644 --- a/bind.spec +++ b/bind.spec @@ -598,15 +598,18 @@ export TSAN_OPTIONS="log_exe_name=true log_path=ThreadSanitizer exitcode=0" %if %{with UNITTEST} pushd build - ORIGFILES=$(ulimit -n) - ulimit -n 4096 # Requires on some machines with many cores + CPUS=$(lscpu -p=cpu,core | grep -v '^#' | wc -l) + if [ "$CPUS" -gt 16 ]; then + ORIGFILES=$(ulimit -n) + ulimit -n 4096 || : # Requires on some machines with many cores + fi make unit e=$? if [ "$e" -ne 0 ]; then echo "ERROR: this build of BIND failed 'make unit'. Aborting." exit $e; fi; - ulimit -n $ORIGFILES + [ "$CPUS" -gt 16 ] && ulimit -n $ORIGFILES || : popd ## End of UNITTEST %endif