diff options
author | Matteo Beccati <mbeccati@php.net> | 2015-11-10 09:02:40 +0100 |
---|---|---|
committer | Matteo Beccati <mbeccati@php.net> | 2015-11-10 09:10:10 +0100 |
commit | 3cb3979de302626af8d7bd24472ba5798693ef70 (patch) | |
tree | d785764105606d0a535abd72db1eaecd3ee3ec5b /ext/shmop | |
parent | 6fa9b76342a924b2438621deba732c270a0d2859 (diff) | |
download | php-git-3cb3979de302626af8d7bd24472ba5798693ef70.tar.gz |
Split shmop/tests/002.phpt in two (all + non-root)
One of the conditions tested was expected to fail with "Permission denied",
but it doesn't when running as root. The memory segment was also leaked, hence
the split.
Diffstat (limited to 'ext/shmop')
-rw-r--r-- | ext/shmop/tests/002.phpt | 6 | ||||
-rw-r--r-- | ext/shmop/tests/003.phpt | 33 |
2 files changed, 33 insertions, 6 deletions
diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt index 872fc934fe..3206f90776 100644 --- a/ext/shmop/tests/002.phpt +++ b/ext/shmop/tests/002.phpt @@ -33,9 +33,6 @@ echo PHP_EOL, '## shmop_open function tests ##'; // warning outputs: Shared memory segment size must be greater than zero var_dump(shmop_open($hex_shm_id(), "c", 0666, 0)); - // warning outputs: unable to get shared memory segment information - var_dump(shmop_open($hex_shm_id(), 'n', 0, 1024)); - echo PHP_EOL, '## shmop_read function tests ##'; // warning outputs: 3 parameters expected var_dump(shmop_read()); @@ -88,9 +85,6 @@ bool(false) Warning: shmop_open(): Shared memory segment size must be greater than zero in %s on line %d bool(false) -Warning: shmop_open(): unable to get shared memory segment information 'Permission denied' in %s on line %d -bool(false) - ## shmop_read function tests ## Warning: shmop_read() expects exactly 3 parameters, 0 given in %s on line %d NULL diff --git a/ext/shmop/tests/003.phpt b/ext/shmop/tests/003.phpt new file mode 100644 index 0000000000..1c154f08ca --- /dev/null +++ b/ext/shmop/tests/003.phpt @@ -0,0 +1,33 @@ +--TEST-- +shmop extension error messages (non-root) +--SKIPIF-- +<?php + if( substr(PHP_OS, 0, 3) == "WIN") { + die('skip not for Windows'); + } + if (!extension_loaded("shmop")) { + die("skip shmop extension not available"); + } + if (!extension_loaded("posix")) { + die("skip posix extension not available"); + } + if (!posix_geteuid()) { + die("skip cannot run test as root"); + } +?> +--FILE-- +<?php + $hex_shm_id = function(){ + return mt_rand(1338, 9999); + }; + +echo '## shmop_open function tests ##', PHP_EOL; + // warning outputs: unable to get shared memory segment information + var_dump(shmop_open($hex_shm_id(), 'n', 0, 1024)); + +?> +--EXPECTF-- +## shmop_open function tests ## + +Warning: shmop_open(): unable to get shared memory segment information 'Permission denied' in %s on line %d +bool(false) |