Fix and re-enable test_max_open_file_descriptors.
This test was failing because it was expecting the number of files to be higher than the maxfilesperproc if the hard limit was higher than that, but the behavior is correct.
RELNOTES: None.
@@ -278,12 +278,16 @@ EOF
}
# Fails on CI: https://github.com/bazelbuild/bazel/issues/10679
-function DISABLED_test_max_open_file_descriptors() {
+function test_max_open_file_descriptors() {
echo "nfiles: hard $(ulimit -H -n), soft $(ulimit -S -n)"
local exp_nfiles="$(ulimit -H -n)"
- if [[ "$(uname -s)" == Darwin && "${exp_nfiles}" == unlimited ]]; then
- exp_nfiles="$(/usr/sbin/sysctl -n kern.maxfilesperproc)"
+ if [[ "$(uname -s)" == Darwin ]]; then
+ local maxfiles="$(/usr/sbin/sysctl -n kern.maxfilesperproc)"
+ if [[ "${exp_nfiles}" == "unlimited" || "${exp_nfiles}" -gt "${maxfiles}" ]]
+ then
+ exp_nfiles="${maxfiles}"
+ fi
elif "${is_windows}"; then
# We do not implement the resources unlimiting feature on Windows at
# the moment... so just expect the soft limit to remain unchanged.
