[PATCH] Coverage: Add support to generate separate reports for each symbol-set
Gedare Bloom
gedare at rtems.org
Wed Jul 25 14:36:51 UTC 2018
On Tue, Jul 24, 2018 at 10:37 PM, Vijay Kumar Banerjee
<vijaykumar9597 at gmail.com> wrote:
> Invoke covoar multiple times from the script to generate separate
> reports for each symbol-set.
> ---
> tester/rt/coverage.py | 32 +++++++++++++--------------
> tester/rtems/testing/coverage/symbol-sets.ini | 11 ++++++---
> 2 files changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
> index 7dd5002..e2f4dca 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
> @@ -267,24 +267,19 @@ class symbol_parser(object):
> 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 +366,23 @@ 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,
> + parser.parse()
> + ssets = parser.symbol_sets.keys()
I don't like this two-line combination. It requires knowledge about
the internal workings of the parser class. Maybe it makes sense to
have parser.parse() returns the symbol_sets directly?
Also, I prefer if you kept symbol_sets as a name, but you can use the
sset for the shortened single "symbol_set". the intermixing of
symbol_sets, sset, and ssets is confusing to me.
> + for sset in ssets:
> + 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(ssets);
You could keep the symbol_sets as a class variable if you want to.
either way is probably fine...
> 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'])
> diff --git a/tester/rtems/testing/coverage/symbol-sets.ini b/tester/rtems/testing/coverage/symbol-sets.ini
> index a2ec7bc..3900f14 100644
> --- a/tester/rtems/testing/coverage/symbol-sets.ini
> +++ b/tester/rtems/testing/coverage/symbol-sets.ini
> @@ -29,8 +29,13 @@
> #
>
> [symbol-sets]
> -sets = score,rtems
> +sets = score,rtems,libblock,libcrypt,libcsupport,libmd,libnetworking
>
> [libraries]
> -score = @BUILD-TARGET@/c/@BSP@/cpukit/score/libscore.a
> -rtems = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/librtems.a
> +score = @BUILD-TARGET@/c/@BSP@/cpukit/score/libscore.a
> +rtems = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/librtems.a
> +libblock = @BUILD-TARGET@/c/@BSP@/cpukit/libblock/libblock.a
> +libcrypt = @BUILD-TARGET@/c/@BSP@/cpukit/libcrypt/libcrypt.a
> +libcsupport = @BUILD-TARGET@/c/@BSP@/cpukit/libcsupport/libcsupport.a
> +libmd = @BUILD-TARGET@/c/@BSP@/cpukit/libmd/libmd.a
> +libnetworking = @BUILD-TARGET@/c/@BSP@/cpukit/libnetworking/libnetworking.a
> --
> 2.14.2
>
More information about the devel
mailing list