Пример #1
0
  def __init__(self, tool):
    """Constructs a new instance of Forwarder.

    Note that Forwarder is a singleton therefore this constructor should be
    called only once.

    Args:
      tool: Tool class to use to get wrapper, if necessary, for executing the
            forwarder (see valgrind_tools.py).
    """
    assert not Forwarder._instance
    self._tool = tool
    self._initialized_devices = set()
    self._device_to_host_port_map = dict()
    self._host_to_device_port_map = dict()
    self._host_forwarder_path = os.path.join(
        constants.GetOutDirectory(), 'host_forwarder')
    assert os.path.exists(self._host_forwarder_path), 'Please build forwarder2'
    self._device_forwarder_path_on_host = os.path.join(
        constants.GetOutDirectory(), 'forwarder_dist')
    self._InitHostLocked()
Пример #2
0
    def _PushAndStartFakeDns(self):
        """Starts the fake_dns server that replies all name queries 127.0.0.1.

    Returns:
      subprocess instance connected to the fake_dns process on the device.
    """
        self._adb.PushIfNeeded(
            os.path.join(constants.GetOutDirectory(), 'fake_dns'),
            FakeDns._FAKE_DNS_PATH)
        return subprocess.Popen([
            'adb', '-s',
            self._adb._adb.GetSerialNumber(), 'shell',
            '%s -D' % FakeDns._FAKE_DNS_PATH
        ])
Пример #3
0
 def __init__(self, adb, hz):
   self._adb = adb
   host_path = os.path.join(
       constants.GetOutDirectory(), 'device_stats_monitor')
   self._adb.PushIfNeeded(host_path, DeviceStatsMonitor.DEVICE_PATH)
   self._hz = hz