Annotation of embedaddon/php/ext/standard/tests/general_functions/proc_nice_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: proc_nice() basic behaviour
                      3: --CREDITS--
                      4: Italian PHP TestFest 2009 Cesena 19-20-21 june
                      5: Fabio Fabbrucci (fabbrucci@grupporetina.com)
                      6: Michele Orselli (mo@ideato.it)
                      7: Simone Gentili (sensorario@gmail.com)
                      8: --SKIPIF--
                      9: <?php
                     10: if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
                     11: ?>
                     12: --FILE--
                     13: <?php
                     14:        function getNice($id)
                     15:        {
                     16:                $res = shell_exec('ps -p ' . $id .' -o "%p %n"');
                     17:                preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches);
                     18:                if (count($matches) > 2)
                     19:                        return $matches[2];
                     20:                else
                     21:                        return -1;
                     22:        }
                     23:        $delta = 10;
                     24:        $pid = getmypid();
                     25:        $niceBefore = getNice($pid);
                     26:        proc_nice($delta);
                     27:        $niceAfter = getNice($pid);
                     28:        var_dump($niceBefore == ($niceAfter - $delta));
                     29: ?>
                     30: --EXPECTF--
                     31: bool(true)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>