diff options
Diffstat (limited to 'ext/pcntl/tests')
| -rwxr-xr-x | ext/pcntl/tests/001.exp | 0 | ||||
| -rwxr-xr-x | ext/pcntl/tests/001.out | 1 | ||||
| -rwxr-xr-x | ext/pcntl/tests/001.php | 14 | ||||
| -rw-r--r-- | ext/pcntl/tests/001.phpt | 76 |
4 files changed, 63 insertions, 28 deletions
diff --git a/ext/pcntl/tests/001.exp b/ext/pcntl/tests/001.exp deleted file mode 100755 index e69de29bb2..0000000000 --- a/ext/pcntl/tests/001.exp +++ /dev/null diff --git a/ext/pcntl/tests/001.out b/ext/pcntl/tests/001.out deleted file mode 100755 index efbc584688..0000000000 --- a/ext/pcntl/tests/001.out +++ /dev/null @@ -1 +0,0 @@ -pcntl extension is available
\ No newline at end of file diff --git a/ext/pcntl/tests/001.php b/ext/pcntl/tests/001.php deleted file mode 100755 index d3be528a2a..0000000000 --- a/ext/pcntl/tests/001.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -echo "pcntl extension is available"; -/* - you can add regression tests for your extension here - - the output of your test code has to be equal to the - text in the --EXPECT-- section below for the tests - to pass, differences between the output and the - expected text are interpreted as failure - - see php4/tests/README for further information on - writing regression tests -*/ -?> diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt index af214d0f62..d2f9923b95 100644 --- a/ext/pcntl/tests/001.phpt +++ b/ext/pcntl/tests/001.phpt @@ -1,22 +1,72 @@ --TEST-- -Check for pcntl presence +Test pcntl wait functionality --SKIPIF-- <?php if (!extension_loaded("pcntl")) print "skip"; ?> --POST-- --GET-- --FILE-- <?php -echo "pcntl extension is available"; -/* - you can add regression tests for your extension here - - the output of your test code has to be equal to the - text in the --EXPECT-- section below for the tests - to pass, differences between the output and the - expected text are interpreted as failure - - see php4/tests/README for further information on - writing regression tests -*/ +function test_exit_waits(){ + print "\n\nTesting pcntl_wifexited and wexitstatus...."; + + $pid=pcntl_fork(); + if ($pid==0) { + sleep(1); + exit(-1); + } else { + $options=0; + pcntl_waitpid($pid, &$status, $options); + if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status); + } +} + +function test_exit_signal(){ + print "\n\nTesting pcntl_wifsignaled...."; + + $pid=pcntl_fork(); + + if ($pid==0) { + sleep(10); + exit; + } else { + $options=0; + posix_kill($pid, SIGTERM); + pcntl_waitpid($pid, &$status, $options); + if ( pcntl_wifsignaled($status) ) print "\nProcess was terminated by signal : ". pcntl_wtermsig($status); + } +} + + +function test_stop_signal(){ + print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig...."; + + $pid=pcntl_fork(); + + if ($pid==0) { + sleep(1); + exit; + } else { + $options=WUNTRACED; + posix_kill($pid, SIGSTOP); + pcntl_waitpid($pid, &$status, $options); + if ( pcntl_wifstopped($status) ) print "\nProcess was stoped by signal : ". pcntl_wstopsig($status); + posix_kill($pid, SIGCONT); + } +} + +print "Staring wait.h tests...."; +test_exit_waits(); +test_exit_signal(); +test_stop_signal(); ?> --EXPECT-- +Staring wait.h tests.... + +Testing pcntl_wifexited and wexitstatus....-1 +Exited With: -1 + +Testing pcntl_wifsignaled.... +Process was terminated by signal : 15 + +Testing pcntl_wifstopped and pcntl_wstopsig.... +Process was stoped by signal : 19 |
