def __init__(self, device, tool, build_type, push_deps=True,
              cleanup_test_files=False):
   """
     Args:
       device: Tests will run on the device of this ID.
       tool: Name of the Valgrind tool.
       build_type: 'Release' or 'Debug'.
       push_deps: If True, push all dependencies to the device.
       cleanup_test_files: Whether or not to cleanup test files on device.
   """
   self.device = device
   self.adb = android_commands.AndroidCommands(device=device)
   self.tool = CreateTool(tool, self.adb)
   self._http_server = None
   self._forwarder_device_port = 8000
   self.forwarder_base_url = ('http://localhost:%d' %
       self._forwarder_device_port)
   self.flags = FlagChanger(self.adb)
   self.flags.AddFlags(['--disable-fre'])
   self._spawning_server = None
   # We will allocate port for test server spawner when calling method
   # LaunchChromeTestServerSpawner and allocate port for test server when
   # starting it in TestServerThread.
   self.test_server_spawner_port = 0
   self.test_server_port = 0
   self.build_type = build_type
   self._push_deps = push_deps
   self._cleanup_test_files = cleanup_test_files
Пример #2
0
 def __init__(self, device, tool, build_type):
     """
   Args:
     device: Tests will run on the device of this ID.
     shard_index: Index number of the shard on which the test suite will run.
     build_type: 'Release' or 'Debug'.
 """
     self.device = device
     self.adb = android_commands.AndroidCommands(device=device)
     self.tool = CreateTool(tool, self.adb)
     self._http_server = None
     self._forwarder = None
     self._forwarder_device_port = 8000
     self.forwarder_base_url = ('http://localhost:%d' %
                                self._forwarder_device_port)
     self.flags = FlagChanger(self.adb)
     self.flags.AddFlags(['--disable-fre'])
     self._spawning_server = None
     self._spawner_forwarder = None
     # We will allocate port for test server spawner when calling method
     # LaunchChromeTestServerSpawner and allocate port for test server when
     # starting it in TestServerThread.
     self.test_server_spawner_port = 0
     self.test_server_port = 0
     self.build_type = build_type
Пример #3
0
 def __init__(self,
              device_serial,
              tool,
              push_deps=True,
              cleanup_test_files=False):
     """
   Args:
     device: Tests will run on the device of this ID.
     tool: Name of the Valgrind tool.
     push_deps: If True, push all dependencies to the device.
     cleanup_test_files: Whether or not to cleanup test files on device.
 """
     self.device_serial = device_serial
     self.device = device_utils.DeviceUtils(device_serial)
     self.tool = CreateTool(tool, self.device)
     self._http_server = None
     self._forwarder_device_port = 8000
     self.forwarder_base_url = ('http://localhost:%d' %
                                self._forwarder_device_port)
     self._spawning_server = None
     # We will allocate port for test server spawner when calling method
     # LaunchChromeTestServerSpawner and allocate port for test server when
     # starting it in TestServerThread.
     self.test_server_spawner_port = 0
     self.test_server_port = 0
     self._push_deps = push_deps
     self._cleanup_test_files = cleanup_test_files
def main(argv):
    parser = optparse.OptionParser(usage='Usage: %prog [options] device_port '
                                   'host_port [device_port_2 host_port_2] ...',
                                   description=__doc__)
    parser.add_option('-v',
                      '--verbose',
                      dest='verbose_count',
                      default=0,
                      action='count',
                      help='Verbose level (multiple times for more)')
    parser.add_option('--device',
                      help='Serial number of device we should use.')
    parser.add_option('--host',
                      help='Host address to forward to from the host machine. '
                      '127.0.0.1 by default',
                      default='127.0.0.1')
    parser.add_option('--debug',
                      action='store_const',
                      const='Debug',
                      dest='build_type',
                      default='Release',
                      help='Use Debug build of host tools instead of Release.')

    options, args = parser.parse_args(argv)
    run_tests_helper.SetLogLevel(options.verbose_count)

    if len(args) < 2 or not len(args) % 2:
        parser.error('Need even number of port pairs')
        sys.exit(1)

    try:
        port_pairs = map(int, args[1:])
        port_pairs = zip(port_pairs[::2], port_pairs[1::2])
    except ValueError:
        parser.error('Bad port number')
        sys.exit(1)

    adb = android_commands.AndroidCommands(options.device)
    tool = CreateTool(None, adb)
    forwarder_instance = forwarder.Forwarder(adb, options.build_type)
    try:
        forwarder_instance.Run(port_pairs, tool, options.host)
        while True:
            time.sleep(60)
    except KeyboardInterrupt:
        sys.exit(0)
    finally:
        forwarder_instance.Close()
 def __init__(self, device_serial, tool):
     """
   Args:
     device: Tests will run on the device of this ID.
     tool: Name of the Valgrind tool.
 """
     self.device_serial = device_serial
     self.device = device_utils.DeviceUtils(device_serial)
     self.tool = CreateTool(tool, self.device)
     self._http_server = None
     self._forwarder_device_port = 8000
     self.forwarder_base_url = ('http://localhost:%d' %
                                self._forwarder_device_port)
     # We will allocate port for test server spawner when calling method
     # LaunchChromeTestServerSpawner and allocate port for test server when
     # starting it in TestServerThread.
     self.test_server_spawner_port = 0
     self.test_server_port = 0
Пример #6
0
 def __init__(self, device, tool):
   """
     Args:
       device: An instance of DeviceUtils that the tests will run on.
       tool: Name of the Valgrind tool.
   """
   assert isinstance(device, device_utils.DeviceUtils)
   self.device = device
   self.device_serial = self.device.adb.GetDeviceSerial()
   self.tool = CreateTool(tool, self.device)
   self._http_server = None
   self._forwarder_device_port = 8000
   self.forwarder_base_url = ('http://localhost:%d' %
       self._forwarder_device_port)
   # We will allocate port for test server spawner when calling method
   # LaunchChromeTestServerSpawner and allocate port for test server when
   # starting it in TestServerThread.
   self.test_server_spawner_port = 0
   self.test_server_port = 0