wharmby Thu Jun 11 12:30:59 2009 UTC Modified files: /php-src/ext/posix/tests posix_getppid_basic.phpt posix_getpwuid_basic.phpt posix_mknod_basic.phpt posix_getgrgid_basic.phpt posix_getpgid_basic.phpt posix_getpwnam_basic.phpt posix_times_basic.phpt posix_getrlimit_basic.phpt posix_initgroups_basic.phpt posix_getcwd_basic.phpt posix_uname_basic.phpt posix_kill_basic.phpt posix_strerror_error_basic.phpt posix_getgrnam_basic.phpt posix_getgroups_basic.phpt posix_getpgrp_basic.phpt posix_getpid_basic.phpt posix_getsid_basic.phpt Log: New POISX tests. Tested on Windows (all test SKIP), Linux and Linux 64
http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getppid_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getppid_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getppid_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getppid_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,21 @@ +--TEST-- +Test posix_getppid() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getppid function\n"; + + $ppid = posix_getppid(); + + var_dump($ppid); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX getppid function +int(%d) +===DONE==== + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getpwuid_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getpwuid_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getpwuid_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getpwuid_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,30 @@ +--TEST-- +Test posix_getpwuid() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getpwuid\n"; + + + $pwuid = posix_getpwuid(posix_getuid()); + + print_r($pwuid); + +?> +===DONE==== +--EXPECTREGEX-- +Basic test of POSIX getpwuid +Array +\( + \[name\] => [^\r\n]+ + \[passwd\] => [^\r\n]+ + \[uid\] => [0-9]+ + \[gid\] => [0-9]+ + \[gecos\] => [^\r\n]* + \[dir\] => [^\r\n]+ + \[shell\] => [^\r\n]+ +\) +===DONE==== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_mknod_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_mknod_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_mknod_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_mknod_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,18 @@ +--TEST-- +posix_mknod(): Basic tests +--SKIPIF-- +<?php +if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +if (!function_exists('posix_mknod')) die('skip posix_mknod() not found'); +?> +--FILE-- +<?php +echo "Basic test of POSIX posix_mknod function\n"; +var_dump(posix_mknod(NULL, NULL, NULL, NULL)); + +?> +===DONE==== +--EXPECT-- +Basic test of POSIX posix_mknod function +bool(false) +===DONE==== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getgrgid_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getgrgid_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getgrgid_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getgrgid_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,30 @@ +--TEST-- +Test posix_getgrgid() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getgid and getgrid fucntions\n"; + + $gid = posix_getgid(); + $groupinfo = posix_getgrgid($gid); + + print_r($groupinfo); + +?> +===DONE=== +--EXPECTF-- +Basic test of POSIX getgid and getgrid fucntions +Array +( + [name] => %s + [passwd] => %s + [members] => Array +%a + + [gid] => %d +) +===DONE=== + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getpgid_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getpgid_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getpgid_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getpgid_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,23 @@ +--TEST-- +Test posix_getpgid() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of posix_getpgid function\n"; + + $pid = posix_getpid(); + $pgid = posix_getpgid($pid); + + var_dump($pgid); + +?> +===DONE==== +--EXPECTF-- +Basic test of posix_getpgid function +int(%d) +===DONE==== + + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getpwnam_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getpwnam_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getpwnam_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getpwnam_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,23 @@ +--TEST-- +posix_getpwnam(): Basic tests +--SKIPIF-- +<?php +if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +if (!function_exists('posix_getpwnam')) die('skip posix_getpwnam() not found'); +?> +--FILE-- +<?php +echo "Basic test of POSIX posix_getpwnam function\n"; + +var_dump(posix_getpwnam(1)); +var_dump(posix_getpwnam('')); +var_dump(posix_getpwnam(NULL)); + +?> +===DONE==== +--EXPECT-- +Basic test of POSIX posix_getpwnam function +bool(false) +bool(false) +bool(false) +===DONE==== http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_times_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_times_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_times_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_times_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,37 @@ +--TEST-- +Test posix_times() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX times function\n"; + + $times = posix_times(); + + var_dump($times); + + + if ($times == FALSE) { + $errno= posix_get_last_error(); + var_dump(posix_strerror($errno)); + } + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX times function +array(5) { + ["ticks"]=> + int(%d) + ["utime"]=> + int(%d) + ["stime"]=> + int(%d) + ["cutime"]=> + int(%d) + ["cstime"]=> + int(%d) +} +===DONE==== http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getrlimit_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getrlimit_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getrlimit_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getrlimit_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,20 @@ +--TEST-- +posix_getrlimit(): Basic tests +--SKIPIF-- +<?php +if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +if (!function_exists('posix_getrlimit')) die('skip posix_getrlimit() not found'); +?> +--FILE-- +<?php +echo "Basic test of POSIX posix_getrlimit function\n"; +var_dump(posix_getrlimit()); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX posix_getrlimit function +array(%d) { +%a +} +===DONE==== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_initgroups_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_initgroups_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_initgroups_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_initgroups_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,22 @@ +--TEST-- +posix_initgroups(): Basic tests +--SKIPIF-- +<?php +if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found'); +?> +--FILE-- +<?php +echo "Basic test of POSIX posix_initgroups function\n"; +var_dump(posix_initgroups('foo', 'bar')); +var_dump(posix_initgroups(NULL, NULL)); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX posix_initgroups function + +Warning: posix_initgroups() expects parameter 2 to be long, Unicode string given in %s on line %d +bool(false) +bool(false) +===DONE==== http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getcwd_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getcwd_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getcwd_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getcwd_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,22 @@ +--TEST-- +posix_getcwd(): Basic tests +--SKIPIF-- +<?php +if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +if (!function_exists('posix_getcwd')) die('skip posix_getcwd() not found'); +?> +--FILE-- +<?php +echo "Basic test of POSIX posix_getcwd function\n"; +var_dump(posix_getcwd()); +var_dump(posix_getcwd(1)); + +?> +===DONE=== +--EXPECTF-- +Basic test of POSIX posix_getcwd function +string(%d) "%s" + +Warning: posix_getcwd() expects exactly 0 parameters, 1 given in %s on line %d +NULL +===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_uname_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_uname_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_uname_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_uname_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,28 @@ +--TEST-- +Test posix_uname() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX uname function\n"; + + $uname = posix_uname(); + + print_r($uname); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX uname function +Array +( + [sysname] => %s + [nodename] => %s + [release] => %s + [version] => %s + [machine] => %s +) +===DONE==== + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_kill_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_kill_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_kill_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_kill_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,39 @@ +--TEST-- +Test posix_kill(), posix_get_last_error and posix_strerror() functions : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions\n"; + + // Don't rely on PCNTL extension being around + $SIGKILL = 9; + + // TODO Once we have PS open working beef up this test to create a process and kill it + // for now start at a low pid and find first pid which does not exist. + $pid = 999; + do { + $pid += 1; + $result = shell_exec("ps -p " . $pid); + } while (stripos($result, (string)$pid) != FALSE); + + echo "Kill pid=" . $pid . "\n"; + var_dump(posix_kill($pid,$SIGKILL)); + + $errno = posix_get_last_error(); + + var_dump($errno); + var_dump(posix_strerror($errno)); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions +Kill pid=%d +bool(false) +int(%d) +string(%d) %sNo such process%s +===DONE==== + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_strerror_error_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_strerror_error_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_strerror_error_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_strerror_error_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,46 @@ +--TEST-- +Test posix_strerror() function : error conditions +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php +/* Prototype : proto string posix_strerror(int errno) + * Description: Retrieve the system error message associated with the given errno. + * Source code: ext/posix/posix.c + * Alias to functions: + */ + +echo "*** Testing posix_strerror() : error conditions ***\n"; + +echo "\n-- Testing posix_strerror() function with Zero arguments --\n"; +var_dump( posix_strerror() ); + +echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n"; +$errno = posix_get_last_error(); +$extra_arg = 10; +var_dump( posix_strerror($errno, $extra_arg) ); + +echo "\n-- Testing posix_strerror() function with invalid error number --\n"; +$errno = -999; +var_dump( posix_strerror($errno) ); + +?> +===DONE==== +--EXPECTF-- +*** Testing posix_strerror() : error conditions *** + +-- Testing posix_strerror() function with Zero arguments -- + +Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +-- Testing posix_strerror() function with more than expected no. of arguments -- + +Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d +bool(false) + +-- Testing posix_strerror() function with invalid error number -- +string(%d) "Unknown error%s" +===DONE==== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getgrnam_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getgrnam_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getgrnam_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getgrnam_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,23 @@ +--TEST-- +posix_getgrnam(): Basic tests +--SKIPIF-- +<?php +if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +if (!function_exists('posix_getgrnam')) die('skip posix_getgrnam() not found'); +?> +--FILE-- +<?php +echo "Basic test of POSIX posix_getgrnam function\n"; + +var_dump(posix_getgrnam(NULL)); +var_dump(posix_getgrnam(1)); +var_dump(posix_getgrnam('')); + +?> +===DONE=== +--EXPECT-- +Basic test of POSIX posix_getgrnam function +bool(false) +bool(false) +bool(false) +===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getgroups_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getgroups_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getgroups_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getgroups_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,24 @@ +--TEST-- +Test posix_getgroups() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getgroups\n"; + + $groups = posix_getgroups(); + + if (!is_array($groups)) { + echo "TEST FAILED - array result expected\n"; + } else { + echo "TEST PASSED\n"; + } + +?> +===DONE=== +--EXPECT-- +Basic test of POSIX getgroups +TEST PASSED +===DONE=== \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getpgrp_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getpgrp_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getpgrp_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getpgrp_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,21 @@ +--TEST-- +Test posix_getpgrp() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getpgrp function\n"; + + $pgrp = posix_getpgrp(); + + var_dump($pgrp); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX getpgrp function +int(%d) +===DONE==== + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getpid_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getpid_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getpid_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getpid_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,21 @@ +--TEST-- +Test posix_getpid() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of POSIX getpid function\n"; + + $pid = posix_getpid(); + + var_dump($pid); + +?> +===DONE==== +--EXPECTF-- +Basic test of POSIX getpid function +int(%d) +===DONE==== + \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/posix/tests/posix_getsid_basic.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/posix/tests/posix_getsid_basic.phpt diff -u /dev/null php-src/ext/posix/tests/posix_getsid_basic.phpt:1.2 --- /dev/null Thu Jun 11 12:30:59 2009 +++ php-src/ext/posix/tests/posix_getsid_basic.phpt Thu Jun 11 12:30:59 2009 @@ -0,0 +1,22 @@ +--TEST-- +Test posix_getsid() function : basic functionality +--SKIPIF-- +<?php + if (!extension_loaded('posix')) die('skip - POSIX extension not loaded'); +?> +--FILE-- +<?php + echo "Basic test of posix_getsid function\n"; + + $pid = posix_getpid(); + $sid = posix_getsid($pid); + + var_dump($sid); + +?> +===DONE==== +--EXPECTF-- +Basic test of posix_getsid function +int(%d) +===DONE==== + \ No newline at end of file
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php