Changeset 9580804 in rtems-tools


Ignore:
Timestamp:
Oct 7, 2017, 7:57:24 AM (22 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
662e1f7
Parents:
68cbfc3
Message:

Add a target start and target reset to manage boards that do not boot cleanly.

Rename the reset regex as start regex to detect a board has started.
Add a reset regex to detect if a board has failed to boot cleanly and
needs to be reset.

The Microzed I have can fail to boot. The PHY does not initalise.
I do not know if it is the board, the design or u-boot.

Location:
tester
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tester/rt/config.py

    r68cbfc3 r9580804  
    7676        self.test_label = None
    7777        self.target_reset_regx = None
     78        self.target_start_regx = None
    7879
    7980    def __del__(self):
     
    102103        except:
    103104            pass
     105
     106    def _target_regex(self, label):
     107        regex = None
     108        if self.defined(label):
     109            r = self.expand('%%{%s}' % (label))
     110            try:
     111                regex = re.compile(r, re.MULTILINE)
     112            except:
     113                msg = 'invalid target regex: %s: %s' % (label, r)
     114                raise error.general(msg)
     115        return regex
    104116
    105117    def _target_reset(self):
     
    260272
    261273    def run(self):
    262         if self.defined('target_reset_regex'):
    263             try:
    264                 regex = self.expand('%{target_reset_regex}')
    265                 self.target_reset_regx = re.compile(regex, re.MULTILINE)
    266             except:
    267                 msg = 'invalid target reset regex: %s' % (regex)
    268                 raise error.general(msg)
     274        self.target_start_regx = self._target_regex('target_start_regex')
     275        self.target_reset_regx = self._target_regex('target_reset_regex')
    269276        self.load(self.name)
    270277
    271278    def capture(self, text):
    272279        if not self.test_started:
    273             self.test_started = '*** BEGIN OF TEST ' in text
     280            s = text.find('*** BEGIN OF TEST ')
     281            if s >= 0:
     282                self.test_started = True
     283                e = text[s + 3:].find('***')
     284                if e >= 0:
     285                    self.test_label = text[s + len('*** BEGIN OF TEST '):s + e + 3 - 1]
     286                self.capture_console('test start: %s' % (self.test_label))
    274287        ok_to_kill = '*** TEST STATE: USER_INPUT' in text or \
    275288                     '*** TEST STATE: BENCHMARK' in text
     
    278291        else:
    279292            reset_target = False
    280         if self.test_started and self.target_reset_regx is not None:
     293        if self.test_started and self.target_start_regx is not None:
     294            if self.target_start_regx.match(text):
     295                self.capture_console('target start detected')
     296                ok_to_kill = True
     297        if not reset_target and self.target_reset_regx is not None:
    281298            if self.target_reset_regx.match(text):
    282                 self.capture_console('target reset detected')
    283                 ok_to_kill = True
     299                self.capture_console('target reset condition detected')
     300                reset_target = True
    284301        if self.kill_on_end:
    285             if self.test_label is None:
    286                 s = text.find('*** BEGIN OF TEST ')
    287                 if s >= 0:
    288                     e = text[s + 3:].find('***')
    289                     if e >= 0:
    290                         self.test_label = text[s + len('*** BEGIN OF TEST '):s + e + 3 - 1]
    291             if not ok_to_kill and self.test_label is not None:
    292                 ok_to_kill = '*** END OF TEST %s ***' % (self.test_label) in text
     302            if not ok_to_kill and '*** END OF TEST ' in text:
     303                self.capture_console('test end: %s' % (self.test_label))
     304                if self.test_label is not None:
     305                    ok_to_kill = '*** END OF TEST %s ***' % (self.test_label) in text
    293306        text = [(']', l) for l in text.replace(chr(13), '').splitlines()]
    294307        self._lock()
  • tester/rtems/testing/bsps/xilinx_zynq_zedboard.mc

    r68cbfc3 r9580804  
    5555test_restarts:             none,    none,   '3'
    5656target_reset_command:      none,    none,   'wemo-reset CSEng1 3'
    57 target_reset_regex:        none,    none,   '^U-Boot SPL .*'
     57target_reset_regex:        none,    none,   '^No ethernet found.*|BOOTP broadcast 9.*'
     58target_start_regex:        none,    none,   '^U-Boot SPL .*'
    5859bsp_tty_dev:               none,    none,   'tuke:30005'
Note: See TracChangeset for help on using the changeset viewer.