com phpruntests: comparison code: QA/compareNewOld.php QA/test
| From: | David Soria Parra | Date: | Tue, 07 Jul 2009 12:10:40 +0000 |
| Subject: | com phpruntests: comparison code: QA/compareNewOld.php QA/test | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66360@lists.php.net to get a copy of this message | ||
Commit: d5013f8f24fdcaded549aaceb4a6f8a193389ebb
Author: Zoe Slattery <zoe@php.net> Tue, 7 Jul 2009 12:10:40 +0000
Parents: 1649211e95210cf604f3e7dfb2e0941db061b65a
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=d5013f8f24fdcaded549aaceb4a6f8a193389ebb
Log:
comparison code
Changed paths:
A QA/compareNewOld.php
D QA/test
Diff:
diff --git a/QA/compareNewOld.php b/QA/compareNewOld.php
new file mode 100644
index 0000000...47006cd
--- /dev/null
+++ b/QA/compareNewOld.php
@@ -0,0 +1,100 @@
+<?php
+
+//Compare the output from new run-tests with the old version
+//Takes two files and a keyword as input
+//Usage:
+//php compareNewOld.php new_output old_output keyword
+//
+//where new_output is an output file generated using -o csv.
+// old_output is the standard output fro run-tests.php
+// key is the name of the top_level directory of the tests (eg QA, unless you move them
anywhere else)
+
+//Search for Warning, Notice, Fatal
+
+$warnCount = 0;
+$noticeCount = 0;
+$fatalCount = 0;
+
+$top_level = $argv[3];
+
+$rttests = file($argv[2]);
+$mytests = file($argv[1]);
+
+foreach($mytests as $test) {
+ if(preg_match("/Warning/", $test)) {
+ $warnCount++;
+ }
+
+ if(preg_match("/Notice/", $test)) {
+ $noticeCount++;
+ }
+
+ if(preg_match("/Fatal/", $test)) {
+ $fatalCount++;
+ }
+
+}
+
+$myfails = parseNew($mytests, 'FAIL', $top_level);
+$myborks = parseNew($mytests, 'BORK', $top_level);
+$myskips = parseNew($mytests, 'SKIP', $top_level);
+
+
+$rtfails = parseOld($rttests, 'FAIL');
+$rtborks = parseOld($rttests, 'BORK');
+$rtskips = parseOld($rttests, 'SKIP');
+
+echo "\n\nIn the new code (phpruntests)...\n";
+echo " Number of Warnings: $warnCount\n Number of Notices: $noticeCount\n Number
of Fatal: $fatalCount\n";
+
+compareAndPrint($myfails, $rtfails, 'fail');
+compareAndPrint($myborks, $rtborks, 'bork');
+compareAndPrint($myskips, $rtskips, 'skip');
+
+function parseNew($output, $searchFor, $top_level) {
+
+ $result = array();
+ foreach($output as $line) {
+ if
(preg_match("/$top_level\/((ext|sapi|Zend|tests)\/\S+)\s{1},(.*)\s{1}$searchFor\s{1}/",
$line, $matches)) {
+ if($searchFor == 'FAIL') {
+ if(!preg_match("/XFAIL/", $matches[2])) {
+ $result[] = $matches[1] . ".phpt";
+ }
+ } else {
+ $result[] = $matches[1] . ".phpt";
+ }
+ }
+
+ }
+return $result;
+}
+
+function parseOld($output, $searchFor) {
+ $result = array();
+ foreach($output as $line) {
+ if (preg_match("/$searchFor.*\[(.+\.phpt)\]/", $line, $matches)) {
+ $result[] = $matches[1];
+ }
+ }
+return $result;
+}
+function compareAndPrint($my, $rt, $type) {
+ $only_my = array_diff($my, $rt);
+ $nmy = count($only_my);
+
+ echo "\n =====> $nmy tests $type in phpruntests and do not $type in run-tests\n";
+
+ foreach($only_my as $line) {
+ echo "$line \n";
+ }
+
+ $only_rt = array_diff($rt, $my);
+ $nrt = count ($only_rt);
+
+ echo "\n =====> $nrt tests $type in run-tests and do not $type in phpruntests\n";
+
+ foreach($only_rt as $line) {
+ echo "$line\n";
+ }
+}
+?>
diff --git a/QA/test b/QA/test
deleted file mode 100644
index 30d74d2..0000000
--- a/QA/test
+++ /dev/null
@@ -1 +0,0 @@
-test
\ No newline at end of file