Skip to content

Commit 8e00e82

Browse files
authored
[ci skip] Drop ability to send QA reports by email (#8657)
This fails regularly and on top of that we don't look at these reports.
1 parent e7c30c0 commit 8e00e82

File tree

1 file changed

+77
-162
lines changed

1 file changed

+77
-162
lines changed

run-tests.php

Lines changed: 77 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ function main(): void
152152
$cfgfiles, $cfgtypes, $conf_passed, $end_time, $environment,
153153
$exts_skipped, $exts_tested, $exts_to_test, $failed_tests_file,
154154
$ignored_by_ext, $ini_overwrites, $is_switch, $colorize,
155-
$just_save_results, $log_format, $matches, $no_clean, $no_file_cache,
156-
$optionals, $output_file, $pass_option_n, $pass_options,
155+
$log_format, $matches, $no_clean, $no_file_cache,
156+
$optionals, $pass_option_n, $pass_options,
157157
$pattern_match, $php, $php_cgi, $phpdbg, $preload, $redir_tests,
158158
$repeat, $result_tests_file, $slow_min_ms, $start_time, $switch,
159159
$temp_source, $temp_target, $test_cnt, $test_dirs,
@@ -313,9 +313,6 @@ function main(): void
313313

314314
$no_file_cache = '-d opcache.file_cache= -d opcache.file_cache_only=0';
315315

316-
define('PHP_QA_EMAIL', 'qa-reports@lists.php.net');
317-
define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
318-
define('QA_REPORTS_PAGE', 'http://qa.php.net/reports');
319316
define('TRAVIS_CI', (bool) getenv('TRAVIS'));
320317

321318
// Determine the tests to be run.
@@ -731,7 +728,7 @@ function main(): void
731728
echo get_summary(false);
732729

733730
if ($output_file != '' && $just_save_results) {
734-
save_or_mail_results();
731+
save_results($output_file, /* prompt_to_save_results: */ false);
735732
}
736733
} else {
737734
// Compile a list of all test files (*.phpt).
@@ -793,7 +790,7 @@ function main(): void
793790
show_end($end_time);
794791
show_summary();
795792

796-
save_or_mail_results();
793+
save_results($output_file, /* prompt_to_save_results: */ true);
797794
}
798795

799796
$junit->saveXML();
@@ -929,134 +926,101 @@ function write_information(): void
929926
";
930927
}
931928

932-
function save_or_mail_results(): void
929+
function save_results(string $output_file, bool $prompt_to_save_results): void
933930
{
934-
global $sum_results, $just_save_results, $failed_test_summary,
935-
$PHP_FAILED_TESTS, $php, $output_file;
931+
global $sum_results, $failed_test_summary,
932+
$PHP_FAILED_TESTS, $php;
936933

937-
/* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */
938-
if (!getenv('NO_INTERACTION') && !TRAVIS_CI) {
934+
if (getenv('NO_INTERACTION') || TRAVIS_CI) {
935+
return;
936+
}
937+
938+
if ($prompt_to_save_results) {
939+
/* We got failed Tests, offer the user to save a QA report */
939940
$fp = fopen("php://stdin", "r+");
940941
if ($sum_results['FAILED'] || $sum_results['BORKED'] || $sum_results['WARNED'] || $sum_results['LEAKED']) {
941942
echo "\nYou may have found a problem in PHP.";
942943
}
943-
echo "\nThis report can be automatically sent to the PHP QA team at\n";
944-
echo QA_REPORTS_PAGE . " and http://news.php.net/php.qa.reports\n";
944+
echo "\nThis report can be saved and used to open an issue on the bug tracker at\n";
945+
echo "https://github.com/php/php-src/issues\n";
945946
echo "This gives us a better understanding of PHP's behavior.\n";
946-
echo "If you don't want to send the report immediately you can choose\n";
947-
echo "option \"s\" to save it. You can then email it to " . PHP_QA_EMAIL . " later.\n";
948-
echo "Do you want to send this report now? [Yns]: ";
947+
echo "Do you want to save this report in a file? [Yn]: ";
949948
flush();
950949

951950
$user_input = fgets($fp, 10);
952-
$just_save_results = (!empty($user_input) && strtolower($user_input[0]) === 's');
953-
}
954-
955-
if ($just_save_results || !getenv('NO_INTERACTION') || TRAVIS_CI) {
956-
if ($just_save_results || TRAVIS_CI || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
957-
/*
958-
* Collect information about the host system for our report
959-
* Fetch phpinfo() output so that we can see the PHP environment
960-
* Make an archive of all the failed tests
961-
* Send an email
962-
*/
963-
if ($just_save_results) {
964-
$user_input = 's';
965-
}
966-
967-
/* Ask the user to provide an email address, so that QA team can contact the user */
968-
if (TRAVIS_CI) {
969-
$user_email = 'travis at php dot net';
970-
} elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
971-
echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): ";
972-
flush();
973-
$user_email = trim(fgets($fp, 1024));
974-
$user_email = str_replace("@", " at ", str_replace(".", " dot ", $user_email));
975-
}
976-
977-
$failed_tests_data = '';
978-
$sep = "\n" . str_repeat('=', 80) . "\n";
979-
$failed_tests_data .= $failed_test_summary . "\n";
980-
$failed_tests_data .= get_summary(true) . "\n";
981-
982-
if ($sum_results['FAILED']) {
983-
foreach ($PHP_FAILED_TESTS['FAILED'] as $test_info) {
984-
$failed_tests_data .= $sep . $test_info['name'] . $test_info['info'];
985-
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']));
986-
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']));
987-
$failed_tests_data .= $sep . "\n\n";
988-
}
989-
$status = "failed";
990-
} else {
991-
$status = "success";
992-
}
993-
994-
$failed_tests_data .= "\n" . $sep . 'BUILD ENVIRONMENT' . $sep;
995-
$failed_tests_data .= "OS:\n" . PHP_OS . " - " . php_uname() . "\n\n";
996-
$ldd = $autoconf = $sys_libtool = $libtool = $compiler = 'N/A';
997-
998-
if (!IS_WINDOWS) {
999-
/* If PHP_AUTOCONF is set, use it; otherwise, use 'autoconf'. */
1000-
if (getenv('PHP_AUTOCONF')) {
1001-
$autoconf = shell_exec(getenv('PHP_AUTOCONF') . ' --version');
1002-
} else {
1003-
$autoconf = shell_exec('autoconf --version');
1004-
}
951+
fclose($fp);
952+
if (!(strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y')) {
953+
return;
954+
}
955+
}
956+
/**
957+
* Collect information about the host system for our report
958+
* Fetch phpinfo() output so that we can see the PHP environment
959+
* Make an archive of all the failed tests
960+
*/
961+
$failed_tests_data = '';
962+
$sep = "\n" . str_repeat('=', 80) . "\n";
963+
$failed_tests_data .= $failed_test_summary . "\n";
964+
$failed_tests_data .= get_summary(true) . "\n";
1005965

1006-
/* Always use the generated libtool - Mac OSX uses 'glibtool' */
1007-
$libtool = shell_exec(INIT_DIR . '/libtool --version');
966+
if ($sum_results['FAILED']) {
967+
foreach ($PHP_FAILED_TESTS['FAILED'] as $test_info) {
968+
$failed_tests_data .= $sep . $test_info['name'] . $test_info['info'];
969+
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']));
970+
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']));
971+
$failed_tests_data .= $sep . "\n\n";
972+
}
973+
}
1008974

1009-
/* Use shtool to find out if there is glibtool present (MacOSX) */
1010-
$sys_libtool_path = shell_exec(__DIR__ . '/build/shtool path glibtool libtool');
975+
$failed_tests_data .= "\n" . $sep . 'BUILD ENVIRONMENT' . $sep;
976+
$failed_tests_data .= "OS:\n" . PHP_OS . " - " . php_uname() . "\n\n";
977+
$ldd = $autoconf = $sys_libtool = $libtool = $compiler = 'N/A';
1011978

1012-
if ($sys_libtool_path) {
1013-
$sys_libtool = shell_exec(str_replace("\n", "", $sys_libtool_path) . ' --version');
1014-
}
979+
if (!IS_WINDOWS) {
980+
/* If PHP_AUTOCONF is set, use it; otherwise, use 'autoconf'. */
981+
if (getenv('PHP_AUTOCONF')) {
982+
$autoconf = shell_exec(getenv('PHP_AUTOCONF') . ' --version');
983+
} else {
984+
$autoconf = shell_exec('autoconf --version');
985+
}
1015986

1016-
/* Try the most common flags for 'version' */
1017-
$flags = ['-v', '-V', '--version'];
1018-
$cc_status = 0;
987+
/* Always use the generated libtool - Mac OSX uses 'glibtool' */
988+
$libtool = shell_exec(INIT_DIR . '/libtool --version');
1019989

1020-
foreach ($flags as $flag) {
1021-
system(getenv('CC') . " $flag >/dev/null 2>&1", $cc_status);
1022-
if ($cc_status == 0) {
1023-
$compiler = shell_exec(getenv('CC') . " $flag 2>&1");
1024-
break;
1025-
}
1026-
}
990+
/* Use shtool to find out if there is glibtool present (MacOSX) */
991+
$sys_libtool_path = shell_exec(__DIR__ . '/build/shtool path glibtool libtool');
1027992

1028-
$ldd = shell_exec("ldd $php 2>/dev/null");
1029-
}
993+
if ($sys_libtool_path) {
994+
$sys_libtool = shell_exec(str_replace("\n", "", $sys_libtool_path) . ' --version');
995+
}
1030996

1031-
$failed_tests_data .= "Autoconf:\n$autoconf\n";
1032-
$failed_tests_data .= "Bundled Libtool:\n$libtool\n";
1033-
$failed_tests_data .= "System Libtool:\n$sys_libtool\n";
1034-
$failed_tests_data .= "Compiler:\n$compiler\n";
1035-
$failed_tests_data .= "Bison:\n" . shell_exec('bison --version 2>/dev/null') . "\n";
1036-
$failed_tests_data .= "Libraries:\n$ldd\n";
1037-
$failed_tests_data .= "\n";
997+
/* Try the most common flags for 'version' */
998+
$flags = ['-v', '-V', '--version'];
999+
$cc_status = 0;
10381000

1039-
if (isset($user_email)) {
1040-
$failed_tests_data .= "User's E-mail: " . $user_email . "\n\n";
1001+
foreach ($flags as $flag) {
1002+
system(getenv('CC') . " $flag >/dev/null 2>&1", $cc_status);
1003+
if ($cc_status == 0) {
1004+
$compiler = shell_exec(getenv('CC') . " $flag 2>&1");
1005+
break;
10411006
}
1007+
}
10421008

1043-
$failed_tests_data .= $sep . "PHPINFO" . $sep;
1044-
$failed_tests_data .= shell_exec($php . ' -ddisplay_errors=stderr -dhtml_errors=0 -i 2> /dev/null');
1009+
$ldd = shell_exec("ldd $php 2>/dev/null");
1010+
}
10451011

1046-
if (($just_save_results || !mail_qa_team($failed_tests_data, $status)) && !TRAVIS_CI) {
1047-
file_put_contents($output_file, $failed_tests_data);
1012+
$failed_tests_data .= "Autoconf:\n$autoconf\n";
1013+
$failed_tests_data .= "Bundled Libtool:\n$libtool\n";
1014+
$failed_tests_data .= "System Libtool:\n$sys_libtool\n";
1015+
$failed_tests_data .= "Compiler:\n$compiler\n";
1016+
$failed_tests_data .= "Bison:\n" . shell_exec('bison --version 2>/dev/null') . "\n";
1017+
$failed_tests_data .= "Libraries:\n$ldd\n";
1018+
$failed_tests_data .= "\n";
1019+
$failed_tests_data .= $sep . "PHPINFO" . $sep;
1020+
$failed_tests_data .= shell_exec($php . ' -ddisplay_errors=stderr -dhtml_errors=0 -i 2> /dev/null');
10481021

1049-
if (!$just_save_results) {
1050-
echo "\nThe test script was unable to automatically send the report to PHP's QA Team\n";
1051-
}
1052-
1053-
echo "Please send " . $output_file . " to " . PHP_QA_EMAIL . " manually, thank you.\n";
1054-
} elseif (!getenv('NO_INTERACTION') && !TRAVIS_CI) {
1055-
fwrite($fp, "\nThank you for helping to make PHP better.\n");
1056-
fclose($fp);
1057-
}
1058-
}
1059-
}
1022+
file_put_contents($output_file, $failed_tests_data);
1023+
echo "Report saved to: ", $output_file, "\n";
10601024
}
10611025

10621026
function get_binary(string $php, string $sapi, string $sapi_path): ?string
@@ -1146,52 +1110,6 @@ function test_sort($a, $b): int
11461110
}
11471111
}
11481112

1149-
//
1150-
// Send Email to QA Team
1151-
//
1152-
1153-
function mail_qa_team(string $data, bool $status = false): bool
1154-
{
1155-
$url_bits = parse_url(QA_SUBMISSION_PAGE);
1156-
1157-
if ($proxy = getenv('http_proxy')) {
1158-
$proxy = parse_url($proxy);
1159-
$path = $url_bits['host'] . $url_bits['path'];
1160-
$host = $proxy['host'];
1161-
if (empty($proxy['port'])) {
1162-
$proxy['port'] = 80;
1163-
}
1164-
$port = $proxy['port'];
1165-
} else {
1166-
$path = $url_bits['path'];
1167-
$host = $url_bits['host'];
1168-
$port = empty($url_bits['port']) ? 80 : $port = $url_bits['port'];
1169-
}
1170-
1171-
$data = "php_test_data=" . urlencode(base64_encode(str_replace("\00", '[0x0]', $data)));
1172-
$data_length = strlen($data);
1173-
1174-
$fs = fsockopen($host, $port, $errno, $errstr, 10);
1175-
1176-
if (!$fs) {
1177-
return false;
1178-
}
1179-
1180-
$php_version = urlencode(TESTED_PHP_VERSION);
1181-
1182-
echo "\nPosting to " . QA_SUBMISSION_PAGE . "\n";
1183-
fwrite($fs, "POST " . $path . "?status=$status&version=$php_version HTTP/1.1\r\n");
1184-
fwrite($fs, "Host: " . $host . "\r\n");
1185-
fwrite($fs, "User-Agent: QA Browser 0.1\r\n");
1186-
fwrite($fs, "Content-Type: application/x-www-form-urlencoded\r\n");
1187-
fwrite($fs, "Content-Length: " . $data_length . "\r\n\r\n");
1188-
fwrite($fs, $data);
1189-
fwrite($fs, "\r\n\r\n");
1190-
fclose($fs);
1191-
1192-
return true;
1193-
}
1194-
11951113
//
11961114
// Write the given text to a temporary file, and return the filename.
11971115
//
@@ -1530,9 +1448,6 @@ function run_all_tests_parallel(array $test_files, array $env, $redir_tested): v
15301448
"constants" => [
15311449
"INIT_DIR" => INIT_DIR,
15321450
"TEST_PHP_SRCDIR" => TEST_PHP_SRCDIR,
1533-
"PHP_QA_EMAIL" => PHP_QA_EMAIL,
1534-
"QA_SUBMISSION_PAGE" => QA_SUBMISSION_PAGE,
1535-
"QA_REPORTS_PAGE" => QA_REPORTS_PAGE,
15361451
"TRAVIS_CI" => TRAVIS_CI
15371452
]
15381453
])) . "\n";

0 commit comments

Comments
 (0)