Ejemplo n.º 1
0
 def exec_tests(self, index=-1):
     self._setup_remote()
     if index == -1:
         for id, params in self.testobj.iteritems():
             env = self.setupobj['remote']['env']
             for handler in params['handler']:
                 self.logger.info(
                     format_h1("Executing Test ID:%s Handler:%s()" %
                               (str(id), str(handler))))
                 output, status = getattr(self.test_handlers, handler)(
                     self.host, self.remote, id,
                     dict(params.items() + env.items()))
     elif index >= 0:
         count = -1
         for id, params in self.testobj.iteritems():
             count = count + 1
             if count == index:
                 env = self.setupobj['remote']['env']
                 for handler in params['handler']:
                     self.logger.info(
                         format_h1("Executing Test ID:%s Handler:%s()" %
                                   (str(id), str(handler))))
                     output, status = getattr(self.test_handlers, handler)(
                         self.host, self.remote, id,
                         dict(params.items() + env.items()))
     self._reset_remote()
Ejemplo n.º 2
0
 def _print_test_details(self, test):
     self.logger.debug(format_h1(" Test Details "))
     self.logger.debug("Name: %s" % test['name'])
     self.logger.debug("Type: %s" % test['type'])
     self.logger.debug("Handler: %s" % test['handler'])
     self.logger.debug("Local Cmd Timeout: %s" % test['local_cmd_timeout'])
     self.logger.debug("Local Cmd: %s" % test['local_cmd'])
     self.logger.debug("Remote Cmd Timeout: %s" %
                       test['remote_cmd_timeout'])
     self.logger.debug("Remote Cmd: %s" % test['remote_cmd'])
     self.logger.debug("Remote Cmd Expected Results: %s" %
                       test['remote_expected_result'])
     self.logger.debug(format_h1())
Ejemplo n.º 3
0
 def print_result(self, id, params, output, status):
     self.logger.info(format_h1("%s test results" % str(id)))
     self.logger.info("Test ID: %s" % id)
     self.logger.info("Test type: %s" % params['type'])
     self.logger.info("Test name: %s" % params['name'])
     self.logger.info("Test status: %s" %
                      ("passed" if status else "failed"))
     self.logger.debug("Expected result: %s" %
                       params['cmd_expected_result'])
     self.logger.debug("Actual result: %s" % output)
     self.logger.info(''.join(['=' for i in range(1, 100)]))
Ejemplo n.º 4
0
 def _create_terminal(self, terminal):
     self.logger.debug(format_h1("Create %s terminal" % terminal['type']))
     if terminal['type'] == 'serial':
         return SerialTerminal(port=terminal['name'],
                               baud=terminal['baudrate'],
                               parity=terminal['parity'],
                               stopbits=terminal['stopbit'],
                               bytesize=terminal['bytesize'],
                               hfc=terminal['hfc'],
                               sfc=terminal['sfc'],
                               timeout=terminal['timeout'])
     elif terminal['type'] == 'usb-adb':
         return AdbTerminal()
     else:
         return ShellTerminal()
Ejemplo n.º 5
0
 def _reset_remote(self):
     self.logger.debug(format_h1("Reset remote"))
     self.remote.send_command(self.remote_params['reset_cmd'])
     self.remote.send_command(self.remote_params['exit_cmd'])
Ejemplo n.º 6
0
 def _setup_remote(self):
     self.logger.debug(format_h1("Setup remote"))
     self.remote.send_command(self.remote_params['login_cmd'])
     self.remote.send_command(self.remote_params['setup_cmd'])
Ejemplo n.º 7
0
 def __str__(self):
     return format_h1("Device Info") + "\nName: %s\n" % self.name + "Default Terminal: %s\n" % self.default_terminal +\
            "Current Terminal: %s\n" % self.current_terminal + "Terminal List: %s\n" % str(self.terminal_list.keys()) +\
            format_h1()