From 2f0b63b6df49e37ed2cb8106745dc3ba49ec7650 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Fri, 12 Sep 2008 19:49:38 +0000 Subject: [PATCH] Add tests for pcntl --- ext/pcntl/tests/pcntl_alarm.phpt | 23 +++++++++++ ext/pcntl/tests/pcntl_exec.phpt | 12 ++++++ ext/pcntl/tests/pcntl_exec_2.phpt | 22 +++++++++++ ext/pcntl/tests/pcntl_exec_3.phpt | 15 +++++++ ext/pcntl/tests/pcntl_signal.phpt | 41 +++++++++++++++++++ ext/pcntl/tests/pcntl_wait.phpt | 66 +++++++++++++++++++++++++++++++ 6 files changed, 179 insertions(+) create mode 100644 ext/pcntl/tests/pcntl_alarm.phpt create mode 100644 ext/pcntl/tests/pcntl_exec.phpt create mode 100644 ext/pcntl/tests/pcntl_exec_2.phpt create mode 100644 ext/pcntl/tests/pcntl_exec_3.phpt create mode 100644 ext/pcntl/tests/pcntl_signal.phpt create mode 100644 ext/pcntl/tests/pcntl_wait.phpt diff --git a/ext/pcntl/tests/pcntl_alarm.phpt b/ext/pcntl/tests/pcntl_alarm.phpt new file mode 100644 index 0000000000..a9cae1616b --- /dev/null +++ b/ext/pcntl/tests/pcntl_alarm.phpt @@ -0,0 +1,23 @@ +--TEST-- +pcntl_alarm() +--SKIPIF-- + +--INI-- +max_execution_time=0 +--FILE-- + 0); +$siginfo = array(); +var_dump(pcntl_sigtimedwait(array(SIGALRM),$siginfo,2) === SIGALRM); +?> +--EXPECTF-- +Warning: pcntl_alarm() expects exactly 1 parameter, 0 given in %s +NULL +int(0) +bool(true) +bool(true) diff --git a/ext/pcntl/tests/pcntl_exec.phpt b/ext/pcntl/tests/pcntl_exec.phpt new file mode 100644 index 0000000000..756fc959c3 --- /dev/null +++ b/ext/pcntl/tests/pcntl_exec.phpt @@ -0,0 +1,12 @@ +--TEST-- +pcntl_exec() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/ext/pcntl/tests/pcntl_exec_2.phpt b/ext/pcntl/tests/pcntl_exec_2.phpt new file mode 100644 index 0000000000..d1672d2a30 --- /dev/null +++ b/ext/pcntl/tests/pcntl_exec_2.phpt @@ -0,0 +1,22 @@ +--TEST-- +pcntl_exec() 2 +--SKIPIF-- + +--FILE-- + b"1", + b"FOO" => b"BAR", + 1 => b"long") +); + +echo "nok\n"; +?> +--EXPECT-- +ok +string(3) "BAR" diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt new file mode 100644 index 0000000000..1017593b5f --- /dev/null +++ b/ext/pcntl/tests/pcntl_exec_3.phpt @@ -0,0 +1,15 @@ +--TEST-- +pcntl_exec() 3 +--FILE-- + "bar"))); +unlink($file); +?> +--EXPECTF-- +Warning: pcntl_exec() expects at least 1 parameter, 0 given %s +NULL + +Warning: pcntl_exec(): Error has occured: (errno %d) %s +bool(false) diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt new file mode 100644 index 0000000000..977f26fbcc --- /dev/null +++ b/ext/pcntl/tests/pcntl_signal.phpt @@ -0,0 +1,41 @@ +--TEST-- +pcntl_signal() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +signal dispatched + +Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s +NULL +bool(true) + +Warning: pcntl_signal(): Invalid value for handle argument specified in %s + +Warning: pcntl_signal(): Error assigning signal %s +bool(false) + +Warning: pcntl_signal(): Error assigning signal %s +bool(false) + +Warning: pcntl_signal(): not callable is not a callable function name error in %s +bool(false) +ok diff --git a/ext/pcntl/tests/pcntl_wait.phpt b/ext/pcntl/tests/pcntl_wait.phpt new file mode 100644 index 0000000000..266bb399e5 --- /dev/null +++ b/ext/pcntl/tests/pcntl_wait.phpt @@ -0,0 +1,66 @@ +--TEST-- +pcntl_wait() +--SKIPIF-- + + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +int(42) +int(-1) + +Warning: pcntl_wait() expects at least 1 parameter, 0 given in %s +NULL + +Warning: pcntl_waitpid() expects at least 2 parameters, 0 given in %s +NULL + +Warning: pcntl_wifexited() expects exactly 1 parameter, 0 given in %s +NULL + +Warning: pcntl_wifstopped() expects exactly 1 parameter, 0 given in %s +NULL + +Warning: pcntl_wifsignaled() expects exactly 1 parameter, 0 given in %s +NULL + +Warning: pcntl_wexitstatus() expects exactly 1 parameter, 0 given in %s +NULL + +Warning: pcntl_wtermsig() expects exactly 1 parameter, 0 given in %s +NULL + +Warning: pcntl_wstopsig() expects exactly 1 parameter, 0 given in %s +NULL -- 2.50.1