<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 6, 2018, 1:16 AM Cillian O'Donnell <<a href="mailto:cpodonnell8@gmail.com">cpodonnell8@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Wed, 6 Jun 2018, 01:52 Joel Sherrill, <<a href="mailto:joel@rtems.org" target="_blank" rel="noreferrer">joel@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 5, 2018, 7:22 PM Vijay Kumar Banerjee <<a href="mailto:vijaykumar9597@gmail.com" rel="noreferrer noreferrer" target="_blank">vijaykumar9597@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 6 June 2018 at 03:57, Joel Sherrill <span dir="ltr"><<a href="mailto:joel@rtems.org" rel="noreferrer noreferrer noreferrer" target="_blank">joel@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think everything is pushed. Is there any patch outstanding?</div></blockquote></div></div></div></blockquote></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><br></div></blockquote><div>Thank you. </div><div>No outstanding patch, everything on my side is squashed into it. :) </div></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">So we can (finally) switch to the RTEMS.org repos to as the baseline? </div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">That's everything! Started summer 2014 and now it's all merged, it's great to see. Well done Vijay.</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Agreed! Now to finish this GSoC's goals and define the near term things to work on.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote"><div><div class="m_-2490010092224910121m_-1702053650207426654m_4490334518909941979h5">On Mon, Jun 4, 2018 at 3:44 PM, Vijay Kumar Banerjee <span dir="ltr"><<a href="mailto:vijaykumar9597@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">vijaykumar9597@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-2490010092224910121m_-1702053650207426654m_4490334518909941979h5">Add support in tester to run covoar and generate an html report to display<br>
the summary of the coverage reports generated from covoar.<br>
<br>
Co-authored-by : Cillian O'Donnell <<a href="mailto:cpodonnell8@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">cpodonnell8@gmail.com</a>><br>
---<br>
.gitignore | 1 +<br>
tester/rt/coverage.py | 385 ++++++++++++++++++++++++++<br>
tester/rt/test.py | 34 ++-<br>
tester/rtems/testing/bsps/leon3-qemu-cov.ini | 3 +-<br>
tester/rtems/testing/coverage/symbol-sets.ini | 36 +++<br>
tester/rtems/testing/qemu.cfg | 4 +-<br>
6 files changed, 450 insertions(+), 13 deletions(-)<br>
create mode 100644 tester/rt/coverage.py<br>
create mode 100644 tester/rtems/testing/coverage/symbol-sets.ini<br>
<br>
diff --git a/.gitignore b/.gitignore<br>
index 6ab3709..93cb5d2 100644<br>
--- a/.gitignore<br>
+++ b/.gitignore<br>
@@ -9,3 +9,4 @@ waf3-*<br>
.lock-waf*<br>
build<br>
VERSION*<br>
+*symbols.ini<br>
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py<br>
new file mode 100644<br>
index 0000000..54933d5<br>
--- /dev/null<br>
+++ b/tester/rt/coverage.py<br>
@@ -0,0 +1,385 @@<br>
+#<br>
+# RTEMS Tools Project (<a href="http://www.rtems.org/" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">http://www.rtems.org/</a>)<br>
+# Copyright 2014 Krzysztof Miesowicz (<a href="mailto:krzysztof.miesowicz@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">krzysztof.miesowicz@gmail.com</a>)<br>
+# All rights reserved.<br>
+#<br>
+# This file is part of the RTEMS Tools package in 'rtems-tools'.<br>
+#<br>
+# Redistribution and use in source and binary forms, with or without<br>
+# modification, are permitted provided that the following conditions are met:<br>
+#<br>
+# 1. Redistributions of source code must retain the above copyright notice,<br>
+# this list of conditions and the following disclaimer.<br>
+#<br>
+# 2. Redistributions in binary form must reproduce the above copyright notice,<br>
+# this list of conditions and the following disclaimer in the documentation<br>
+# and/or other materials provided with the distribution.<br>
+#<br>
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'<br>
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE<br>
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
+# POSSIBILITY OF SUCH DAMAGE.<br>
+#<br>
+<br>
+from rtemstoolkit import error<br>
+from rtemstoolkit import path<br>
+from rtemstoolkit import log<br>
+from rtemstoolkit import execute<br>
+from rtemstoolkit import macros<br>
+<br>
+from datetime import datetime<br>
+<br>
+from . import options<br>
+<br>
+import shutil<br>
+import os<br>
+<br>
+try:<br>
+ import configparser<br>
+except:<br>
+ import ConfigParser as configparser<br>
+<br>
+class summary:<br>
+ def __init__(self, p_summary_dir):<br>
+ self.summary_file_path = path.join(p_summary_dir, 'summary.txt')<br>
+ self.index_file_path = path.join(p_summary_dir, 'index.html')<br>
+ self.bytes_analyzed = 0<br>
+ self.bytes_not_executed = 0<br>
+ self.percentage_executed = 0.0<br>
+ self.percentage_not_executed = 100.0<br>
+ self.ranges_uncovered = 0<br>
+ self.branches_uncovered = 0<br>
+ self.branches_total = 0<br>
+ self.branches_always_taken = 0<br>
+ self.branches_never_taken = 0<br>
+ self.percentage_branches_covered = 0.0<br>
+ self.is_failure = False<br>
+<br>
+ def parse(self):<br>
+ if(not path.exists(self.summary_file_path)):<br>
+ log.notice('summary file %s does not exist!' % (self.summary_file_path))<br>
+ self.is_failure = True<br>
+ return<br>
+<br>
+ with open(self.summary_file_path,'r') as summary_file:<br>
+ self.bytes_analyzed = self._get_next_with_colon(summary_file)<br>
+ self.bytes_not_executed = self._get_next_with_colon(summary_file)<br>
+ self.percentage_executed = self._get_next_with_colon(summary_file)<br>
+ self.percentage_not_executed = self._get_next_with_colon(summary_file)<br>
+ self.ranges_uncovered = self._get_next_with_colon(summary_file)<br>
+ self.branches_total = self._get_next_with_colon(summary_file)<br>
+ self.branches_uncovered = self._get_next_with_colon(summary_file)<br>
+ self.branches_always_taken = self._get_next_without_colon(summary_file)<br>
+ self.branches_never_taken = self._get_next_without_colon(summary_file)<br>
+ if len(self.branches_uncovered) > 0 and len(self.branches_total) > 0:<br>
+ self.percentage_branches_covered = \<br>
+ 1 - (float(self.branches_uncovered) / float(self.branches_total))<br>
+ else:<br>
+ self.percentage_branches_covered = 0.0<br>
+ return<br>
+<br>
+ def _get_next_with_colon(self, summary_file):<br>
+ line = summary_file.readline()<br>
+ if ':' in line:<br>
+ return line.split(':')[1].strip()<br>
+ else:<br>
+ return ''<br>
+<br>
+ def _get_next_without_colon(self, summary_file):<br>
+ line = summary_file.readline()<br>
+ return line.strip().split(' ')[0]<br>
+<br>
+class report_gen_html:<br>
+ def __init__(self, p_symbol_sets_list, build_dir, rtdir, bsp):<br>
+ self.symbol_sets_list = ['score']<br>
+ self.build_dir = build_dir<br>
+ self.partial_reports_files = list(["index.html", "summary.txt"])<br>
+ self.number_of_columns = 1<br>
+ self.covoar_src_path = path.join(rtdir, 'covoar')<br>
+ self.bsp = bsp<br>
+<br>
+ def _find_partial_reports(self):<br>
+ partial_reports = {}<br>
+ for symbol_set in self.symbol_sets_list:<br>
+ set_summary = summary(path.join(self.build_dir,<br>
+ self.bsp + "-coverage",<br>
+ symbol_set))<br>
+ set_summary.parse()<br>
+ partial_reports[symbol_set] = set_summary<br>
+ return partial_reports<br>
+<br>
+ def _prepare_head_section(self):<br>
+ head_section = '''<br>
+ <head><br>
+ <title>RTEMS coverage report</title><br>
+ <style type="text/css"><br>
+ progress[value] {<br>
+ -webkit-appearance: none;<br>
+ appearance: none;<br>
+<br>
+ width: 150px;<br>
+ height: 15px;<br>
+ }<br>
+ </style><br>
+ </head>'''<br>
+ return head_section<br>
+<br>
+ def _prepare_index_content(self, partial_reports):<br>
+ header = "<h1> RTEMS coverage analysis report </h1>"<br>
+ header += "<h3>Coverage reports by symbols sets:</h3>"<br>
+ table = "<table>"<br>
+ table += self._header_row()<br>
+ for symbol_set in partial_reports:<br>
+ table += self._row(symbol_set, partial_reports[symbol_set])<br>
+ table += "</table> </br>"<br>
+ timestamp = "Analysis performed on " + datetime.now().ctime()<br>
+ return "<body>\n" + header + table + timestamp + "\n</body>"<br>
+<br>
+ def _row(self, symbol_set, summary):<br>
+ row = "<tr>"<br>
+ row += "<td>" + symbol_set + "</td>"<br>
+ if summary.is_failure:<br>
+ row += ' <td colspan="' + str(self.number_of_columns-1) \<br>
+ + '" style="background-color:red">FAILURE</td>'<br>
+ else:<br>
+ row += " <td>" + self._link(summary.index_file_path,"Index") \<br>
+ + "</td>"<br>
+ row += " <td>" + self._link(summary.summary_file_path,"Summary") \<br>
+ + "</td>"<br>
+ row += " <td>" + summary.bytes_analyzed + "</td>"<br>
+ row += " <td>" + summary.bytes_not_executed + "</td>"<br>
+ row += " <td>" + summary.ranges_uncovered + "</td>"<br>
+ row += " <td>" + summary.percentage_executed + "%</td>"<br>
+ row += " <td>" + summary.percentage_not_executed + "%</td>"<br>
+ row += ' <td><progress value="' + summary.percentage_executed \<br>
+ + '" max="100"></progress></td>'<br>
+ row += " <td>" + summary.branches_uncovered + "</td>"<br>
+ row += " <td>" + summary.branches_total + "</td>"<br>
+ row += " <td> {:.3%} </td>".format(summary.percentage_branches_covered)<br>
+ row += ' <td><progress value="{:.3}" max="100"></progress></td>'.format(100*summary.percentage_branches_covered)<br>
+ row += "</tr>\n"<br>
+ return row<br>
+<br>
+ def _header_row(self):<br>
+ row = "<tr>"<br>
+ row += "<th> Symbols set name </th>"<br>
+ row += "<th> Index file </th>"<br>
+ row += "<th> Summary file </th>"<br>
+ row += "<th> Bytes analyzed </th>"<br>
+ row += "<th> Bytes not executed </th>"<br>
+ row += "<th> Uncovered ranges </th>"<br>
+ row += "<th> Percentage covered </th>"<br>
+ row += "<th> Percentage uncovered </th>"<br>
+ row += "<th> Instruction coverage </th>"<br>
+ row += "<th> Branches uncovered </th>"<br>
+ row += "<th> Branches total </th>"<br>
+ row += "<th> Branches covered percentage </th>"<br>
+ row += "<th> Branches coverage </th>"<br>
+ row += "</tr>\n"<br>
+ self.number_of_columns = row.count('<th>')<br>
+ return row<br>
+<br>
+ def _link(self, address, text):<br>
+ return '<a href="' + address + '">' + text + '</a>'<br>
+<br>
+ def _create_index_file(self, head_section, content):<br>
+ with open(path.join(self.build_dir,<br>
+ self.bsp + "-report.html"),'w') as f:<br>
+ f.write(head_section)<br>
+ f.write(content)<br>
+<br>
+ def generate(self):<br>
+ partial_reports = self._find_partial_reports()<br>
+ head_section = self._prepare_head_section()<br>
+ index_content = self._prepare_index_content(partial_reports)<br>
+ self._create_index_file(head_section,index_content)<br>
+<br>
+ def add_covoar_src_path(self):<br>
+ table_js_path = path.join(self.covoar_src_path, 'table.js')<br>
+ covoar_css_path = path.join(self.covoar_src_path, 'covoar.css')<br>
+ for symbol_set in self.symbol_sets_list:<br>
+ symbol_set_dir = path.join(self.build_dir,<br>
+ self.bsp + '-coverage', symbol_set)<br>
+ html_files = os.listdir(symbol_set_dir)<br>
+ for html_file in html_files:<br>
+ html_file = path.join(symbol_set_dir, html_file)<br>
+ if path.exists(html_file) and 'html' in html_file:<br>
+ with open(html_file, 'r') as f:<br>
+ file_data = f.read()<br>
+ file_data = file_data.replace('table.js', table_js_path)<br>
+ file_data = file_data.replace('covoar.css',<br>
+ covoar_css_path)<br>
+ with open(html_file, 'w') as f:<br>
+ f.write(file_data)<br>
+<br>
+class build_path_generator(object):<br>
+ '''<br>
+ Generates the build path from the path to executables<br>
+ '''<br>
+ def __init__(self, executables, target):<br>
+ self.executables = executables<br>
+ self.target = target<br>
+ def run(self):<br>
+ build_path = '/'<br>
+ Path = self.executables[0].split('/')<br>
+ for P in Path:<br>
+ if P == self.target:<br>
+ break;<br>
+ else:<br>
+ build_path = path.join(build_path, P)<br>
+ return build_path<br>
+<br>
+class symbol_parser(object):<br>
+ '''<br>
+ Parse the symbol sets ini and create custom ini file for covoar<br>
+ '''<br>
+ def __init__(self, symbol_config_path,<br>
+ symbol_select_path, coverage_arg, build_dir):<br>
+ self.symbol_select_file = symbol_select_path<br>
+ self.symbol_file = symbol_config_path<br>
+ self.build_dir = build_dir<br>
+ self.symbol_sets = {}<br>
+ self.cov_arg = coverage_arg<br>
+ self.ssets = []<br>
+<br>
+ def parse(self):<br>
+ config = configparser.ConfigParser()<br>
+ try:<br>
+ config.read(self.symbol_file)<br>
+ if self.cov_arg:<br>
+ self.ssets = self.cov_arg.split(',')<br>
+ else:<br>
+ self.ssets = config.get('symbol-sets', 'sets').split(',')<br>
+ self.ssets = [ sset.encode('utf-8') for sset in self.ssets]<br>
+ for sset in self.ssets:<br>
+ lib = path.join(self.build_dir,<br>
+ config.get('libraries', sset))<br>
+ self.symbol_sets[sset] = lib.encode('utf-8')<br>
+ except:<br>
+ raise error.general('Symbol set parsing failed')<br>
+<br>
+ def _write_ini(self):<br>
+ config = configparser.ConfigParser()<br>
+ try:<br>
+ sets = ', '.join(self.symbol_sets.keys())<br>
+ config.add_section('symbol-sets')<br>
+ config.set('symbol-sets', 'sets', sets)<br>
+ for key in self.symbol_sets.keys():<br>
+ config.add_section(key)<br>
+ config.set(key, 'libraries', self.symbol_sets[key])<br>
+ with open(self.symbol_select_file, 'w') as conf:<br>
+ config.write(conf)<br>
+ except:<br>
+ raise error.general('write failed')<br>
+<br>
+ def run(self):<br>
+ self.parse()<br>
+ self._write_ini()<br>
+<br>
+class covoar(object):<br>
+ '''<br>
+ Covoar runner<br>
+ '''<br>
+ def __init__(self, base_result_dir, config_dir, executables, explanations_txt):<br>
+ self.base_result_dir = base_result_dir<br>
+ self.config_dir = config_dir<br>
+ self.executables = ' '.join(executables)<br>
+ self.explanations_txt = explanations_txt<br>
+ self.project_name = 'RTEMS-5'<br>
+<br>
+ def run(self, set_name, symbol_file):<br>
+ covoar_result_dir = path.join(self.base_result_dir, set_name)<br>
+ if (not path.exists(covoar_result_dir)):<br>
+ path.mkdir(covoar_result_dir)<br>
+ if (not path.exists(symbol_file)):<br>
+ raise error.general('symbol set file: coverage %s was not created for covoar, skipping %s'% (symbol_file, set_name))<br>
+ command = ('covoar -S ' + symbol_file<br>
+ + ' -O ' + covoar_result_dir<br>
+ + ' -E ' + self.explanations_txt<br>
+ + ' -p ' + self.project_name + ' ' + self.executables)<br>
+ log.notice('Running covoar for %s' % (set_name))<br>
+ print( 'covoar results directory:\n' + covoar_result_dir )<br>
+ executor = execute.execute(verbose = True, output = self.output_handler)<br>
+ exit_code = executor.shell(command, cwd=os.getcwd())<br>
+ if (exit_code[0] != 0):<br>
+ raise error.general('covoar failure exit code: %d' % (exit_code[0]))<br>
+ log.notice('Coverage run for %s finished successfully.' % (set_name))<br>
+ log.notice('-----------------------------------------------')<br>
+<br>
+ def output_handler(self, text):<br>
+ log.notice('%s' % (text))<br>
+<br>
+class coverage_run(object):<br>
+ '''<br>
+ Coverage analysis support for rtems-test<br>
+ '''<br>
+ def __init__(self, p_macros, coverage_arg, executables):<br>
+ '''<br>
+ Constructor<br>
+ '''<br>
+ self.macros = p_macros<br>
+ self.build_dir = self.macros['_cwd']<br>
+ self.explanations_txt = self.macros.expand(self.macros['cov_explanations'])<br>
+ self.test_dir = path.join(self.build_dir, self.macros['bsp'] + '-coverage')<br>
+ if (not path.exists(self.test_dir)):<br>
+ path.mkdir(self.test_dir)<br>
+ self.rtdir = path.abspath(self.macros['_rtdir'])<br>
+ self.rtscripts = self.macros.expand(self.macros['_rtscripts'])<br>
+ self.coverage_config_path = path.join(self.rtscripts, 'coverage')<br>
+ self.symbol_config_path = path.join(self.coverage_config_path,<br>
+ 'symbol-sets.ini')<br>
+ self.symbol_select_path = path.join(self.coverage_config_path,<br>
+ self.macros['bsp'] + '-symbols.ini')<br>
+ self.executables = executables<br>
+ self.symbol_sets = []<br>
+ self.no_clean = int(self.macros['_no_clean'])<br>
+ self.report_format = self.macros['cov_report_format']<br>
+ self.coverage_arg = coverage_arg<br>
+ self.target = self.macros['target']<br>
+<br>
+ def run(self):<br>
+ try:<br>
+ if self.executables is None:<br>
+ raise error.general('no test executables provided.')<br>
+ build_dir = build_path_generator(self.executables, self.target).run()<br>
+ parser = symbol_parser(self.symbol_config_path,<br>
+ self.symbol_select_path,<br>
+ self.coverage_arg,<br>
+ build_dir)<br>
+ parser.run()<br>
+ covoar_runner = covoar(self.test_dir, self.symbol_select_path,<br>
+ self.executables, self.explanations_txt)<br>
+ covoar_runner.run('score', self.symbol_select_path)<br>
+ self._generate_reports();<br>
+ self._summarize();<br>
+ finally:<br>
+ self._cleanup();<br>
+<br>
+ def _generate_reports(self):<br>
+ log.notice('Generating reports')<br>
+ if self.report_format == 'html':<br>
+ report = report_gen_html(self.symbol_sets,<br>
+ self.build_dir,<br>
+ self.rtdir,<br>
+ self.macros['bsp'])<br>
+ report.generate()<br>
+ report.add_covoar_src_path()<br>
+<br>
+ def _cleanup(self):<br>
+ if not self.no_clean:<br>
+ log.notice('***Cleaning tempfiles***')<br>
+ for exe in self.executables:<br>
+ trace_file = exe + '.cov'<br>
+ if path.exists(trace_file):<br>
+ os.remove(trace_file)<br>
+ os.remove(self.symbol_select_path)<br>
+<br>
+ def _summarize(self):<br>
+ log.notice('Coverage analysis finished. You can find results in %s' % (self.build_dir))<br>
diff --git a/tester/rt/test.py b/tester/rt/test.py<br>
index f4d9b5c..0e744cd 100644<br>
--- a/tester/rt/test.py<br>
+++ b/tester/rt/test.py<br>
@@ -48,12 +48,14 @@ from rtemstoolkit import mailer<br>
from rtemstoolkit import reraise<br>
from rtemstoolkit import stacktraces<br>
from rtemstoolkit import version<br>
+from rtemstoolkit import check<br>
<br>
from . import bsps<br>
from . import config<br>
from . import console<br>
from . import options<br>
from . import report<br>
+from . import coverage<br>
<br>
class log_capture(object):<br>
def __init__(self):<br>
@@ -147,7 +149,7 @@ class test_run(object):<br>
<br>
def run(self):<br>
self.thread = threading.Thread(target = self.runner,<br>
- name = 'test[%s]' % path.basename(self.executable))<br>
+ name = 'test[%s]' % path.basename(self.executable))<br>
self.thread.start()<br>
<br>
def is_alive(self):<br>
@@ -221,15 +223,16 @@ def run(command_path = None):<br>
opts = None<br>
default_exefilter = '*.exe'<br>
try:<br>
- optargs = { '--rtems-tools': 'The path to the RTEMS tools',<br>
- '--rtems-bsp': 'The RTEMS BSP to run the test on',<br>
- '--user-config': 'Path to your local user configuration INI file',<br>
- '--report-mode': 'Reporting modes, failures (default),all,none',<br>
- '--list-bsps': 'List the supported BSPs',<br>
- '--debug-trace': 'Debug trace based on specific flags',<br>
- '--filter': 'Glob that executables must match to run (default: ' +<br>
+ optargs = { '--rtems-tools': 'The path to the RTEMS tools',<br>
+ '--rtems-bsp': 'The RTEMS BSP to run the test on',<br>
+ '--user-config': 'Path to your local user configuration INI file',<br>
+ '--report-mode': 'Reporting modes, failures (default),all,none',<br>
+ '--list-bsps': 'List the supported BSPs',<br>
+ '--debug-trace': 'Debug trace based on specific flags',<br>
+ '--filter': 'Glob that executables must match to run (default: ' +<br>
default_exefilter + ')',<br>
- '--stacktrace': 'Dump a stack trace on a user termination (^C)' }<br>
+ '--stacktrace': 'Dump a stack trace on a user termination (^C)',<br>
+ '--coverage': 'Perform coverage analysis of test executables.'}<br>
mailer.append_options(optargs)<br>
opts = options.load(sys.argv,<br>
optargs = optargs,<br>
@@ -257,6 +260,7 @@ def run(command_path = None):<br>
exe_filter = default_exefilter<br>
opts.log_info()<br>
log.output('Host: ' + host.label(mode = 'all'))<br>
+ executables = find_executables(opts.params(), exe_filter)<br>
debug_trace = opts.find_arg('--debug-trace')<br>
if debug_trace:<br>
if len(debug_trace) != 1:<br>
@@ -279,6 +283,15 @@ def run(command_path = None):<br>
raise error.general('RTEMS BSP not provided or an invalid option')<br>
bsp = config.load(bsp[1], opts)<br>
bsp_config = opts.defaults.expand(opts.defaults['tester'])<br>
+ coverage_enabled = opts.find_arg('--coverage')<br>
+ if coverage_enabled:<br>
+ if len(coverage_enabled) == 2:<br>
+ coverage_runner = coverage.coverage_run(opts.defaults,<br>
+ coverage_enabled[1],<br>
+ executables)<br>
+ else:<br>
+ coverage_runner = coverage.coverage_run(opts.defaults, 0,<br>
+ executables)<br>
report_mode = opts.find_arg('--report-mode')<br>
if report_mode:<br>
if report_mode[1] != 'failures' and \<br>
@@ -288,7 +301,6 @@ def run(command_path = None):<br>
report_mode = report_mode[1]<br>
else:<br>
report_mode = 'failures'<br>
- executables = find_executables(opts.params(), exe_filter)<br>
if len(executables) == 0:<br>
raise error.general('no executables supplied')<br>
start_time = datetime.datetime.now()<br>
@@ -365,6 +377,8 @@ def run(command_path = None):<br>
reports.failures(),<br>
'Log', '===', ''] + output.get()<br>
mail.send(to_addr, subject, os.linesep.join(body))<br>
+ if coverage_enabled:<br>
+ coverage_runner.run()<br>
<br>
except error.general as gerr:<br>
print(gerr)<br>
diff --git a/tester/rtems/testing/bsps/leon3-qemu-cov.ini b/tester/rtems/testing/bsps/leon3-qemu-cov.ini<br>
index 6b5e7e6..2f89117 100644<br>
--- a/tester/rtems/testing/bsps/leon3-qemu-cov.ini<br>
+++ b/tester/rtems/testing/bsps/leon3-qemu-cov.ini<br>
@@ -31,9 +31,10 @@<br>
#<br>
# The Leon 3 QEMU BSP<br>
#<br>
-[leon3-qemu]<br>
+[leon3-qemu-cov]<br>
bsp = leon3-qemu<br>
arch = sparc<br>
+target = sparc-rtems5<br>
tester = %{_rtscripts}/qemu.cfg<br>
bsp_qemu_opts = %{qemu_opts_base} -M leon3_generic<br>
bsp_qemu_cov_opts = -exec-trace %{test_executable}.cov<br>
diff --git a/tester/rtems/testing/coverage/symbol-sets.ini b/tester/rtems/testing/coverage/symbol-sets.ini<br>
new file mode 100644<br>
index 0000000..a2ec7bc<br>
--- /dev/null<br>
+++ b/tester/rtems/testing/coverage/symbol-sets.ini<br>
@@ -0,0 +1,36 @@<br>
+#<br>
+# RTEMS Tools Project (<a href="http://www.rtems.org/" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">http://www.rtems.org/</a>)<br>
+# Copyright 2018 Chris Johns (<a href="mailto:chrisj@rtems.org" rel="noreferrer noreferrer noreferrer" target="_blank">chrisj@rtems.org</a>)<br>
+# All rights reserved.<br>
+#<br>
+# This file is part of the RTEMS Tools package in 'rtems-tools'.<br>
+#<br>
+# Redistribution and use in source and binary forms, with or without<br>
+# modification, are permitted provided that the following conditions are met:<br>
+#<br>
+# 1. Redistributions of source code must retain the above copyright notice,<br>
+# this list of conditions and the following disclaimer.<br>
+#<br>
+# 2. Redistributions in binary form must reproduce the above copyright notice,<br>
+# this list of conditions and the following disclaimer in the documentation<br>
+# and/or other materials provided with the distribution.<br>
+#<br>
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE<br>
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
+# POSSIBILITY OF SUCH DAMAGE.<br>
+#<br>
+<br>
+[symbol-sets]<br>
+sets = score,rtems<br>
+<br>
+[libraries]<br>
+score = @BUILD-TARGET@/c/@BSP@/cpukit/score/libscore.a<br>
+rtems = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/librtems.a<br>
diff --git a/tester/rtems/testing/<a href="http://qemu.cf" rel="noreferrer noreferrer noreferrer" target="_blank">qemu.cf</a>g b/tester/rtems/testing/<a href="http://qemu.cf" rel="noreferrer noreferrer noreferrer" target="_blank">qemu.cf</a>g<br>
index bfcd2f5..52a3752 100644<br>
--- a/tester/rtems/testing/<a href="http://qemu.cf" rel="noreferrer noreferrer noreferrer" target="_blank">qemu.cf</a>g<br>
+++ b/tester/rtems/testing/<a href="http://qemu.cf" rel="noreferrer noreferrer noreferrer" target="_blank">qemu.cf</a>g<br>
@@ -51,8 +51,8 @@<br>
#<br>
# Qemu common option patterns.<br>
#<br>
-#%define qemu_opts_base -no-reboot -monitor none -serial stdio -nographic<br>
-%define qemu_opts_base -no-reboot -serial null -serial mon:stdio -nographic<br>
+%define qemu_opts_base -no-reboot -monitor none -serial stdio -nographic<br>
+#%define qemu_opts_base -no-reboot -serial null -serial mon:stdio -nographic<br>
%define qemu_opts_no_net -net none<br>
<br>
#<br>
</div></div><span class="m_-2490010092224910121m_-1702053650207426654m_4490334518909941979HOEnZb"><font color="#888888"><span class="m_-2490010092224910121m_-1702053650207426654m_4490334518909941979m_-9210323156708928583HOEnZb"><font color="#888888">-- <br>
2.14.3<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" rel="noreferrer noreferrer noreferrer" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</font></span></font></span></blockquote></div><br></div>
</blockquote></div><br></div></div>
</blockquote></div></div></div>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" rel="noreferrer noreferrer" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div></div></div>
</blockquote></div></div></div>