>From 4137965bfa650e82c49782037b504f145311f0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Wed, 16 Dec 2015 02:07:56 +0000 Subject: [PATCH] tests: avoid intermittent ulimit -v failures * init.cfg (get_min_ulimit_v_): Increase the determined virtual memory limit for the command by a page size to avoid alignment issues causing false failures for subsequent runs. This was noticed on i686 linux at: http://hydra.nixos.org/build/28990456 --- init.cfg | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/init.cfg b/init.cfg index e4309ae..277d7ba 100644 --- a/init.cfg +++ b/init.cfg @@ -158,14 +158,24 @@ require_openat_support_() # Return 0 in case of success, and a non-Zero value otherwise. get_min_ulimit_v_() { - local vm + local v + local page_size + + # Increase result by this amount to avoid alignment issues + page_size=$(getconf PAGESIZE || echo 4096) + page_size=$(($page_size / 4)) + for v in $( seq 5000 5000 50000 ); do if ( ulimit -v $v && "$@" ) >/dev/null; then - local vm_prev + local prev_v prev_v=$v for v in $( seq $(($prev_v-1000)) -1000 1000 ); do - ( ulimit -v $v && "$@" ) >/dev/null \ - || { echo $prev_v; return 0; } + ( ulimit -v $v && "$@" ) >/dev/null || \ + { + ret_v=$((prev_v + $page_size)) + echo $ret_v + return 0 + } prev_v=$v done fi -- 2.5.0