good idea!

please add it as a command line option as well, maybe using a verbose option

On Thu, Sep 1, 2011 at 1:00 PM, Hannes Magnusson <bj...@php.net> wrote:
> bjori                                    Thu, 01 Sep 2011 11:00:51 +0000
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=315967
>
> Log:
> Seeing thousands of PASS tests flying by is meaningless.
> Add an option to only print certain result groups.
>
> Changed paths:
>    U   php/php-src/branches/PHP_5_3/run-tests.php
>    U   php/php-src/branches/PHP_5_4/run-tests.php
>    U   php/php-src/trunk/run-tests.php
>
> Modified: php/php-src/branches/PHP_5_3/run-tests.php
> ===================================================================
> --- php/php-src/branches/PHP_5_3/run-tests.php  2011-09-01 10:16:21 UTC (rev 
> 315966)
> +++ php/php-src/branches/PHP_5_3/run-tests.php  2011-09-01 11:00:51 UTC (rev 
> 315967)
> @@ -207,6 +207,12 @@
>        $DETAILED = 0;
>  }
>
> +if (getenv('SHOW_ONLY_GROUPS')) {
> +       $SHOW_ONLY_GROUPS = explode(",", getenv('SHOW_ONLY_GROUPS'));
> +} else {
> +       $SHOW_ONLY_GROUPS = array();
> +}
> +
>  // Check whether user test dirs are requested.
>  if (getenv('TEST_PHP_USER')) {
>        $user_tests = explode (',', getenv('TEST_PHP_USER'));
> @@ -560,6 +566,9 @@
>                                case 'd':
>                                        $ini_overwrites[] = $argv[++$i];
>                                        break;
> +                               case 'g':
> +                                       $SHOW_ONLY_GROUPS = explode(",", 
> $argv[++$i]);;
> +                                       break;
>                                //case 'h'
>                                case '--keep-all':
>                                        foreach($cfgfiles as $file) {
> @@ -675,6 +684,9 @@
>     -d foo=bar  Pass -d option to the php binary (Define INI entry foo
>                 with value 'bar').
>
> +    -g          Comma seperated list of groups to show during test run
> +                (e.x. FAIL,SKIP).
> +
>     -m          Test for memory leaks with Valgrind.
>
>     -p <php>    Specify PHP executable to run.
> @@ -2426,16 +2438,24 @@
>  function show_test($test_idx, $shortname)
>  {
>        global $test_cnt;
> +       global $line_length;
>
> -       echo "TEST $test_idx/$test_cnt [$shortname]\r";
> +       $str = "TEST $test_idx/$test_cnt [$shortname]\r";
> +       $line_length = strlen($str);
> +       echo $str;
>        flush();
>  }
>
>  function show_result($result, $tested, $tested_file, $extra = '', 
> $temp_filenames = null)
>  {
> -       global $html_output, $html_file, $temp_target, $temp_urlbase;
> +       global $html_output, $html_file, $temp_target, $temp_urlbase, 
> $line_length, $SHOW_ONLY_GROUPS;
>
> -       echo "$result $tested [$tested_file] $extra\n";
> +       if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) {
> +               echo "$result $tested [$tested_file] $extra\n";
> +       } else {
> +               // Write over the last line to avoid random trailing chars on 
> next echo
> +               echo str_repeat(" ", $line_length), "\r";
> +       }
>
>        if ($html_output) {
>
>
> Modified: php/php-src/branches/PHP_5_4/run-tests.php
> ===================================================================
> --- php/php-src/branches/PHP_5_4/run-tests.php  2011-09-01 10:16:21 UTC (rev 
> 315966)
> +++ php/php-src/branches/PHP_5_4/run-tests.php  2011-09-01 11:00:51 UTC (rev 
> 315967)
> @@ -207,6 +207,12 @@
>        $DETAILED = 0;
>  }
>
> +if (getenv('SHOW_ONLY_GROUPS')) {
> +       $SHOW_ONLY_GROUPS = explode(",", getenv('SHOW_ONLY_GROUPS'));
> +} else {
> +       $SHOW_ONLY_GROUPS = array();
> +}
> +
>  // Check whether user test dirs are requested.
>  if (getenv('TEST_PHP_USER')) {
>        $user_tests = explode (',', getenv('TEST_PHP_USER'));
> @@ -560,6 +566,9 @@
>                                case 'd':
>                                        $ini_overwrites[] = $argv[++$i];
>                                        break;
> +                               case 'g':
> +                                       $SHOW_ONLY_GROUPS = explode(",", 
> $argv[++$i]);;
> +                                       break;
>                                //case 'h'
>                                case '--keep-all':
>                                        foreach($cfgfiles as $file) {
> @@ -675,6 +684,9 @@
>     -d foo=bar  Pass -d option to the php binary (Define INI entry foo
>                 with value 'bar').
>
> +    -g          Comma seperated list of groups to show during test run
> +                (e.x. FAIL,SKIP).
> +
>     -m          Test for memory leaks with Valgrind.
>
>     -p <php>    Specify PHP executable to run.
> @@ -2426,16 +2438,24 @@
>  function show_test($test_idx, $shortname)
>  {
>        global $test_cnt;
> +       global $line_length;
>
> -       echo "TEST $test_idx/$test_cnt [$shortname]\r";
> +       $str = "TEST $test_idx/$test_cnt [$shortname]\r";
> +       $line_length = strlen($str);
> +       echo $str;
>        flush();
>  }
>
>  function show_result($result, $tested, $tested_file, $extra = '', 
> $temp_filenames = null)
>  {
> -       global $html_output, $html_file, $temp_target, $temp_urlbase;
> +       global $html_output, $html_file, $temp_target, $temp_urlbase, 
> $line_length, $SHOW_ONLY_GROUPS;
>
> -       echo "$result $tested [$tested_file] $extra\n";
> +       if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) {
> +               echo "$result $tested [$tested_file] $extra\n";
> +       } else {
> +               // Write over the last line to avoid random trailing chars on 
> next echo
> +               echo str_repeat(" ", $line_length), "\r";
> +       }
>
>        if ($html_output) {
>
>
> Modified: php/php-src/trunk/run-tests.php
> ===================================================================
> --- php/php-src/trunk/run-tests.php     2011-09-01 10:16:21 UTC (rev 315966)
> +++ php/php-src/trunk/run-tests.php     2011-09-01 11:00:51 UTC (rev 315967)
> @@ -207,6 +207,12 @@
>        $DETAILED = 0;
>  }
>
> +if (getenv('SHOW_ONLY_GROUPS')) {
> +       $SHOW_ONLY_GROUPS = explode(",", getenv('SHOW_ONLY_GROUPS'));
> +} else {
> +       $SHOW_ONLY_GROUPS = array();
> +}
> +
>  // Check whether user test dirs are requested.
>  if (getenv('TEST_PHP_USER')) {
>        $user_tests = explode (',', getenv('TEST_PHP_USER'));
> @@ -560,6 +566,9 @@
>                                case 'd':
>                                        $ini_overwrites[] = $argv[++$i];
>                                        break;
> +                               case 'g':
> +                                       $SHOW_ONLY_GROUPS = explode(",", 
> $argv[++$i]);;
> +                                       break;
>                                //case 'h'
>                                case '--keep-all':
>                                        foreach($cfgfiles as $file) {
> @@ -675,6 +684,9 @@
>     -d foo=bar  Pass -d option to the php binary (Define INI entry foo
>                 with value 'bar').
>
> +    -g          Comma seperated list of groups to show during test run
> +                (e.x. FAIL,SKIP).
> +
>     -m          Test for memory leaks with Valgrind.
>
>     -p <php>    Specify PHP executable to run.
> @@ -2426,16 +2438,24 @@
>  function show_test($test_idx, $shortname)
>  {
>        global $test_cnt;
> +       global $line_length;
>
> -       echo "TEST $test_idx/$test_cnt [$shortname]\r";
> +       $str = "TEST $test_idx/$test_cnt [$shortname]\r";
> +       $line_length = strlen($str);
> +       echo $str;
>        flush();
>  }
>
>  function show_result($result, $tested, $tested_file, $extra = '', 
> $temp_filenames = null)
>  {
> -       global $html_output, $html_file, $temp_target, $temp_urlbase;
> +       global $html_output, $html_file, $temp_target, $temp_urlbase, 
> $line_length, $SHOW_ONLY_GROUPS;
>
> -       echo "$result $tested [$tested_file] $extra\n";
> +       if (!$SHOW_ONLY_GROUPS || in_array($result, $SHOW_ONLY_GROUPS)) {
> +               echo "$result $tested [$tested_file] $extra\n";
> +       } else {
> +               // Write over the last line to avoid random trailing chars on 
> next echo
> +               echo str_repeat(" ", $line_length), "\r";
> +       }
>
>        if ($html_output) {
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to