diff options
| author | Stefan Esser | 2014-02-11 12:41:40 +0100 |
|---|---|---|
| committer | Stefan Esser | 2014-02-11 12:41:40 +0100 |
| commit | d9819967e4848bcc4c22273a7778863da2b3f3f6 (patch) | |
| tree | 22a66f5fc70dd414bc2f3d0e6c3a436b6880c6b1 /tests | |
| parent | 4c7050932250b9103d91d9b5a4cea95b8aca2b6a (diff) | |
Add some memory_limit tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/executor/memory_limit_64bit.phpt | 43 | ||||
| -rw-r--r-- | tests/executor/memory_limit_64bit_10G.phpt | 36 |
2 files changed, 79 insertions, 0 deletions
diff --git a/tests/executor/memory_limit_64bit.phpt b/tests/executor/memory_limit_64bit.phpt new file mode 100644 index 0000000..e7529e8 --- /dev/null +++ b/tests/executor/memory_limit_64bit.phpt | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | --TEST-- | ||
| 2 | memory_limit test: set suhosin hard_limit to normal limit (64 bit) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!function_exists("memory_get_usage")) print "skip PHP not compiled with memory_limit support"; | ||
| 5 | else if (PHP_INT_SIZE != 8) print "skip This is not a 64 bit system"; | ||
| 6 | ?> | ||
| 7 | --INI-- | ||
| 8 | memory_limit=16M | ||
| 9 | suhosin.memory_limit=0 | ||
| 10 | suhosin.log.syslog=0 | ||
| 11 | suhosin.log.script=0 | ||
| 12 | suhosin.log.sapi=2 | ||
| 13 | --FILE-- | ||
| 14 | <?php | ||
| 15 | ini_set("memory_limit", "13M"); echo ini_get("memory_limit"), "\n"; | ||
| 16 | ini_set("memory_limit", "14M"); echo ini_get("memory_limit"), "\n"; | ||
| 17 | ini_set("memory_limit", "15M"); echo ini_get("memory_limit"), "\n"; | ||
| 18 | ini_set("memory_limit", "16M"); echo ini_get("memory_limit"), "\n"; | ||
| 19 | ini_set("memory_limit", "17M"); echo ini_get("memory_limit"), "\n"; | ||
| 20 | ini_set("memory_limit", "18M"); echo ini_get("memory_limit"), "\n"; | ||
| 21 | ini_set("memory_limit", "2G"); echo ini_get("memory_limit"), "\n"; | ||
| 22 | ini_set("memory_limit", "3G"); echo ini_get("memory_limit"), "\n"; | ||
| 23 | ini_set("memory_limit", "4G"); echo ini_get("memory_limit"), "\n"; | ||
| 24 | ini_set("memory_limit", "5G"); echo ini_get("memory_limit"), "\n"; | ||
| 25 | ?> | ||
| 26 | --EXPECTF-- | ||
| 27 | 13M | ||
| 28 | 14M | ||
| 29 | 15M | ||
| 30 | 16M | ||
| 31 | ALERT - script tried to increase memory_limit to 17825792 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 6) | ||
| 32 | 16M | ||
| 33 | ALERT - script tried to increase memory_limit to 18874368 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 7) | ||
| 34 | 16M | ||
| 35 | ALERT - script tried to increase memory_limit to 2147483648 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 8) | ||
| 36 | 16M | ||
| 37 | ALERT - script tried to increase memory_limit to 3221225472 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 9) | ||
| 38 | 16M | ||
| 39 | ALERT - script tried to increase memory_limit to 0 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 10) | ||
| 40 | 16M | ||
| 41 | ALERT - script tried to increase memory_limit to 1073741824 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '%s', line 11) | ||
| 42 | 16M | ||
| 43 | |||
diff --git a/tests/executor/memory_limit_64bit_10G.phpt b/tests/executor/memory_limit_64bit_10G.phpt new file mode 100644 index 0000000..284db50 --- /dev/null +++ b/tests/executor/memory_limit_64bit_10G.phpt | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | --TEST-- | ||
| 2 | memory_limit test: set suhosin hard_limit to normal limit (64 bit) - 10 GB | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!function_exists("memory_get_usage")) print "skip PHP not compiled with memory_limit support"; | ||
| 5 | else if (PHP_INT_SIZE != 8) print "skip This is not a 64 bit system"; | ||
| 6 | ?> | ||
| 7 | --INI-- | ||
| 8 | memory_limit=10G | ||
| 9 | suhosin.memory_limit=0 | ||
| 10 | suhosin.log.syslog=0 | ||
| 11 | suhosin.log.script=0 | ||
| 12 | suhosin.log.sapi=2 | ||
| 13 | --FILE-- | ||
| 14 | <?php | ||
| 15 | ini_set("memory_limit", "13M"); echo ini_get("memory_limit"), "\n"; | ||
| 16 | ini_set("memory_limit", "14M"); echo ini_get("memory_limit"), "\n"; | ||
| 17 | ini_set("memory_limit", "15M"); echo ini_get("memory_limit"), "\n"; | ||
| 18 | ini_set("memory_limit", "16M"); echo ini_get("memory_limit"), "\n"; | ||
| 19 | ini_set("memory_limit", "17M"); echo ini_get("memory_limit"), "\n"; | ||
| 20 | ini_set("memory_limit", "18M"); echo ini_get("memory_limit"), "\n"; | ||
| 21 | ini_set("memory_limit", "2G"); echo ini_get("memory_limit"), "\n"; | ||
| 22 | ini_set("memory_limit", "3G"); echo ini_get("memory_limit"), "\n"; | ||
| 23 | ini_set("memory_limit", "4G"); echo ini_get("memory_limit"), "\n"; | ||
| 24 | ini_set("memory_limit", "5G"); echo ini_get("memory_limit"), "\n"; | ||
| 25 | ?> | ||
| 26 | --EXPECTF-- | ||
| 27 | 13M | ||
| 28 | 14M | ||
| 29 | 15M | ||
| 30 | 16M | ||
| 31 | 17M | ||
| 32 | 18M | ||
| 33 | 2G | ||
| 34 | 3G | ||
| 35 | 4G | ||
| 36 | 5G | ||
