helly           Wed Nov 30 20:26:21 2005 EDT

  Modified files:              
    /php-src    run-tests.php 
  Log:
  - New environment TEST_PHP_ARGS to allow appending args to run-tests.php
  - New mode -q (quiet)
  - New mode -s <file> (save output to a file)
  
  
http://cvs.php.net/diff.php/php-src/run-tests.php?r1=1.241&r2=1.242&ty=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.241 php-src/run-tests.php:1.242
--- php-src/run-tests.php:1.241 Wed Nov 30 19:57:29 2005
+++ php-src/run-tests.php       Wed Nov 30 20:26:20 2005
@@ -23,7 +23,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: run-tests.php,v 1.241 2005/12/01 00:57:29 helly Exp $ */
+/* $Id: run-tests.php,v 1.242 2005/12/01 01:26:20 helly Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -220,12 +220,27 @@
 $test_files = array();
 $redir_tests = array();
 $test_results = array();
-$PHP_FAILED_TESTS = array('BORKED' => array(), 'FAILED' => array());
+$PHP_FAILED_TESTS = array('BORKED' => array(), 'FAILED' => array(), 'WARNED' 
=> array());
 
 // If parameters given assume they represent selected tests to run.
 $failed_tests_file= false;
 $pass_option_n = false;
 $pass_options = '';
+
+$compression = 0;              
+$output_file = $CUR_DIR . '/php_test_results_' . date('Ymd_Hi') . ( 
$compression ? '.txt.gz' : '.txt' );
+$just_save_results = false;
+
+if (getenv('TEST_PHP_ARGS'))
+{
+       if (!isset($argc) || !$argc || !isset($argv))
+       {
+               $argv = array(__FILE__);
+       }
+       $argv = array_merge($argv, split(' ', getenv('TEST_PHP_ARGS')));
+       $argc = count($argv);
+}
+
 if (isset($argc) && $argc > 1) {
        for ($i=1; $i<$argc; $i++) {
                if (substr($argv[$i],0,1) == '-') {   
@@ -277,6 +292,13 @@
                                case 'm':
                                        $GLOBALS['leak_check'] = 1;
                                        break;
+                               case 's':
+                                       $output_file = $argv[++$i];
+                                       $just_save_results = true;
+                                       break;
+                               case 'q':
+                                       putenv('NO_INTERACTION', 1);
+                                       break;
                                default:
                                        echo "Illegal switch specified!\n";
                                case "h":
@@ -306,6 +328,10 @@
     -u          Test with unicode_semantics set on.
 
     -m          Test for memory leaks with Valgrind
+    
+    -s <file>   Write output to <file>.
+
+    -q          Quite, no user interaction (same as environment NO_INTERACTION)
 
     -v          Verbose mode.
 
@@ -486,7 +512,8 @@
        flush();
        $user_input = fgets($fp, 10);
        $just_save_results = (strtolower($user_input[0]) == 's');
-       
+}
+if ($just_save_results || !getenv('NO_INTERACTION')) { 
        if ($just_save_results || strlen(trim($user_input)) == 0 || 
strtolower($user_input[0]) == 'y') {
                /*  
                 * Collect information about the host system for our report
@@ -567,10 +594,7 @@
                $failed_tests_data .= $sep . "PHPINFO" . $sep;
                $failed_tests_data .= shell_exec($php.' -dhtml_errors=0 -i');
                
-               $compression = 0;
-               
                if ($just_save_results || !mail_qa_team($failed_tests_data, 
$compression, $status)) {
-                       $output_file = $CUR_DIR . '/php_test_results_' . 
date('Ymd_Hi') . ( $compression ? '.txt.gz' : '.txt' );
                        file_put_contents($output_file, $failed_tests_data);
                
                        if (!$just_save_results) {

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

Reply via email to