Re: [PATCH] run-tests.php
| From: | Melvyn Sopacua | Date: | Fri, 01 Nov 2002 15:05:00 +0000 |
| Subject: | Re: [PATCH] run-tests.php | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-90408@lists.php.net to get a copy of this message | ||
At 15:37 1-11-2002, Derick Rethans wrote:
> > Any objections?
>
>We can't object if there is no attachment :)
<?php while($i<100) { echo substr('@#*!$%', mt_rand(1,6), 1); $i++; } ?>
With kind regards,
Melvyn Sopacua
<?php include("not_reflecting_employers_views.txt"); ?>
Index: run-tests.php =================================================================== RCS file: /repository/php4/run-tests.php,v retrieving revision 1.104 diff -u -r1.104 run-tests.php --- run-tests.php 31 Oct 2002 14:01:58 -0000 1.104 +++ run-tests.php 1 Nov 2002 14:17:00 -0000 @@ -280,10 +280,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 @@ -300,7 +302,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"; @@ -323,13 +334,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);
Index: run-tests.php =================================================================== RCS file: /repository/php4/run-tests.php,v retrieving revision 1.104 diff -u -r1.104 run-tests.php --- run-tests.php 31 Oct 2002 14:01:58 -0000 1.104 +++ run-tests.php 1 Nov 2002 14:17:00 -0000 @@ -280,10 +280,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 @@ -300,7 +302,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"; @@ -323,13 +334,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);