[PATCH] coverage : Add support to run coverage in supported bsp without extra options

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Tue Jun 12 06:39:13 UTC 2018


Please review this patch. :)
On 7 June 2018 at 16:38, Vijay Kumar Banerjee <vijaykumar9597 at gmail.com>
wrote:

> Close #3440
> ---
>  tester/rt/coverage.py |  6 ++++--
>  tester/rt/test.py     | 15 ++++++++++-----
>  2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
> index 54933d5..af24124 100644
> --- a/tester/rt/coverage.py
> +++ b/tester/rt/coverage.py
> @@ -163,7 +163,8 @@ class report_gen_html:
>              row += " <td>" + summary.branches_uncovered + "</td>"
>              row += " <td>" + summary.branches_total + "</td>"
>              row += " <td> {:.3%} </td>".format(summary.
> percentage_branches_covered)
> -            row += ' <td><progress value="{:.3}"
> max="100"></progress></td>'.format(100*summary.percentage_
> branches_covered)
> +            row += ' <td><progress value="{:.3}"
> max="100"></progress></td>'\
> +                    .format(100*summary.percentage_branches_covered)
>              row += "</tr>\n"
>          return row
>
> @@ -299,7 +300,8 @@ class covoar(object):
>          if (not path.exists(covoar_result_dir)):
>              path.mkdir(covoar_result_dir)
>          if (not path.exists(symbol_file)):
> -            raise error.general('symbol set file: coverage %s was not
> created for covoar, skipping %s'% (symbol_file, set_name))
> +            raise error.general('symbol set file: %s was not '
> +                    'created for covoar, skipping %s'% (symbol_file,
> set_name))
>          command = ('covoar -S ' + symbol_file
>                    + ' -O ' + covoar_result_dir
>                    + ' -E ' + self.explanations_txt
> diff --git a/tester/rt/test.py b/tester/rt/test.py
> index 0e744cd..cdb5157 100644
> --- a/tester/rt/test.py
> +++ b/tester/rt/test.py
> @@ -232,7 +232,7 @@ def run(command_path = None):
>                      '--filter':         'Glob that executables must match
> to run (default: ' +
>                                default_exefilter + ')',
>                      '--stacktrace':     'Dump a stack trace on a user
> termination (^C)',
> -                    '--coverage':       'Perform coverage analysis of
> test executables.'}
> +                    '--coverage-sets':  'Perform coverage for specific
> sets'}
>          mailer.append_options(optargs)
>          opts = options.load(sys.argv,
>                              optargs = optargs,
> @@ -279,15 +279,20 @@ def run(command_path = None):
>          else:
>              rtems_tools = '%{_prefix}'
>          bsp = opts.find_arg('--rtems-bsp')
> +        if 'cov' in bsp[1].split('-'):
> +            coverage_enabled = True
>          if bsp is None or len(bsp) != 2:
>              raise error.general('RTEMS BSP not provided or an invalid
> option')
>          bsp = config.load(bsp[1], opts)
>          bsp_config = opts.defaults.expand(opts.defaults['tester'])
> -        coverage_enabled = opts.find_arg('--coverage')
> +        coverage_sets = opts.find_arg('--coverage-sets')
>          if coverage_enabled:
> -            if len(coverage_enabled) == 2:
> -                coverage_runner = coverage.coverage_run(opts.defaults,
> -                                                coverage_enabled[1],
> +            if coverage_sets:
> +                if len(coverage_sets) != 2:
> +                    raise error.general('No sets provided in
> --coverage-sets')
> +                else :
> +                    coverage_runner = coverage.coverage_run(opts.
> defaults,
> +                                                coverage_sets[1],
>                                                  executables)
>              else:
>                  coverage_runner = coverage.coverage_run(opts.defaults, 0,
> --
> 2.14.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180612/932fc3ba/attachment-0002.html>


More information about the devel mailing list