[PATCH] coverage : Add support to run coverage in supported bsp without extra options
Gedare Bloom
gedare at rtems.org
Wed Jun 13 16:09:32 UTC 2018
On Wed, Jun 13, 2018 at 11:58 AM, Vijay Kumar Banerjee
<vijaykumar9597 at gmail.com> wrote:
> On 13 June 2018 at 10:29, Gedare Bloom <gedare at rtems.org> wrote:
>>
>> On Thu, Jun 7, 2018 at 7:08 AM, 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)
>>
>> Is there a style guide for how to split long lines in Python? I find
>> splitting before the .format seems strange to me. I might have
>> preferred to see it split at .format(\ which probably can be done
>> without using a backslash in this case, since python knows to keep
>> scanning inside a parenthetical block.
>
> Will update it according to your suggestion. :)
>>
>>
>> > 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))
>>
>> ditto.
>>
>> > 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('-'):
>>
>> I'm not sure if this use of the 'cov' field in the bsp config filename
>> itself is the proper way to go about accomplishing the activation of
>> coverage. What are other possible ways to get this done? Is the use of
>> a portion of the bsp config filename done elsewhere in tester?
>
> This patch was made following Chris' comments in another thread
>
> https://lists.rtems.org/pipermail/devel/2018-June/021931.html
>
I can't be sure, but I don't think his intent was to infer the
coverage from the ini file name. For example, does the tester parse
the ini file name to check for 'qemu' to decide if that target is
being used? Instead, it should look in to the config file to read the
option somehow.
>>
>> > + 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 :
>>
>> I don't think there should be a space character before the colon?
>
> that's a mistake, I'll correct it. Thanks.
>>
>>
>> > + 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
>
>
More information about the devel
mailing list