tyrael Sun, 23 Oct 2011 00:07:01 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=318331
Log:
check the available memory on linux and skip if it is not enough
Changed paths:
U php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt
U php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt
U php/php-src/trunk/Zend/tests/bug55509.phpt
Modified: php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt 2011-10-22
23:47:52 UTC (rev 318330)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug55509.phpt 2011-10-23
00:07:01 UTC (rev 318331)
@@ -5,6 +5,21 @@
if (PHP_INT_SIZE == 4) {
die('skip Not for 32-bits OS');
}
+// check the available memory
+if (PHP_OS == 'Linux') {
+ $lines = file('/proc/meminfo');
+ $infos = array();
+ foreach ($lines as $line) {
+ $tmp = explode(":", $line);
+ $index = strtolower($tmp[0]);
+ $value = (int)ltrim($tmp[1], " ")*1024;
+ $infos[$index] = $value;
+ }
+ $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
+ if ($freeMemory < 2100*1024*1024) {
+ die('skip Not enough memory.');
+ }
+}
?>
--INI--
memory_limit=2100M
Modified: php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt 2011-10-22
23:47:52 UTC (rev 318330)
+++ php/php-src/branches/PHP_5_4/Zend/tests/bug55509.phpt 2011-10-23
00:07:01 UTC (rev 318331)
@@ -5,6 +5,21 @@
if (PHP_INT_SIZE == 4) {
die('skip Not for 32-bits OS');
}
+// check the available memory
+if (PHP_OS == 'Linux') {
+ $lines = file('/proc/meminfo');
+ $infos = array();
+ foreach ($lines as $line) {
+ $tmp = explode(":", $line);
+ $index = strtolower($tmp[0]);
+ $value = (int)ltrim($tmp[1], " ")*1024;
+ $infos[$index] = $value;
+ }
+ $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
+ if ($freeMemory < 2100*1024*1024) {
+ die('skip Not enough memory.');
+ }
+}
?>
--INI--
memory_limit=2100M
Modified: php/php-src/trunk/Zend/tests/bug55509.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug55509.phpt 2011-10-22 23:47:52 UTC (rev
318330)
+++ php/php-src/trunk/Zend/tests/bug55509.phpt 2011-10-23 00:07:01 UTC (rev
318331)
@@ -5,6 +5,21 @@
if (PHP_INT_SIZE == 4) {
die('skip Not for 32-bits OS');
}
+// check the available memory
+if (PHP_OS == 'Linux') {
+ $lines = file('/proc/meminfo');
+ $infos = array();
+ foreach ($lines as $line) {
+ $tmp = explode(":", $line);
+ $index = strtolower($tmp[0]);
+ $value = (int)ltrim($tmp[1], " ")*1024;
+ $infos[$index] = $value;
+ }
+ $freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
+ if ($freeMemory < 2100*1024*1024) {
+ die('skip Not enough memory.');
+ }
+}
?>
--INI--
memory_limit=2100M
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php