msopacua                Sun Nov 10 03:56:28 2002 EDT

  Modified files:              
    /php4       run-tests.php 
  Log:
  - Make it possible for people to save results and/or remove unwanted ENV
    data.
  - Use more options for the CC 'version' flag
  
  
Index: php4/run-tests.php
diff -u php4/run-tests.php:1.118 php4/run-tests.php:1.119
--- php4/run-tests.php:1.118    Thu Nov  7 20:11:05 2002
+++ php4/run-tests.php  Sun Nov 10 03:56:28 2002
@@ -309,10 +309,12 @@
 /* We got failed Tests, offer the user to send and e-mail to QA team, unless 
NO_INTERACTION is set */
 if ($sum_results['FAILED'] && !getenv('NO_INTERACTION')) {
        $fp = fopen("php://stdin", "r+");
-       echo "Some tests have failed, would you like to send the\nreport to PHP's QA 
team? [Yn]: ";
+       echo "Some tests have failed, would you like to send the\nreport to PHP's QA 
+team\n";
+       echo "(choose \"s\" to just save the results to a file)? [Yns]: ";
        $user_input = fgets($fp, 10);
+       $just_save_results = (strtolower($user_input[0]) == 's');
        
-       if (strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
+       if ($just_save_results || strlen(trim($user_input)) == 0 || 
+strtolower($user_input[0]) == 'y') {
                /*  
                 * Collect information about the host system for our report
                 * Fetch phpinfo() output so that we can see the PHP enviroment
@@ -329,7 +331,16 @@
                        $automake = shell_exec('automake --version');
                        $autoconf = shell_exec('autoconf --version');
                        $libtool = shell_exec('libtool --version');
-                       $compiler = shell_exec(getenv('CC').' -v 2>&1');
+                       /* Try the most common flags for 'version' */
+                       $flags = array('-v', '-V', '--version');
+                       $cc_status=0;
+                       foreach($flags AS $flag) {
+                               system(getenv('CC')." $flag >/dev/null 2>&1", 
+$cc_status);
+                               if($cc_status == 0) {
+                                       $compiler = shell_exec(getenv('CC')." $flag 
+2>&1");
+                                       break;
+                               }
+                       }
                }
                $failed_tests_data .= "Automake:\n$automake\n";
                $failed_tests_data .= "Autoconf:\n$autoconf\n";
@@ -352,13 +363,15 @@
                
                $compression = 0;
                
-               if (!mail_qa_team($failed_tests_data, $compression)) {
+               if ($just_save_results || !mail_qa_team($failed_tests_data, 
+$compression)) {
                        $output_file = 'php_test_results_' . date('Ymd') . ( 
$compression ? '.txt.gz' : '.txt' );
                        $fp = fopen($output_file, "w");
                        fwrite($fp, $failed_tests_data);
                        fclose($fp);
                
-                       echo "\nThe test script was unable to automatically send the 
report to PHP's QA Team\nPlease send ".$output_file." to ".PHP_QA_EMAIL." manually, 
thank you.\n";
+                       if (!$just_save_results)
+                           echo "\nThe test script was unable to automatically send 
+the report to PHP's QA Team\n";
+                       echo "Please send ".$output_file." to ".PHP_QA_EMAIL." 
+manually, thank you.\n";
                } else {
                        fwrite($fp, "\nThank you for helping to make PHP better.\n");
                        fclose($fp);



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

Reply via email to