com php-src: Add support for run-tests.php to output all test results: run-tests.php

[email protected] (Joe Watkins)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    431e22fb4d2a23f6e522ec5e20503fd6ec7ca1f6
Author:    Sara Golemon <[email protected]>         Sat, 6 May 2017 16:10:46 -0700
Committer: Joe Watkins <[email protected]>      Mon, 8 May 2017 05:49:56 +0100
Parents:   47a1ab36b009f25d246705ce72927fbe0afe063e
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=431e22fb4d2a23f6e522ec5e20503fd6ec7ca1f6

Log:
Add support for run-tests.php to output all test results

./run-tests.php -W outfile.txt

PASS foo/bar.phpt
FAIL baz/qux.phpt

Changed paths:
  M  run-tests.php


Diff:
diff --git a/run-tests.php b/run-tests.php
index 3bfbf76..7f8653f 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -459,6 +459,7 @@ $test_results = array();
 $PHP_FAILED_TESTS = array('BORKED' => array(), 'FAILED' => array(), 'WARNED' => array(), 'LEAKED' => array(), 'XFAILED' => array(), 'SLOW' => array());
 
 // If parameters given assume they represent selected tests to run.
+$result_tests_file= false;
 $failed_tests_file= false;
 $pass_option_n = false;
 $pass_options = '';
@@ -559,6 +560,9 @@ if (isset($argc) && $argc > 1) {
 				case 'a':
 					$failed_tests_file = fopen($argv[++$i], 'a+t');
 					break;
+				case 'W':
+					$result_tests_file = fopen($argv[++$i], 'w+t');
+					break;
 				case 'c':
 					$conf_passed = $argv[++$i];
 					break;
@@ -694,6 +698,8 @@ Options:
 
     -a <file>   Same as -w but append rather then truncating <file>.
 
+    -W <file>   Write a list of all tests and their result status to <file>.
+
     -c <file>   Look for php.ini in directory <file> or use <file> as ini.
 
     -n          Pass -n option to the php binary (Do not use a php.ini).
@@ -826,6 +832,10 @@ HELP;
 			fclose($failed_tests_file);
 		}
 
+		if ($result_tests_file) {
+			fclose($result_tests_file);
+		}
+
 		compute_summary();
 		if ($html_output) {
 			fwrite($html_file, "<hr/>\n" . get_summary(false, true));
@@ -959,6 +969,10 @@ if ($failed_tests_file) {
 	fclose($failed_tests_file);
 }
 
+if ($result_tests_file) {
+	fclose($result_tests_file);
+}
+
 // Summarize results
 
 if (0 == count($test_results)) {
@@ -1160,7 +1174,7 @@ function system_with_timeout($commandline, $env = null, $stdin = null, $captureS
 
 function run_all_tests($test_files, $env, $redir_tested = null)
 {
-	global $test_results, $failed_tests_file, $php, $test_idx;
+	global $test_results, $failed_tests_file, $result_tests_file, $php, $test_idx;
 
 	foreach($test_files as $name) {
 
@@ -1183,6 +1197,9 @@ function run_all_tests($test_files, $env, $redir_tested = null)
 			if ($failed_tests_file && ($result == 'XFAILED' || $result == 'FAILED' || $result == 'WARNED' || $result == 'LEAKED')) {
 				fwrite($failed_tests_file, "$index\n");
 			}
+			if ($result_tests_file) {
+				fwrite($result_tests_file, "$result\t$index\n");
+			}
 		}
 	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.