[PATCH] Coverage : Use '.o' files for coverage analysis

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Tue Oct 16 03:03:30 UTC 2018


On Tue, Oct 16, 2018, 8:15 AM Chris Johns <chrisj at rtems.org> wrote:

> Hi Vijay
>
> Thank you for the patch.
>
> On 13/10/2018 13:29, Vijay Kumar Banerjee wrote:
> > Use the Object files in cpukit/ instead of the static library
> > for Coverage analysis
>
> Are there any code changes in covoar or is the only change this patch?

a few lines can be removed from covoar as the script
is doing the job, but I wasn't sure that we wanted it removed from covoar
so I kept it untouched.

>
> > ---
> >  tester/rt/coverage.py                         | 27 ++++--
> >  tester/rtems/testing/coverage/symbol-sets.ini | 90 +++++++++----------
> >  2 files changed, 66 insertions(+), 51 deletions(-)
> >
> > diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
> > index c979332..55cb59a 100644
> > --- a/tester/rt/coverage.py
> > +++ b/tester/rt/coverage.py
> > @@ -244,13 +244,17 @@ class symbol_parser(object):
> >                   symbol_config_path,
> >                   symbol_select_path,
> >                   symbol_set,
> > -                 build_dir):
> > +                 build_dir,
> > +                 bsp_name,
> > +                 target):
> >          self.symbol_select_file = symbol_select_path
> >          self.symbol_file = symbol_config_path
> >          self.build_dir = build_dir
> >          self.symbol_sets = {}
> >          self.symbol_set = symbol_set
> >          self.ssets = []
> > +        self.bsp_name = bsp_name
> > +        self.target = target
> >
> >      def parse(self):
> >          config = configparser.ConfigParser()
> > @@ -264,9 +268,13 @@ class symbol_parser(object):
> >              for sset in self.ssets:
> >                  lib = path.join(self.build_dir, config.get('libraries',
> sset))
> >                  self.symbol_sets[sset] = lib.encode('utf-8')
> > +                ss = self.symbol_sets[sset]
> > +                ss = ss.replace('@BSP@', self.bsp_name)
> > +                ss = ss.replace('@BUILD-TARGET@', self.target)
> > +                self.symbol_sets[sset] = ss
> >              return self.ssets
> >          except:
> > -            raise error.general('Symbol set parsing failed')
> > +            raise error.general('Symbol set parsing failed for %s' %
> sset)
>
> I put all values after the '%' in '()', that is "... %s' % (sset))".
>
Thanks.

>
> >
> >      def write_ini(self, symbol_set):
> >          config = configparser.ConfigParser()
> > @@ -275,11 +283,15 @@ class symbol_parser(object):
> >              config.add_section('symbol-sets')
> >              config.set('symbol-sets', 'sets', sset)
> >              config.add_section(sset)
> > -            config.set(sset, 'libraries', self.symbol_sets[sset])
> > +            object_files = [o for o in
> os.listdir(self.symbol_sets[sset]) if o[-1] == 'o']
> > +            object_paths = []
> > +            for o in object_files:
> > +                object_paths.append(path.join(self.symbol_sets[sset],
> o))
> > +            config.set(sset, 'libraries', ','.join(object_paths))
> >              with open(self.symbol_select_file, 'w') as conf:
> > -                config.write(conf)
> > +                    config.write(conf)
> >          except:
> > -            raise error.general('symbol parser write failed')
> > +            raise error.general('symbol parser write failed for %s' %
> sset)
>
> Same here.
>
> Chris
>
> >
> >  class covoar(object):
> >      '''
> > @@ -357,6 +369,7 @@ class coverage_run(object):
> >          self.report_format = self.macros['cov_report_format']
> >          self.symbol_set = symbol_set
> >          self.target = self.macros['target']
> > +        self.bsp_name = self.macros['bsp'].split('-')[0]
> >
> >      def run(self):
> >          try:
> > @@ -366,7 +379,9 @@ class coverage_run(object):
> >              parser = symbol_parser(self.symbol_config_path,
> >                                     self.symbol_select_path,
> >                                     self.symbol_set,
> > -                                   build_dir)
> > +                                   build_dir,
> > +                                   self.bsp_name,
> > +                                   self.target)
> >              symbol_sets = parser.parse()
> >              for sset in symbol_sets:
> >                  parser.write_ini(sset)
> > diff --git a/tester/rtems/testing/coverage/symbol-sets.ini
> b/tester/rtems/testing/coverage/symbol-sets.ini
> > index 2685ef4..8f85533 100644
> > --- a/tester/rtems/testing/coverage/symbol-sets.ini
> > +++ b/tester/rtems/testing/coverage/symbol-sets.ini
> > @@ -29,50 +29,50 @@
> >  #
> >
> >  [symbol-sets]
> > -sets =
> score,rtems,sapi,libdl,posix,libirfs,libdosfs,libdevfs,libimfs,libcsupport,libbspcmdline,libcpuuse,libstackchk,libfsmount,libstringto,libdevnull,libdumpbuf,libblock
> > +sets =
> score,rtems,sapi,libdl,posix,librfs,libdosfs,libdevfs,libimfs,libbspcmdline,libcpuuse,libstackchk,libfsmount,libstringto,libdevnull,libdumpbuf,libblock
> >
> >  [libraries]
> > -score         = @BUILD-TARGET@/c/@BSP@/cpukit/score/libscore.a
> > -rtems         = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/librtems.a
> > -sapi          = @BUILD-TARGET@/c/@BSP@/cpukit/sapi/libsapi.a
> > -libdl         = @BUILD-TARGET@/c/@BSP@/cpukit/libdl/libdl.a
> > -posix         = @BUILD-TARGET@/c/@BSP@/cpukit/posix/libposix.a
> > -libirfs       = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/librfs.a
> > -libdosfs      = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/libdosfs.a
> > -libdevfs      = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/libdevfs.a
> > -libimfs       = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/libimfs.a
> > -#libdefaultsfs = @BUiLD-TARGET@/c/@BSP@/cpukit/libfs/libdefaultfs.a
> > -#libjffs2      = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/libjffs2.a
> > -#dtc           = @BUILD-TARGET@/c/@BSP@/cpukit/libfdt/libfdt.a
> > -#libdrvmgr     = @BUILD-TARGET@/c/@BSP@/cpukit/libdrvmgr/libdrvmgr.a
> > -#libi2c        = @BUILD-TARGET@/c/@BSP@/cpukit/libi2c/libi2c.a
> > -libcsupport   = @BUILD-TARGET@/c/@BSP@/cpukit/libcsupport/libcsupport.a
> > -libbspcmdline = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libbspcmdline.a
> > -libcpuuse     = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libcpuuse.a
> > -libstackchk   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libstackchk.a
> > -libfsmount    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libfsmount.a
> > -libstringto   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libstringto.a
> > -libdevnull    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libdevnull.a
> > -libdumpbuf    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libdumpbuf.a
> > -#libcapture    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libcapture.a
> > -#libdummy      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libdummy.a
> > -#libmonitor    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libmonitor.a
> > -#libmouse      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libmouse.a
> > -#libmw-fb      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libmw-fb.a
> > -#libredirector = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libredirector.a
> > -#librtemsfdt   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/librtemsfdt.a
> > -#libserdbg     = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libserdbg.a
> > -#libshell      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libshell.a
> > -#libtestsupport= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libtestsupport.a
> > -#libuntar      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libuntar.a
> > -#libutf8proc   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libutf8proc.a
> > -#libuuid       = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libuuid.a
> > -#libxz         = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/libxz.a
> > -libblock      = @BUILD-TARGET@/c/@BSP@/cpukit/libblock/libblock.a
> > -#libpci        = @BUILD-TARGET@/c/@BSP@/cpukit/libpci/libpci.a
> > -#librpc        = @BUILD-TARGET@/c/@BSP@/cpukit/librpc/librpc.a
> > -#libxdr        = @BUILD-TARGET@/c/@BSP@/cpukit/librpc/libxdr.a
> > -#libcrypt      = @BUILD-TARGET@/c/@BSP@/cpukit/libcrypt/libcrypt.a
> > -#libmd         = @BUILD-TARGET@/c/@BSP@/cpukit/libmd/libmd.a
> > -#libstdthreads = @BUILD-TARGET@/c/@BSP@
> /cpukit/libstdthreads/libstdthreads.a
> > -#zlib          = @BUILD-TARGET@/c/@BSP@/cpukit/zlib/libz.a
> > +score         = @BUILD-TARGET@/c/@BSP@/cpukit/score/src
> > +rtems         = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/src
> > +sapi          = @BUILD-TARGET@/c/@BSP@/cpukit/sapi/src
> > +libdl         = @BUILD-TARGET@/c/@BSP@/cpukit/libdl
> > +posix         = @BUILD-TARGET@/c/@BSP@/cpukit/posix/src
> > +librfs       = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/rfs
> > +libdosfs      = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/dosfs
> > +libdevfs      = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/devfs
> > +libimfs       = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/imfs
> > +#libdefaultsfs = @BUiLD-TARGET@/c/@BSP@/cpukit/libfs
> > +#libjffs2      = @BUILD-TARGET@/c/@BSP@/cpukit/libfs
> > +#dtc           = @BUILD-TARGET@/c/@BSP@/cpukit/libfdt
> > +#libdrvmgr     = @BUILD-TARGET@/c/@BSP@/cpukit/libdrvmgr
> > +#libi2c        = @BUILD-TARGET@/c/@BSP@/cpukit/libi2c
> > +#libcsupport   = @BUILD-TARGET@/c/@BSP@/cpukit/libcsupport/src
> > +libbspcmdline = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/bspcmdline
> > +libcpuuse     = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/cpuuse
> > +libstackchk   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/stackchk
> > +libfsmount    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/fsmount
> > +libstringto   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/stringto
> > +libdevnull    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/devnull
> > +libdumpbuf    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/dumpbuf
> > +#libcapture    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libdummy      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libmonitor    = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libmouse      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libmw-fb      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libredirector = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#librtemsfdt   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libserdbg     = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libshell      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libtestsupport= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libuntar      = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libutf8proc   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libuuid       = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +#libxz         = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
> > +libblock      = @BUILD-TARGET@/c/@BSP@/cpukit/libblock/src
> > +#libpci        = @BUILD-TARGET@/c/@BSP@/cpukit/libpci
> > +#librpc        = @BUILD-TARGET@/c/@BSP@/cpukit/librpc
> > +#libxdr        = @BUILD-TARGET@/c/@BSP@/cpukit/librpc
> > +#libcrypt      = @BUILD-TARGET@/c/@BSP@/cpukit/libcrypt
> > +#libmd         = @BUILD-TARGET@/c/@BSP@/cpukit/libmd
> > +#libstdthreads = @BUILD-TARGET@/c/@BSP@/cpukit/libstdthreads
> > +#zlib          = @BUILD-TARGET@/c/@BSP@/cpukit/zlib
> >
> _______________________________________________
> 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/20181016/937d55ca/attachment-0002.html>


More information about the devel mailing list