Annotation of embedaddon/php/ext/posix/tests/posix_kill_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test posix_kill(), posix_get_last_error and posix_strerror() functions : basic functionality
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded('posix')) die('skip - POSIX extension not loaded');
! 6: ?>
! 7: --FILE--
! 8: <?php
! 9: echo "Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions\n";
! 10:
! 11: // Don't rely on PCNTL extension being around
! 12: $SIGKILL = 9;
! 13:
! 14: // TODO Once we have PS open working beef up this test to create a process and kill it
! 15: // for now start at a low pid and find first pid which does not exist.
! 16: $pid = 999;
! 17: do {
! 18: $pid += 1;
! 19: $result = shell_exec("ps -p " . $pid);
! 20: } while (stripos($result, (string)$pid) != FALSE);
! 21:
! 22: echo "Kill pid=" . $pid . "\n";
! 23: var_dump(posix_kill($pid,$SIGKILL));
! 24:
! 25: $errno = posix_get_last_error();
! 26:
! 27: var_dump($errno);
! 28: var_dump(posix_strerror($errno));
! 29:
! 30: ?>
! 31: ===DONE====
! 32: --EXPECTF--
! 33: Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions
! 34: Kill pid=%d
! 35: bool(false)
! 36: int(%d)
! 37: string(%d) %sNo such process%s
! 38: ===DONE====
! 39:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>