def expect_helper(self, pattern, wrapper, *args, **kwargs): if not BFT_DEBUG: return wrapper(pattern, *args, **kwargs) if 'base.py: expect():' in error_detect.caller_file_line(3) or \ 'base.py: expect_exact():' in error_detect.caller_file_line(3): idx = 5 else: idx = 3 common.print_bold("%s = expecting: %s" % (error_detect.caller_file_line(idx), repr(pattern))) try: ret = wrapper(pattern, *args, **kwargs) frame = error_detect.caller_file_line(idx) if hasattr(self.match, "group"): common.print_bold("%s = matched: %s" % (frame, repr(self.match.group()))) else: common.print_bold("%s = matched: %s" % (frame, repr(pattern))) return ret except: common.print_bold("expired") raise
def send(self, s): if not self.in_detect_fatal_error and self.linux_booted: self.in_detect_fatal_error = True error_detect.detect_fatal_error(self) self.in_detect_fatal_error = False if BFT_DEBUG: common.print_bold("%s = sending: %s" % (error_detect.caller_file_line(3), repr(s))) return super(OpenWrtRouter, self).send(s)
def send(self, s): if BFT_DEBUG: if 'pexpect/__init__.py: sendline():' in error_detect.caller_file_line( 3): idx = 4 else: idx = 3 common.print_bold("%s = sending: %s" % (error_detect.caller_file_line(idx), repr(s))) if self.delaybetweenchar is not None: ret = 0 for char in s: ret += super(BaseDevice, self).send(char) time.sleep(self.delaybetweenchar) return ret return super(BaseDevice, self).send(s)
def expect_helper(self, pattern, wrapper, *args, **kwargs): if not BFT_DEBUG: return wrapper(pattern, *args, **kwargs) common.print_bold("%s = expecting: %s" % (error_detect.caller_file_line(2), repr(pattern))) try: ret = wrapper(pattern, *args, **kwargs) if hasattr(self.match, "group"): common.print_bold("%s = matched: %s" % (error_detect.caller_file_line(2), repr(self.match.group()))) else: common.print_bold("%s = matched: %s" % (error_detect.caller_file_line(2), repr(pattern))) return ret except: common.print_bold("expired") raise
def expect_helper(self, pattern, wrapper, *args, **kwargs): if not BFT_DEBUG: return wrapper(pattern, *args, **kwargs) common.print_bold("%s = expecting: %s" % (error_detect.caller_file_line(2), repr(pattern))) try: ret = wrapper(pattern, *args, **kwargs) if hasattr(self.match, "group"): common.print_bold("%s = matched: %s" % (error_detect.caller_file_line(1), repr(self.match.group()))) else: common.print_bold("%s = matched: %s" % (error_detect.caller_file_line(1), repr(pattern))) return ret except: common.print_bold("expired") raise
def send(self, s): if BFT_DEBUG: common.print_bold("%s = sending: %s" % (error_detect.caller_file_line(3), repr(s))) if self.delaybetweenchar is not None: ret = 0 for char in s: ret += super(BaseDevice, self).send(char) time.sleep(self.delaybetweenchar) return ret return super(BaseDevice, self).send(s)
def expect(self, *args, **kwargs): if BFT_DEBUG: common.print_bold("%s = expecting: %s" % (error_detect.caller_file_line(2), repr(args[0]))) try: return super(OpenWrtRouter, self).expect(*args, **kwargs) except: if not self.in_detect_fatal_error and self.linux_booted: self.in_detect_fatal_error = True error_detect.detect_fatal_error(self) self.in_detect_fatal_error = False if BFT_DEBUG: common.print_bold("expired") raise else: if BFT_DEBUG: common.print_bold("found")
def sendcontrol(self, char): if BFT_DEBUG: common.print_bold("%s = sending: control-%s" % (error_detect.caller_file_line(3), repr(char))) return super(BaseDevice, self).sendcontrol(char)
def send(self, s): if BFT_DEBUG: common.print_bold("%s = sending: %s" % (error_detect.caller_file_line(3), repr(s))) return super(OpenWrtRouter, self).send(s)