summaryrefslogtreecommitdiff
path: root/sapi/cli/tests/upload_2G.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cli/tests/upload_2G.phpt')
-rw-r--r--sapi/cli/tests/upload_2G.phpt12
1 files changed, 9 insertions, 3 deletions
diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt
index 44d2da4a81..82bbbca481 100644
--- a/sapi/cli/tests/upload_2G.phpt
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -8,10 +8,16 @@ if (PHP_INT_SIZE < 8) {
die("skip need PHP_INT_SIZE>=8");
}
+if (!file_exists('/proc/meminfo')) {
+ die('skip Cannot check free RAM from /proc/meminfo on this platform');
+}
+
+$free_ram = 0;
if ($f = fopen("/proc/meminfo","r")) {
while (!feof($f)) {
- if (!strncmp($line = fgets($f), "MemFree", 7)) {
- if (substr($line,8)/1024/1024 > 3) {
+ if (preg_match('/MemFree[^\d]*(\d+)/i', fgets($f), $m)) {
+ $free_ram = max($free_ram, $m[1]/1024/1024);
+ if ($free_ram > 3) {
$enough_free_ram = true;
}
}
@@ -19,7 +25,7 @@ if ($f = fopen("/proc/meminfo","r")) {
}
if (empty($enough_free_ram)) {
- die("skip need +3G free RAM");
+ die(sprintf("skip need +3G free RAM, but only %01.2f available", $free_ram));
}
if (getenv('TRAVIS')) {