示例#1
0
    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
示例#2
0
 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)
示例#3
0
    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)
示例#4
0
 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)
示例#5
0
    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
示例#6
0
    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
示例#7
0
    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)
示例#8
0
    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)
示例#9
0
 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")
示例#10
0
 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")
示例#11
0
    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)
示例#12
0
    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)
示例#13
0
    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)