1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 22:41:20 +02:00
Files
archived-php-src/ext/gmp/tests/gmp_setbit_long.phpt
Anatol Belski 904e0d7212 Skip on Travis-CI
The current doc states max ram for a test VM would be 7.5G, the
currently used container image has even less. This skip should be
revisited, as the available memory amount shifts. The way of checking
/proc/meminfo doesn't work reliably on containers at least, thus
skipping explicitly on Travis-CI makes sense.
2018-01-03 18:32:33 +01:00

43 lines
1.1 KiB
PHP

--TEST--
gmp_setbit() with large index
--SKIPIF--
<?php if (getenv("TRAVIS") === "true") die("skip not suitable for Travis-CI"); ?>
<?php if (!extension_loaded("gmp")) print "skip"; ?>
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
<?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?>
<?php
/* This test requires about 8G RAM which likely not to be present on an arbitrary CI. */
if (!file_exists("/proc/meminfo")) {
die("skip cannot determine free memory amount.");
}
$s = file_get_contents("/proc/meminfo");
$free = 0;
if (preg_match(",MemFree:\s+(\d+)\s+kB,", $s, $m)) {
/* Got amount in kb. */
$free = $m[1]/1024/1024;
}
if ($free < 8) {
die("skip not enough free RAM.");
}
?>
--FILE--
<?php
$n = gmp_init("227200");
for($a = 1<<30; $a > 0 && $a < 0x8000000000; $a <<= 2) {
$i = $a - 1;
printf("%X\n", $i);
gmp_setbit($n, $i, 1);
}
echo "Done\n";
?>
--EXPECTF--
3FFFFFFF
FFFFFFFF
3FFFFFFFF
FFFFFFFFF
3FFFFFFFFF
Warning: gmp_setbit(): Index must be less than %d * %d in %s/gmp_setbit_long.php on line %d
Done