[rtems-tools commit] covoar/Reports: Fix empty branch report

Joel Sherrill joel at rtems.org
Tue Mar 30 18:20:47 UTC 2021


Module:    rtems-tools
Branch:    master
Commit:    0e6c7ec2536be18fce380ce83f996868d9021703
Changeset: http://git.rtems.org/rtems-tools/commit/?id=0e6c7ec2536be18fce380ce83f996868d9021703

Author:    Alex White <alex.white at oarcorp.com>
Date:      Mon Mar  1 10:58:11 2021 -0600

covoar/Reports: Fix empty branch report

This makes the branch report more consistent with the other reports when
there is no branch information found.

---

 tester/covoar/ReportsBase.cc | 12 ++-----
 tester/covoar/ReportsHtml.cc | 82 +++++++++++++++++++-------------------------
 2 files changed, 39 insertions(+), 55 deletions(-)

diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc
index 1615c0b..40ed209 100644
--- a/tester/covoar/ReportsBase.cc
+++ b/tester/covoar/ReportsBase.cc
@@ -290,15 +290,9 @@ void ReportsBase::WriteBranchReport(
   if (!report)
     return;
 
-  // If no branches were found of branch coverage is not supported
-  if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) ||
-      (BranchInfoAvailable == false) ) {
-
-    PutNoBranchInfo(report);
-
-    // If branches were found, ...
-  } else {
-
+  // If no branches were found then branch coverage is not supported
+  if ((SymbolsToAnalyze->getNumberBranchesFound() != 0) &&
+      (BranchInfoAvailable == true) ) {
     // Process uncovered branches for each symbol.
     count = 0;
     for (ditr = SymbolsToAnalyze->set.begin();
diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index 3d20aec..6406a48 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -172,45 +172,43 @@ namespace Coverage {
     // Open the file
     aFile = OpenFile(fileName);
 
-    if ( hasBranches ) {
-      // Put header information into the file
-      fprintf(
-        aFile,
-        "<title>Branch Report</title>\n"
-        "<div class=\"heading-title\">"
-      );
-
-      if (projectName)
-        fprintf(
-          aFile,
-          "%s<br>",
-          projectName
-        );
+    // Put header information into the file
+    fprintf(
+      aFile,
+      "<title>Branch Report</title>\n"
+      "<div class=\"heading-title\">"
+    );
 
+    if (projectName)
       fprintf(
         aFile,
-        "Branch Report</div>\n"
-        "<div class =\"datetime\">%s</div>\n"
-        "<body>\n"
-        "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
-           TABLE_HEADER_CLASS "\">\n"
-        "<thead>\n"
-        "<tr>\n"
-        "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
-        "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
-        "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
-        "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
-        "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
-        "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>\n"
-	"<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>\n"
-        "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
-        "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
-        "</tr>\n"
-        "</thead>\n"
-        "<tbody>\n",
-        asctime( localtime(&timestamp_m) )
+        "%s<br>",
+        projectName
       );
-    }
+
+    fprintf(
+      aFile,
+      "Branch Report</div>\n"
+      "<div class =\"datetime\">%s</div>\n"
+      "<body>\n"
+      "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd"
+          TABLE_HEADER_CLASS "\">\n"
+      "<thead>\n"
+      "<tr>\n"
+      "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
+      "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
+      "<th class=\"table-filterable table-sortable:default\" align=\"left\">File</th>\n"
+      "<th class=\"table-sortable:numeric\" align=\"left\">Size <br>Bytes</th>\n"
+      "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
+      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Taken</th>\n"
+      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not Taken</th>\n"
+      "<th class=\"table-filterable table-sortable:default\" align=\"left\">Classification</th>\n"
+      "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n"
+      "</tr>\n"
+      "</thead>\n"
+      "<tbody>\n",
+      asctime( localtime(&timestamp_m) )
+    );
 
     return aFile;
   }
@@ -985,19 +983,11 @@ namespace Coverage {
     bool   hasBranches
   )
   {
-    if ( hasBranches ) {
-      fprintf(
-        aFile,
-        TABLE_FOOTER
-        "</tbody>\n"
-        "</table>\n"
-      );
-    }
     fprintf(
       aFile,
-      "</pre>\n"
-      "</body>\n"
-      "</html>"
+      TABLE_FOOTER
+      "</tbody>\n"
+      "</table>\n"
     );
 
     CloseFile(aFile);



More information about the vc mailing list