def startCoverage(self, routines=['*']): if self.type == 'cache': self.write('D ^%SYS.MONLBL') rval = self.multiwait(['Stop Monitor', 'Start Monitor']) if rval == 0: self.write('1') self.wait('Start Monitor') self.write('1') elif rval == 1: self.write('1') else: raise TestHelper.TestError('ERROR starting monitor, rbuf: ' + rval) for routine in routines: self.wait('Routine Name') self.write(routine) self.wait('Routine Name', tout=120) self.write('') self.wait('choice') self.write('2') self.wait('choice') self.write('1') self.wait('continue') self.write('\r') else: self.write('K ^ZZCOVERAGE VIEW "TRACE":1:"^ZZCOVERAGE"')
def wait(self, command, tout=15): if command is PROMPT: command = self.namespace + '>' rbuf = self.connection.expect_exact(command, tout) if rbuf == -1: logging.debug('ERROR: expected: ' + command) raise TestHelper.TestError('ERROR: expected: ' + command) else: return 1
def multiwait(self, options, tout=15): if isinstance(options, list): index = self.connection.expect(options, tout) if index == -1: logging.debug('ERROR: expected: ' + options) raise TestHelper.TestError('ERROR: expected: ' + options) self.connection.logfile_read.write(options[index]) return index else: raise IndexError('Input to multiwait function is not a list')
def wait(self, command, tout=15): if command is PROMPT: command = self.prompt rbuf = self.connection.expect(command, tout) logging.debug('RECEIVED: ' + command) if rbuf == -1: logging.debug('ERROR: expected: ' + command) raise TestHelper.TestError('ERROR: expected: ' + command) else: return 1
def multiwait(self, options, tout=15): logging.debug('connection.expect: ' + str(options)) if isinstance(options, list): index = self.connection.expect(options, tout) if index == -1: logging.debug('ERROR: expected: ' + str(options)) raise TestHelper.TestError('ERROR: expected: ' + str(options)) self.log.write(index[2]) self.lastconnection=index[2] return index[0] else: raise IndexError('Input to multiwait function is not a list')
def wait(self, command, tout=15): logging.debug('connection.expect: ' + str(command)) if command is PROMPT: command = self.prompt rbuf = self.connection.expect_exact(encode(self.connection, command), tout) if rbuf == -1: logging.debug('ERROR: expected: ' + command) raise TestHelper.TestError('ERROR: expected: ' + command) else: self.lastconnection = decode(self.connection.before) return 1
def wait(self, command, tout=15): if command is PROMPT: command = self.namespace + '>' rbuf = self.connection.read_until(command, tout) if rbuf.find(command) == -1: self.log.write('ERROR: expected: ' + command + 'actual: ' + rbuf) logging.debug('ERROR: expected: ' + command + 'actual: ' + rbuf) raise TestHelper.TestError('ERROR: expected: ' + command + 'actual: ' + rbuf) else: self.log.write(rbuf) logging.debug(rbuf) return 1
def multiwait(self, options, tout=15): logging.debug('connection.expect: ' + str(options)) if isinstance(options, list): encOptions = [] for option in options: encOptions.append(encode(self.connection, option)) index = self.connection.expect(encOptions, tout) if index == -1: logging.debug('ERROR: expected: ' + str(options)) raise TestHelper.TestError('ERROR: expected: ' + str(options)) self.connection.logfile_read.write(options[index]) self.lastconnection = decode(self.connection.before) return index else: raise IndexError('Input to multiwait function is not a list')
def multiwait(self, options, tout=15): logging.debug('connection.expect: ' + str(options)) temp_options = [] for command in options: temp_options.append(self.escapeSpecialChars(command)) options = temp_options time.sleep(.01) if isinstance(options, list): index = self.connection.expect(options, timeout=tout) if index == -1: logging.debug('ERROR: expected: ' + str(options)) raise TestHelper.TestError('ERROR: expected: ' + str(options)) return index else: raise IndexError('Input to multiwait function is not a list')
def wait(self, command, tout=15): time.sleep(.01) logging.debug('connection.expect: ' + str(command)) if command is PROMPT: command = self.namespace + '>' else: command = self.escapeSpecialChars(command) if command == '': command = '.*' #fix for paramiko expect, it does not work with wait('') rbuf = self.connection.expect(command, tout) if rbuf == -1: logging.debug('ERROR: expected: ' + command) print 'ERROR: expected: ' + command raise TestHelper.TestError('ERROR: expected: ' + command) else: return 1
def wait(self, command, tout=15): logging.debug('connection.expect: ' + str(command)) if command is PROMPT: command = self.prompt rbuf = decode( self.connection.read_until(encode(self.connection, command))) if rbuf.find(command) == -1: command = str(command) rbuf = str(rbuf) self.log.write('ERROR: expected: ' + command + 'actual: ' + rbuf) logging.debug('ERROR: expected: ' + command + 'actual: ' + rbuf) raise TestHelper.TestError('ERROR: expected: ' + command + 'actual: ' + rbuf) else: self.log.write(decode(rbuf)) logging.debug(rbuf) self.lastconnection = decode(rbuf) return 1
def startCoverage(self, routines=['*']): self.write('D ^%SYS.MONLBL') rval = self.multiwait(['Stop Monitor', 'Start Monitor']) if rval == 0: self.write('1') self.wait('Start Monitor') self.write('1') elif rval == 1: self.write('1') else: raise TestHelper.TestError('ERROR starting monitor, rbuf: ' + rval) for routine in routines: self.wait('Routine Name') self.write(routine) self.wait('Routine Name', tout=60) self.write('') self.wait('choice') self.write('2') self.wait('choice') self.write('1') self.wait('continue') self.write('\r')