Re: SEGV support for run-tests

From: Date: Thu, 03 Jul 2014 09:57:22 +0000
Subject: Re: SEGV support for run-tests
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-75206@lists.php.net to get a copy of this message
Seems about true. I wonder why that's not the case in the run-tests environment... On 3 July 2014 11:40, Ferenc Kovacs <tyrael@php.net> wrote: > > > > On Thu, Jul 3, 2014 at 11:23 AM, Michael Wallner <mike@php.net> wrote: > >> On 3 July 2014 11:18, Ferenc Kovacs <tyrael@php.net> wrote: >> >>> hi, >>> >>> I think the patch is wrong. >>> from my experience, when a proc_opened process is killed via a signal >>> (before you had a chance to proc_close() it) then the exitcode reported by >>> proc_close() and proc_get_status() will be -1, but >>> proc_get_status()["signaled"] will be true and >>> proc_get_status()["termsig"] >>> will have the signalcode of the signal which terminated the process(11 for >>> sigsegv). >>> >> >> This worked: >> >> --TEST-- >> segfault >> --SKIPIF-- >> <?php extension_loaded("posix") or die("skip need posix\n"); >> --FILE-- >> <?php >> echo "before\n"; >> posix_kill(posix_getpid(),11); >> echo "after\n"; >> ?> >> ===DONE=== >> --EXPECTF-- >> before >> >> >> -- >> Regards, >> Mike >> > > [tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5.4 ✗)]$ cat test.php > <?php > $descriptorspec = array( > 0 => array("pipe", "r"), // stdin is a pipe that the child will read > from > 1 => array("pipe", "w"), // stdout is a pipe that the child will > write > to > 2 => array("file", "/tmp/error-output.txt", "a") // stderr > is a file to > write to > ); > > $cwd = '/tmp'; > $env = array(); > > $process = proc_open(PHP_BINARY.' '.__DIR__.'/test2.php', $descriptorspec, > $pipes, $cwd, $env); > sleep(1); > $status = proc_get_status($process); > $exitCode = proc_close($process); > var_dump($exitCode); > var_dump($status); > [tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5.4 ✗)]$ cat test2.php > <?php > echo "before\n"; > posix_kill(posix_getpid(),11); > echo "after\n"; > ?> > [tyrael@Ferencs-MacBook-Pro-135 php-src.git (PHP-5.4 ✗)]$ ./sapi/cli/php > test.php > int(-1) > array(8) { > ["command"]=> > string(94) "/Users/tyrael/checkouts/php-src.git/sapi/cli/php > /Users/tyrael/checkouts/php-src.git/test2.php" > ["pid"]=> > int(9158) > ["running"]=> > bool(false) > ["signaled"]=> > bool(true) > ["stopped"]=> > bool(false) > ["exitcode"]=> > int(-1) > ["termsig"]=> > int(11) > ["stopsig"]=> > int(0) > } > -- Regards, Mike

« previous php.internals (#75206) next »