Changeset 662e1f7 in rtems-tools


Ignore:
Timestamp:
Oct 10, 2017, 2:30:31 AM (20 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
5df7c3c
Parents:
9580804
Message:

tester: Add a tester off to turn the target off when finished.

Turning the target off stops it sitting asking for a download if you have
more than one target in a test set up. Any target can jump in and
nick the download.

Location:
tester/rt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tester/rt/config.py

    r9580804 r662e1f7  
    6060                   '%console']
    6161
    62     def __init__(self, index, report, name, opts, _directives = _directives):
     62    def __init__(self, index, total, report, name, opts, _directives = _directives):
    6363        super(file, self).__init__(name, opts, directives = _directives)
    6464        self.lock = threading.Lock()
     
    6868        self.output = None
    6969        self.index = index
     70        self.total = total
    7071        self.report = report
    7172        self.name = name
     
    115116        return regex
    116117
    117     def _target_reset(self):
    118         if self.defined('target_reset_command'):
    119             reset_cmd = self.expand('%{target_reset_command}').strip()
    120             if len(reset_cmd) > 0:
     118    def _target_command(self, command):
     119        if self.defined('target_%s_command' % (command)):
     120            cmd = self.expand('%%{target_%s_command}' % (command)).strip()
     121            if len(cmd) > 0:
    121122                rs_proc = execute.capture_execution()
    122                 ec, proc, output = rs_proc.open(reset_cmd, shell = True)
    123                 self._capture_console('target reset: %s: %s' % (reset_cmd, output))
     123                ec, proc, output = rs_proc.open(cmd, shell = True)
     124                self._capture_console('target %s: %s: %s' % (command, cmd, output))
    124125
    125126    def _output_length(self):
     
    244245                    self.report.start(index, total, exe, exe, bsp_arch, bsp)
    245246                    if self.index == 1:
    246                         self._target_reset()
     247                        self._target_command('reset')
    247248                finally:
    248249                    self._unlock()
     
    256257                    raise error.general(self._name_line_msg('invalid directive'))
    257258                self._lock()
     259                if self.index == self.total:
     260                    self._target_command('off')
    258261                try:
    259262                    status = self.report.end(exe, self.output)
     263                    self._capture_console('test result: %s' % (status))
    260264                    if status == 'timeout':
    261                         self._target_reset()
     265                        if self.index == self.total:
     266                            self._target_command('off')
     267                        else:
     268                            self._target_command('reset')
    262269                    self.process = None
    263270                    self.output = None
     
    310317            self.output += text
    311318        if reset_target:
    312             self._target_reset()
     319            if self.index == self.total:
     320                self._target_command('off')
     321            else:
     322                self._target_command('reset')
    313323        self._unlock()
    314324        if ok_to_kill:
  • tester/rt/test.py

    r9580804 r662e1f7  
    7373                raise error.general('cannot find RTEMS tools path: %s' % (rtems_tools_bin))
    7474            self.opts.defaults['rtems_tools'] = rtems_tools_bin
    75         self.config = config.file(index, self.report, self.bsp_config, self.opts)
     75        self.config = config.file(index, total, self.report, self.bsp_config, self.opts)
    7676
    7777    def run(self):
Note: See TracChangeset for help on using the changeset viewer.