com php-src: Split shmop/tests/002.phpt in two (all + non-root): ext/shmop/tests/002.phpt ext/shmop/tests/003.phpt

From: Date: Tue, 10 Nov 2015 08:10:10 +0000
Subject: com php-src: Split shmop/tests/002.phpt in two (all + non-root): ext/shmop/tests/002.phpt ext/shmop/tests/003.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89725@lists.php.net to get a copy of this message
Commit: 3cb3979de302626af8d7bd24472ba5798693ef70 Author: Matteo Beccati <mbeccati@php.net> Tue, 10 Nov 2015 09:02:40 +0100 Parents: 6fa9b76342a924b2438621deba732c270a0d2859 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3cb3979de302626af8d7bd24472ba5798693ef70 Log: 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. Changed paths: M ext/shmop/tests/002.phpt A ext/shmop/tests/003.phpt Diff: diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt index 872fc93..3206f90 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 0000000..1c154f0 --- /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)

« previous php.cvs (#89725) next »