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

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Mon Jun 25 20:31:58 UTC 2018


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..029ee7c 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 of test executables.'}
         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



More information about the devel mailing list