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

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Tue Jun 12 07:00:14 UTC 2018


On Tue, 12 Jun 2018, 12:27 Joel Sherrill, <joel at rtems.org> wrote:

> Chris needs to speak up since it is Python.
>
> I see changes to HTML output which I doubt are related to the core change.
>
There are no real changes to HTML,
I have just added line breaks in the code
because it was too long.

>
> On Tue, Jun 12, 2018, 8:39 AM Vijay Kumar Banerjee <
> vijaykumar9597 at gmail.com> wrote:
>
>> 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
>>>
>>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180612/5d841550/attachment-0002.html>


More information about the devel mailing list