def __init__(self, test_options, device, test_package):
        """Single test suite attached to a single device.

    Args:
      test_options: A GTestOptions object.
      device: Device to run the tests.
      test_package: An instance of TestPackage class.
    """

        super(TestRunner, self).__init__(device, test_options.tool)

        self.test_package = test_package
        self.test_package.tool = self.tool
        self._test_arguments = test_options.test_arguments

        timeout = test_options.timeout
        if timeout == 0:
            timeout = 60
        # On a VM (e.g. chromium buildbots), this timeout is way too small.
        if os.environ.get('BUILDBOT_SLAVENAME'):
            timeout = timeout * 2

        self._timeout = timeout * self.tool.GetTimeoutScale()
        if _TestSuiteRequiresHighPerfMode(self.test_package.suite_name):
            self._perf_controller = perf_control.PerfControl(self.device)

        if _TestSuiteRequiresMockTestServer(self.test_package.suite_name):
            self._servers = [
                local_test_server_spawner.LocalTestServerSpawner(
                    ports.AllocateTestServerPort(), self.device, self.tool)
            ]
        else:
            self._servers = []
Пример #2
0
            def init_tool_and_start_servers(dev):
                tool = self.GetTool(dev)
                tool.CopyFiles(dev)
                tool.SetupEnvironment()

                try:
                    # See https://crbug.com/1030827.
                    # This is a hack that may break in the future. We're relying on the
                    # fact that adb doesn't use ipv6 for it's server, and so doesn't
                    # listen on ipv6, but ssh remote forwarding does. 5037 is the port
                    # number adb uses for its server.
                    if "[::1]:5037" in subprocess.check_output(
                            "ss -o state listening 'sport = 5037'",
                            shell=True):
                        logging.error(
                            'Test Server cannot be started with a remote-forwarded adb '
                            'server. Continuing anyways, but some tests may fail.'
                        )
                        return
                except subprocess.CalledProcessError:
                    pass

                self._servers[str(dev)] = []
                if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER:
                    self._servers[str(dev)].append(
                        local_test_server_spawner.LocalTestServerSpawner(
                            ports.AllocateTestServerPort(), dev, tool))

                for s in self._servers[str(dev)]:
                    s.SetUp()
Пример #3
0
            def init_tool_and_start_servers():
                tool = self.GetTool(dev)
                tool.CopyFiles(dev)
                tool.SetupEnvironment()

                self._servers[str(dev)] = []
                if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER:
                    self._servers[str(dev)].append(
                        local_test_server_spawner.LocalTestServerSpawner(
                            ports.AllocateTestServerPort(), dev, tool))

                for s in self._servers[str(dev)]:
                    s.SetUp()
Пример #4
0
        def individual_device_set_up(dev, host_device_tuples):
            # Install test APK.
            self._delegate.Install(dev)

            # Push data dependencies.
            external_storage = dev.GetExternalStoragePath()
            host_device_tuples = [(h, d if d is not None else external_storage)
                                  for h, d in host_device_tuples]
            dev.PushChangedFiles(host_device_tuples)

            self._servers[str(dev)] = []
            if self.TestPackage() in _SUITE_REQUIRES_TEST_SERVER_SPAWNER:
                self._servers[str(dev)].append(
                    local_test_server_spawner.LocalTestServerSpawner(
                        ports.AllocateTestServerPort(), dev,
                        self.GetTool(dev)))

            for s in self._servers[str(dev)]:
                s.SetUp()