From 6c01aacc0d971fc35536268fb0f7b810900fa4c6 Mon Sep 17 00:00:00 2001 From: Ferenc Kovacs Date: Wed, 2 Nov 2011 21:27:03 +0000 Subject: [PATCH] adding memory check for FreeBSD also, TODO: refactor the free memory check into a function in an include file --- Zend/tests/bug55509.phpt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index 212cc9bbc0..b78fceb0da 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -21,6 +21,25 @@ if (PHP_OS == 'Linux') { die('skip Not enough memory.'); } } +elseif (PHP_OS == 'FreeBSD') { + $lines = explode("\n",`sysctl -a`); + $infos = array(); + foreach ($lines as $line) { + if(!$line){ + continue; + } + $tmp = explode(":", $line); + $index = strtolower($tmp[0]); + $value = trim($tmp[1], " "); + $infos[$index] = $value; + } + $freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize']) + +($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize']) + +($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']); + if ($freeMemory < 2100*1024*1024) { + die('skip Not enough memory.'); + } +} ?> --INI-- memory_limit=2100M -- 2.40.0