diff options
author | Ferenc Kovacs <tyrael@php.net> | 2011-11-02 21:27:03 +0000 |
---|---|---|
committer | Ferenc Kovacs <tyrael@php.net> | 2011-11-02 21:27:03 +0000 |
commit | 6c01aacc0d971fc35536268fb0f7b810900fa4c6 (patch) | |
tree | 951b8e164af8217624a741a31ded432dd2109950 | |
parent | 6781f175753f04e73ec9849cd2d911cf35c85e1e (diff) | |
download | php-git-6c01aacc0d971fc35536268fb0f7b810900fa4c6.tar.gz |
adding memory check for FreeBSD also, TODO: refactor the free memory check into a function in an include file
-rw-r--r-- | Zend/tests/bug55509.phpt | 19 |
1 files changed, 19 insertions, 0 deletions
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
|