Changeset e341a65 in rtems-tools


Ignore:
Timestamp:
Jun 18, 2018, 12:13:47 AM (11 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
c1f2c32
Parents:
5195eb7
git-author:
Chris Johns <chrisj@…> (06/18/18 00:13:47)
git-committer:
Chris Johns <chrisj@…> (06/18/18 02:26:16)
Message:

tester: Make the path to covoar absolute to ignore the env PATH.

Using the environment's path to find covoar allow invalid versions
to be used which may vary in subtle ways. Find and use the covoar
that is build with the version of 'rtems-test'.

This patch means you do not need to install the tools before
running improving the development experience.

Closes #3458

Location:
tester/rt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tester/rt/coverage.py

    r5195eb7 re341a65  
    3434import shutil
    3535import os
     36import sys
    3637
    3738try:
     
    246247                 symbol_config_path,
    247248                 symbol_select_path,
    248                  coverage_arg,
     249                 symbol_set,
    249250                 build_dir):
    250251        self.symbol_select_file = symbol_select_path
     
    252253        self.build_dir = build_dir
    253254        self.symbol_sets = {}
    254         self.cov_arg = coverage_arg
     255        self.symbol_set = symbol_set
    255256        self.ssets = []
    256257
     
    259260        try:
    260261            config.read(self.symbol_file)
    261             if self.cov_arg:
    262                 self.ssets = self.cov_arg.split(',')
     262            if self.symbol_set is not None:
     263                self.ssets = self.symbol_set.split(',')
    263264            else:
    264265                self.ssets = config.get('symbol-sets', 'sets').split(',')
     
    292293    Covoar runner
    293294    '''
    294     def __init__(self, base_result_dir, config_dir, executables, explanations_txt):
     295    def __init__(self, base_result_dir, config_dir, executables, explanations_txt, trace):
    295296        self.base_result_dir = base_result_dir
    296297        self.config_dir = config_dir
     
    298299        self.explanations_txt = explanations_txt
    299300        self.project_name = 'RTEMS-5'
     301        self.trace = trace
     302
     303    def _find_covoar(self):
     304        covoar_exe = 'covoar'
     305        tester_dir = path.dirname(path.abspath(sys.argv[0]))
     306        base = path.dirname(tester_dir)
     307        exe = path.join(base, 'bin', covoar_exe)
     308        if path.isfile(exe):
     309            return exe
     310        exe = path.join(base, 'build', 'tester', 'covoar', covoar_exe)
     311        if path.isfile(exe):
     312            return exe
     313        raise error.general('coverage: %s not found'% (covoar_exe))
    300314
    301315    def run(self, set_name, symbol_file):
    302316        covoar_result_dir = path.join(self.base_result_dir, set_name)
    303         if (not path.exists(covoar_result_dir)):
     317        if not path.exists(covoar_result_dir):
    304318            path.mkdir(covoar_result_dir)
    305         if (not path.exists(symbol_file)):
    306             raise error.general('symbol set file: coverage %s not created, skipping %s'% (symbol_file, set_name))
    307         command = 'covoar -S ' + symbol_file + \
     319        if not path.exists(symbol_file):
     320            raise error.general('coverage: no symbol set file: %s'% (symbol_file))
     321        exe = self._find_covoar()
     322        command = exe + ' -S ' + symbol_file + \
    308323                  ' -O ' + covoar_result_dir + \
    309324                  ' -E ' + self.explanations_txt + \
     
    312327        log.notice('Running coverage analysis: %s (%s)' % (set_name, covoar_result_dir))
    313328        start_time = datetime.datetime.now()
    314         executor = execute.execute(verbose = True, output = self.output_handler)
     329        executor = execute.execute(verbose = self.trace, output = self.output_handler)
    315330        exit_code = executor.shell(command, cwd=os.getcwd())
    316331        if exit_code[0] != 0:
     
    326341    Coverage analysis support for rtems-test
    327342    '''
    328     def __init__(self, p_macros, coverage_arg, executables):
     343    def __init__(self, macros_, executables, symbol_set = None, trace = False):
    329344        '''
    330345        Constructor
    331346        '''
    332         self.macros = p_macros
     347        self.trace = trace
     348        self.macros = macros_
    333349        self.build_dir = self.macros['_cwd']
    334350        self.explanations_txt = self.macros.expand(self.macros['cov_explanations'])
     
    347363        self.no_clean = int(self.macros['_no_clean'])
    348364        self.report_format = self.macros['cov_report_format']
    349         self.coverage_arg = coverage_arg
     365        self.symbol_set = symbol_set
    350366        self.target = self.macros['target']
    351367
     
    357373            parser = symbol_parser(self.symbol_config_path,
    358374                                   self.symbol_select_path,
    359                                    self.coverage_arg,
     375                                   self.symbol_set,
    360376                                   build_dir)
    361377            parser.run()
    362378            covoar_runner = covoar(self.test_dir, self.symbol_select_path,
    363                                    self.executables, self.explanations_txt)
     379                                   self.executables, self.explanations_txt,
     380                                   self.trace)
    364381            covoar_runner.run('score', self.symbol_select_path)
    365382            self._generate_reports();
     
    380397    def _cleanup(self):
    381398        if not self.no_clean:
    382             log.output('Coverage cleaning tempfiles')
     399            if self.trace:
     400                log.output('Coverage cleaning tempfiles')
    383401            for exe in self.executables:
    384402                trace_file = exe + '.cov'
  • tester/rt/test.py

    r5195eb7 re341a65  
    229229                    '--report-mode':    'Reporting modes, failures (default),all,none',
    230230                    '--list-bsps':      'List the supported BSPs',
    231                     '--debug-trace':    'Debug trace based on specific flags',
     231                    '--debug-trace':    'Debug trace based on specific flags (console,gdb,output,cov)',
    232232                    '--filter':         'Glob that executables must match to run (default: ' +
    233233                              default_exefilter + ')',
     
    267267                debug_trace = debug_trace[1]
    268268            else:
    269                 raise error.general('no debug flags, can be: console,gdb,output')
     269                raise error.general('no debug flags, can be: console,gdb,output,cov')
    270270        else:
    271271            debug_trace = ''
     
    286286        coverage_enabled = opts.find_arg('--coverage')
    287287        if coverage_enabled:
     288            cov_trace = 'cov' in debug_trace.split(',')
    288289            if len(coverage_enabled) == 2:
    289290                coverage_runner = coverage.coverage_run(opts.defaults,
    290                                                 coverage_enabled[1],
    291                                                 executables)
     291                                                        executables,
     292                                                        symbol_set = coverage_enabled[1],
     293                                                        trace = cov_trace)
    292294            else:
    293                 coverage_runner = coverage.coverage_run(opts.defaults, 0,
    294                                                         executables)
     295                coverage_runner = coverage.coverage_run(opts.defaults,
     296                                                        executables,
     297                                                        trace = cov_trace)
    295298        report_mode = opts.find_arg('--report-mode')
    296299        if report_mode:
Note: See TracChangeset for help on using the changeset viewer.