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

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Mon Jul 30 07:30:46 UTC 2018


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

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 7dd5002..99342e1 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -100,7 +100,7 @@ class summary:
 
 class report_gen_html:
     def __init__(self, p_symbol_sets_list, build_dir, rtdir, bsp):
-        self.symbol_sets_list = ['score']
+        self.symbol_sets_list = p_symbol_sets_list
         self.build_dir = build_dir
         self.partial_reports_files = list(['index.html', 'summary.txt'])
         self.number_of_columns = 1
@@ -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