On Wed, 6 Feb 2019 at 02:35, Chris Johns <chr...@rtems.org> wrote:

> On 6/2/19 1:41 am, Vijay Kumar Banerjee wrote:
> > On Tue, 5 Feb 2019 at 03:37, Chris Johns <chr...@rtems.org
> > <mailto:chr...@rtems.org>> wrote:
>      On 1/2/19 10:47 pm, Vijay Kumar Banerjee wrote:
> >     >          self.trace = trace
> >     >          self.prefix = prefix
> >     > +        self.bsp = bsp
> >     >
> >     >      def _find_covoar(self):
> >     >          covoar_exe = 'covoar'
> >     > @@ -316,10 +323,18 @@ class covoar(object):
> >     >          if not path.exists(symbol_file):
> >     >              raise error.general('coverage: no symbol set file:
> %s'%
> >     (symbol_file))
> >     >          exe = self._find_covoar()
> >     > -        command = exe + ' -S ' + symbol_file + \
> >     > -                  ' -O ' + covoar_result_dir + \
> >     > -                  ' -E ' + self.explanations_txt + \
> >     > -                  ' -p ' + self.project_name + ' ' +
> self.executables
> >     > +        if 'qemu' in self.bsp.split('-'):
> >
> >     Are you checking for 'qemu' in the BSP name? The naming used here is
> a
> >     convention and making the code depend on a naming convention is
> fragile. Lets
> >     not do this.
> >
> >     There is a `%{qemu-cmd}` macro defined which must exist for a qemu
> run so it is
> >     better to check for this. However ...
> >
> > I'm not able to get it with macros.find(). What's the right way to find
> it?
>
> Find should work and `get` should also work and may be simpler.
>
> > Also, there's a 'cov_format' in testing.mc <http://testing.mc> that is
> hardcoded
> > to 'QEMU'. Can this value be updated from the cfg files ?
>
> I do not mind but maybe this logic is not needed if you can create the
> command
> line in a .cfg file. This means you can bring the needed options together
> from
> the BSP file which could hold the `-f TSIM` option you need and the code
> here is
> common for all coverage.
>
> >     > +            command = exe + ' -S ' + symbol_file + \
> >     > +                      ' -O ' + covoar_result_dir + \
> >     > +                      ' -E ' + self.explanations_txt + \
> >     > +                      ' -p ' + self.project_name + ' ' +
> self.executables
> >     > +        else:
> >     > +            command = exe + ' -S ' + symbol_file + \
> >     > +                      ' -O ' + covoar_result_dir + \
> >     > +                      ' -E ' + self.explanations_txt + \
> >     > +                      ' -f TSIM' + \
> >     > +                      ' -p ' + self.project_name + ' ' +
> self.executables
> >
> >     ... I would prefer the command be managed in the config files and
> this code
> >     removed. Do you think this can be done?
> >
> > the exe and the symbol_files are generated by the script itself. I think
> we have
> > to call covoar from the script only.
>
> That is fine, it is just the command line that I am asking about.
>
> something like the attached patch?

> Chris
>
From 33939f89efd1b876b69401e11362bf482af2bdde Mon Sep 17 00:00:00 2001
From: Vijay Kumar Banerjee <vijaykumar9...@gmail.com>
Date: Fri, 1 Feb 2019 01:01:42 +0530
Subject: [PATCH v2] Coverage: Add support for TSIM format

---
 tester/rt/coverage.py                       | 31 ++++++++++++++-------
 tester/rtems/testing/bsps/leon3-sis-cov.ini | 12 ++++----
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 9fc9b64..846b098 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -45,6 +45,7 @@ from rtemstoolkit import path
 from rtemstoolkit import log
 from rtemstoolkit import execute
 from rtemstoolkit import macros
+from rtemstoolkit import version
 
 
 import options
@@ -288,14 +289,20 @@ class covoar(object):
     '''
     Covoar runner
     '''
-    def __init__(self, base_result_dir, config_dir, executables, explanations_txt, trace, prefix):
+    def __init__(self,
+                 base_result_dir,
+                 config_dir,
+                 executables,
+                 trace,
+                 prefix,
+                 covoar_cmd):
         self.base_result_dir = base_result_dir
         self.config_dir = config_dir
         self.executables = ' '.join(executables)
-        self.explanations_txt = explanations_txt
-        self.project_name = 'RTEMS-5'
+        self.project_name = 'RTEMS-' + str(version.version())
         self.trace = trace
         self.prefix = prefix
+        self.covoar_cmd = covoar_cmd
 
     def _find_covoar(self):
         covoar_exe = 'covoar'
@@ -317,9 +324,11 @@ class covoar(object):
             raise error.general('coverage: no symbol set file: %s'% (symbol_file))
         exe = self._find_covoar()
         command = exe + ' -S ' + symbol_file + \
-                  ' -O ' + covoar_result_dir + \
-                  ' -E ' + self.explanations_txt + \
-                  ' -p ' + self.project_name + ' ' + self.executables
+                   ' -O ' + covoar_result_dir + \
+                   ' -p ' + self.project_name + \
+                   ' ' + self.executables + ' '
+        command += self.covoar_cmd
+
         log.notice()
         log.notice('Running coverage analysis: %s (%s)' % (set_name, covoar_result_dir))
         start_time = datetime.datetime.now()
@@ -344,7 +353,6 @@ class coverage_run(object):
         self.trace = trace
         self.macros = macros_
         self.build_dir = self.macros['_cwd']
-        self.explanations_txt = self.macros.expand(self.macros['cov_explanations'])
         self.test_dir = path.join(self.build_dir, self.macros['bsp'] + '-coverage')
         if not path.exists(self.test_dir):
             path.mkdir(self.test_dir)
@@ -364,6 +372,7 @@ class coverage_run(object):
         self.bsp_name = self.macros['bsp'].split('-')[0]
         self.prefix = prefix
         self.macros.define('coverage')
+        self.covoar_cmd = self.macros.expand(self.macros['bsp_covoar_cmd'])
 
     def run(self):
         try:
@@ -379,10 +388,12 @@ class coverage_run(object):
             symbol_sets = parser.parse()
             for sset in symbol_sets:
                 parser.write_ini(sset)
-                covoar_runner = covoar(self.test_dir, self.symbol_select_path,
-                                       self.executables, self.explanations_txt,
+                covoar_runner = covoar(self.test_dir,
+                                       self.symbol_select_path,
+                                       self.executables,
                                        self.trace,
-                                       self.prefix)
+                                       self.prefix,
+                                       self.covoar_cmd)
                 covoar_runner.run(sset, self.symbol_select_path)
             self._generate_reports(symbol_sets);
             self._summarize();
diff --git a/tester/rtems/testing/bsps/leon3-sis-cov.ini b/tester/rtems/testing/bsps/leon3-sis-cov.ini
index f0a2ab9..d60257c 100644
--- a/tester/rtems/testing/bsps/leon3-sis-cov.ini
+++ b/tester/rtems/testing/bsps/leon3-sis-cov.ini
@@ -32,8 +32,10 @@
 # The leon3 BSP on sis with coverage
 #
 [leon3-sis-cov]
-bsp          = leon3
-arch         = sparc
-tester       = %{_rtscripts}/run.cfg
-bsp_run_cmd  = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -leon3 -nouartrx -r -tlim 200 s -cov
+bsp            = leon3-sis
+arch           = sparc
+tester         = %{_rtscripts}/run.cfg
+target         = sparc-rtems5
+bsp_run_cmd    = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
+bsp_run_opts   = -leon3 -nouartrx -r -tlim 200 s -cov
+bsp_covoar_cmd = -E %{cov_explanations} -f TSIM
-- 
2.17.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to