[PATCH 3/4] coverage/reports: Share common JS and CSS in reports

Alex White alex.white at oarcorp.com
Fri Mar 12 16:48:33 UTC 2021


This moves all of the javascript and CSS files that are shared by the
symbol set HTML reports to the shared parent directory. It also includes
the javascript and CSS in the top-level index file.
---
 tester/covoar/ReportsHtml.cc |  4 ++--
 tester/rt/coverage.py        | 11 ++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index cce0a4f..3d20aec 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -121,8 +121,8 @@ namespace Coverage {
       "<html>\n"
       "<meta http-equiv=\"Content-Language\" content=\"English\" >\n"
       "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\" >\n"
-      "<link rel=\"stylesheet\" type=\"text/css\" href=\"covoar.css\" media=\"screen\" >\n"
-      "<script type=\"text/javascript\" src=\"table.js\"></script>\n"
+      "<link rel=\"stylesheet\" type=\"text/css\" href=\"../covoar.css\" media=\"screen\" >\n"
+      "<script type=\"text/javascript\" src=\"../table.js\"></script>\n"
     );
 
     return aFile;
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index d62c853..ec3957c 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -137,6 +137,8 @@ class report_gen_html:
         head_section += '    text-align:center;' + os.linesep
         head_section += '  }' + os.linesep
         head_section += ' </style>' + os.linesep
+        head_section += ' <link rel="stylesheet" href="' + self.bsp + '-coverage/covoar.css">' + os.linesep
+        head_section += ' <script type="text/javascript" src="' + self.bsp + '-coverage/table.js"></script>' + os.linesep
         head_section += '</head>' + os.linesep
         return head_section
 
@@ -221,11 +223,10 @@ class report_gen_html:
     def add_covoar_css(self):
         table_js_path = path.join(self.covoar_src_path, 'table.js')
         covoar_css_path = path.join(self.covoar_src_path, 'covoar.css')
-        for symbol_set in self.symbol_sets:
-            symbol_set_dir = path.join(self.build_dir,
-                                       self.bsp + '-coverage', symbol_set)
-            path.copy_tree(covoar_css_path, symbol_set_dir)
-            path.copy_tree(table_js_path, symbol_set_dir)
+        coverage_directory = path.join(self.build_dir,
+                                    self.bsp + '-coverage')
+        path.copy_tree(covoar_css_path, coverage_directory)
+        path.copy_tree(table_js_path, coverage_directory)
 
     def add_dir_name(self):
         for symbol_set in self.symbol_sets:
-- 
2.27.0



More information about the devel mailing list