harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r586455 - in /harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter: EUTReporter.java EUTStatusCollector.java EUTSuiteInfo.java EUTTXTReportEmitter.java
Date Fri, 19 Oct 2007 13:50:45 GMT
Author: smishura
Date: Fri Oct 19 06:50:45 2007
New Revision: 586455

URL: http://svn.apache.org/viewvc?rev=586455&view=rev
Log:
Apply patch from HARMONY-4970:
[buildtest][eut] Internal error breaks Summary Reporter

Modified:
    harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java
    harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java
    harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
    harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java

Modified: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java?rev=586455&r1=586454&r2=586455&view=diff
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java
(original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java
Fri Oct 19 06:50:45 2007
@@ -89,6 +89,12 @@
         String fractionStr = String.valueOf((int) Math.round((passrate -
                         (double) aliquot) * 100.0));
 
+        // fractionStr may become 100 for the real pass rate like 99.9971% -
+        // need to do incorrect rounding in such a case to avoid 100% reporting
+        if (fractionStr.equals("100")) {
+            return "99.99%";
+        }
+
         if (fractionStr.length() != 2) {
             fractionStr = "0" + fractionStr;
         }

Modified: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java?rev=586455&r1=586454&r2=586455&view=diff
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java
(original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTStatusCollector.java
Fri Oct 19 06:50:45 2007
@@ -30,6 +30,11 @@
 import java.util.Properties;
 
 /**
+ * Parses information from XML report and does not calculate any statistics.
+ *
+ * For example, total number of tests / errors / failures in the suite is taken
+ * from <testsuite> tag, this is not summarised data taken from
+ * <testcase> tag.
  */
 final class EUTStatusCollector extends DefaultHandler {
 
@@ -107,6 +112,10 @@
 
     /**
      * Called by parser when new XML tag is found.
+     *
+     * Note that <error> tag may happen inside <testsuite> one
+     * without <testcase> parent tag. For example the the whole suite can
+     * not be run due to related plugin can not be found.
      */
     public void startElement(String uri, String localName, String qName,
             Attributes attributes) throws SAXException {
@@ -124,10 +133,26 @@
         }
 
         if (qName.equals("error") || qName.equals("failure")) {
-            processedTest.testStatus = qName.equals("error") ? 
-                    EUTTestInfo.TEST_ERROR : EUTTestInfo.TEST_FAILURE;
-            processedTest.testIssueMessage = attributes.getValue("message");
-            processedTest.testIssueContent = new StringBuffer();
+            if (processedTest != null) {
+                processedTest.testStatus = qName.equals("error") ? 
+                        EUTTestInfo.TEST_ERROR : EUTTestInfo.TEST_FAILURE;
+                processedTest.testIssueMessage = attributes.getValue("message");
+                processedTest.testIssueContent = new StringBuffer();
+            } else if (processedSuite != null) {
+
+                // there is a error preventing testsuite running - so all of
+                // its tests are considered as ended with unexpected error
+                if (EUTReporter.eflList.indexOf(processedSuite.name) != -1) {
+                    processedSuite.tests_expected_failures_errors +=
+                            processedSuite.tests_total;
+                } else {
+                    processedSuite.tests_unexpected_end_with_error +=
+                            processedSuite.tests_total;
+                    processedSuite.suiteIssueMessage =
+                            attributes.getValue("message");
+                    processedSuite.suiteIssueContent = new StringBuffer();
+                }
+            }
             return;
         }
     }
@@ -162,12 +187,14 @@
                 // remove passed test from EFL to calculate passrate correctly
                 EUTReporter.eflList.remove(eflIndex);
             }
+            processedTest = null;
             return;
         }
 
         // expected failure/error situation
         if (eflIndex != -1) {
             processedSuite.tests_expected_failures_errors++;
+            processedTest = null;
             return;
         }
 
@@ -186,6 +213,9 @@
             throws SAXException {
         if (processedTest != null && processedTest.testIssueContent != null) {
             processedTest.testIssueContent.append(ch, start, length);
+        } else if (processedSuite != null &&
+                processedSuite.suiteIssueContent != null) {
+            processedSuite.suiteIssueContent.append(ch, start, length);
         }
     }
 

Modified: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java?rev=586455&r1=586454&r2=586455&view=diff
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
(original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTSuiteInfo.java
Fri Oct 19 06:50:45 2007
@@ -112,6 +112,21 @@
      * Keeps the list of tests ended with unexpected error/failure. 
      */
     ArrayList<EUTTestInfo> unexpectedErrorFailureTests;
+
+    /**
+     * Keeps the suite global error /failure message extract from 
+     * 'error'/'failure' tag in XML report (like 'Can not find plugin" error.
+     */
+    String suiteIssueMessage;
+
+    /**
+     * Keeps the suite error/failure content extracted from 'error'/'failure'
+     * tag in XML report.
+     *
+     * This field null value indicates one more state of suite (it was run, it
+     * does not crash, still no testcases were run due to suite error).
+     */
+    StringBuffer suiteIssueContent;
 } // end of class 'EUTSuiteInfo' definition
 
 /**

Modified: harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java?rev=586455&r1=586454&r2=586455&view=diff
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
(original)
+++ harmony/enhanced/buildtest/branches/2.0/tests/eut/summary-reporter/src/org/apache/harmony/eut/reporter/EUTTXTReportEmitter.java
Fri Oct 19 06:50:45 2007
@@ -50,7 +50,8 @@
         out.println("Total run tests     : " + esi.tests_run_total);
         out.println("Relative passrate   : " + EUTReporter.makePassrateString(
                     esi.ss.tests_reported_passed, esi.tests_run_total));
-        out.println("Unexpected crashes  : " + esi.suites_unexpected_crashed.size());
+        out.println("Unexpected crashes  : "
+                + esi.suites_unexpected_crashed.size());
         out.println("Unexpected errors   : "
                 + esi.ss.tests_unexpected_end_with_error);
         out.println("Unexpected failures : "
@@ -62,7 +63,7 @@
                 EUTTestInfo.TEST_ERROR);
         emitErrorFailureResults(esi.ss.tests_unexpected_end_with_failure,
                 EUTTestInfo.TEST_FAILURE);
-     }
+    }
 
     private static void addFileToOutput(File log) throws Exception {
         BufferedReader in = new BufferedReader(new FileReader(log));
@@ -109,6 +110,15 @@
 
             if (!si.wasRun || si.isCrashed) {
                 continue;
+            }
+
+            if (si.suiteIssueContent != null &&
+                    issuesType == EUTTestInfo.TEST_ERROR) {
+                String testsStr = si.tests_total == 1 ? " test)" : " tests)";
+                out.println();
+                out.println(si.name + " (" + si.tests_total + testsStr);
+                out.println(si.suiteIssueMessage);
+                out.println(si.suiteIssueContent.toString().trim());
             }
 
             for (int j = 0; j < si.unexpectedErrorFailureTests.size(); j++) {



Mime
View raw message