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

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Thu Jul 5 20:38:48 UTC 2018


Hello Chris,

If you find some time, please review this patch.
It's a small patch but it's important since it affects how the command
will look like.

please review if this patch is alright or we need to have a different
approach.

Thanks
On 3 July 2018 at 20:30, Vijay Kumar Banerjee <vijaykumar9597 at gmail.com>
wrote:

> Close #3440
> ---
>  tester/rt/test.py                            | 21 ++++++++++++++-------
>  tester/rtems/testing/bsps/leon3-qemu-cov.ini |  1 +
>  2 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/tester/rt/test.py b/tester/rt/test.py
> index 9214ad6..5d25d82 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 analysis for
> specific sets.'}
>          mailer.append_options(optargs)
>          opts = options.load(sys.argv,
>                              optargs = optargs,
> @@ -283,14 +283,21 @@ def run(command_path = None):
>              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')
> +        try:
> +            coverage_enabled = opts.defaults.get('coverage')
> +        except:
> +            coverage_enabled = False
>          if coverage_enabled:
>              cov_trace = 'cov' in debug_trace.split(',')
> -            if len(coverage_enabled) == 2:
> -                coverage_runner = coverage.coverage_run(opts.defaults,
> -                                                        executables,
> -                                                        symbol_set =
> coverage_enabled[1],
> -                                                        trace = cov_trace)
> +            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,
> +                                                            executables,
> +                                                            symbol_set =
> coverage_sets[1],
> +                                                            trace =
> cov_trace)
>              else:
>                  coverage_runner = coverage.coverage_run(opts.defaults,
>                                                          executables,
> diff --git a/tester/rtems/testing/bsps/leon3-qemu-cov.ini
> b/tester/rtems/testing/bsps/leon3-qemu-cov.ini
> index 2f89117..6462448 100644
> --- a/tester/rtems/testing/bsps/leon3-qemu-cov.ini
> +++ b/tester/rtems/testing/bsps/leon3-qemu-cov.ini
> @@ -38,3 +38,4 @@ target            = sparc-rtems5
>  tester            = %{_rtscripts}/qemu.cfg
>  bsp_qemu_opts     = %{qemu_opts_base} -M leon3_generic
>  bsp_qemu_cov_opts = -exec-trace %{test_executable}.cov
> +coverage          = True
> --
> 2.14.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180706/14e9a0dd/attachment-0002.html>


More information about the devel mailing list