[PATCH v2] Coverage: Add support to generate separate reports for each symbol-set

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Mon Jul 30 17:25:40 UTC 2018


Invoke covoar multiple times from the script to generate separate
reports for each symbol-set.
---
 tester/rt/coverage.py | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 7dd5002..c979332 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -99,8 +99,8 @@ class summary:
         return line.strip().split(' ')[0]
 
 class report_gen_html:
-    def __init__(self, p_symbol_sets_list, build_dir, rtdir, bsp):
-        self.symbol_sets_list = ['score']
+    def __init__(self, symbol_sets, build_dir, rtdir, bsp):
+        self.symbol_sets = symbol_sets
         self.build_dir = build_dir
         self.partial_reports_files = list(['index.html', 'summary.txt'])
         self.number_of_columns = 1
@@ -109,7 +109,7 @@ class report_gen_html:
 
     def _find_partial_reports(self):
         partial_reports = {}
-        for symbol_set in self.symbol_sets_list:
+        for symbol_set in self.symbol_sets:
             set_summary = summary(path.join(self.bsp + "-coverage",
                                             symbol_set))
             set_summary.parse()
@@ -204,7 +204,7 @@ class report_gen_html:
     def add_covoar_src_path(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_list:
+        for symbol_set in self.symbol_sets:
             symbol_set_dir = path.join(self.build_dir,
                                        self.bsp + '-coverage', symbol_set)
             html_files = os.listdir(symbol_set_dir)
@@ -264,27 +264,23 @@ class symbol_parser(object):
             for sset in self.ssets:
                 lib = path.join(self.build_dir, config.get('libraries', sset))
                 self.symbol_sets[sset] = lib.encode('utf-8')
+            return self.ssets
         except:
             raise error.general('Symbol set parsing failed')
 
-    def _write_ini(self):
+    def write_ini(self, symbol_set):
         config = configparser.ConfigParser()
         try:
-            sets = ', '.join(self.symbol_sets.keys())
+            sset = symbol_set
             config.add_section('symbol-sets')
-            config.set('symbol-sets', 'sets', sets)
-            for key in self.symbol_sets.keys():
-                config.add_section(key)
-                config.set(key, 'libraries', self.symbol_sets[key])
+            config.set('symbol-sets', 'sets', sset)
+            config.add_section(sset)
+            config.set(sset, 'libraries', self.symbol_sets[sset])
             with open(self.symbol_select_file, 'w') as conf:
                 config.write(conf)
         except:
             raise error.general('symbol parser write failed')
 
-    def run(self):
-        self.parse()
-        self._write_ini()
-
 class covoar(object):
     '''
     Covoar runner
@@ -371,20 +367,22 @@ class coverage_run(object):
                                    self.symbol_select_path,
                                    self.symbol_set,
                                    build_dir)
-            parser.run()
-            covoar_runner = covoar(self.test_dir, self.symbol_select_path,
+            symbol_sets = parser.parse()
+            for sset in symbol_sets:
+                parser.write_ini(sset)
+                covoar_runner = covoar(self.test_dir, self.symbol_select_path,
                                    self.executables, self.explanations_txt,
                                    self.trace)
-            covoar_runner.run('score', self.symbol_select_path)
-            self._generate_reports();
+                covoar_runner.run(sset, self.symbol_select_path)
+            self._generate_reports(symbol_sets);
             self._summarize();
         finally:
             self._cleanup();
 
-    def _generate_reports(self):
+    def _generate_reports(self, symbol_sets):
         log.notice('Coverage generating reports')
         if self.report_format == 'html':
-            report = report_gen_html(self.symbol_sets,
+            report = report_gen_html(symbol_sets,
                                      self.build_dir,
                                      self.rtdir,
                                      self.macros['bsp'])
-- 
2.14.4



More information about the devel mailing list