예제 #1
0
def FetchTelemetryDependencies(
  platform=None, client_configs=None, chrome_reference_browser=False):
  if not platform:
    platform = platform_module.GetHostPlatform()
  if binary_manager.NeedsInit():
    binary_manager.InitDependencyManager(client_configs)
  else:
    raise Exception('Binary manager already initialized with other configs.')
  binary_manager.FetchBinaryDependencies(
    platform, client_configs, chrome_reference_browser)
예제 #2
0
    def Run(self, args):
        runner = typ.Runner()
        if self.stream:
            runner.host.stdout = self.stream

        if args.no_browser:
            possible_browser = None
            platform = platform_module.GetHostPlatform()
        else:
            possible_browser = browser_finder.FindBrowser(args)
            platform = possible_browser.platform

        fetch_reference_chrome_binary = False
        # Fetch all binaries needed by telemetry before we run the benchmark.
        if possible_browser and possible_browser.browser_type == 'reference':
            fetch_reference_chrome_binary = True
        binary_manager.FetchBinaryDependencies(platform, args.client_configs,
                                               fetch_reference_chrome_binary)

        # Telemetry seems to overload the system if we run one test per core,
        # so we scale things back a fair amount. Many of the telemetry tests
        # are long-running, so there's a limit to how much parallelism we
        # can effectively use for now anyway.
        #
        # It should be possible to handle multiple devices if we adjust the
        # browser_finder code properly, but for now we only handle one on ChromeOS.
        if platform.GetOSName() == 'chromeos':
            runner.args.jobs = 1
        elif platform.GetOSName() == 'android':
            android_devs = android_device.FindAllAvailableDevices(args)
            runner.args.jobs = len(android_devs)
            if runner.args.jobs == 0:
                raise RuntimeError("No Android device found")
            print 'Running tests with %d Android device(s).' % runner.args.jobs
        elif platform.GetOSVersionName() == 'xp':
            # For an undiagnosed reason, XP falls over with more parallelism.
            # See crbug.com/388256
            runner.args.jobs = max(int(args.jobs) // 4, 1)
        else:
            runner.args.jobs = max(int(args.jobs) // 2, 1)

        runner.args.skip = args.skip
        runner.args.metadata = args.metadata
        runner.args.passthrough = args.passthrough
        runner.args.path = args.path
        runner.args.retry_limit = args.retry_limit
        runner.args.test_results_server = args.test_results_server
        runner.args.test_type = args.test_type
        runner.args.top_level_dirs = args.top_level_dirs
        runner.args.write_full_results_to = args.write_full_results_to
        runner.args.write_trace_to = args.write_trace_to
        runner.args.list_only = args.list_only
        runner.args.shard_index = args.shard_index
        runner.args.total_shards = args.total_shards

        runner.args.path.append(util.GetUnittestDataDir())

        # Always print out these info for the ease of debugging.
        runner.args.timing = True
        runner.args.verbose = 3

        runner.classifier = GetClassifier(args, possible_browser)
        runner.context = args
        runner.setup_fn = _SetUpProcess
        runner.teardown_fn = _TearDownProcess
        runner.win_multiprocessing = typ.WinMultiprocessing.importable
        try:
            ret, _, _ = runner.run()
        except KeyboardInterrupt:
            print >> sys.stderr, "interrupted, exiting"
            ret = 130
        return ret