Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: build/android/pylib/perf/setup.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Generates test runner factory and tests for performance tests."""
6
7 import json
8 import fnmatch
9 import logging
10 import os
11 import shutil
12
13 from pylib import constants
14 from pylib import forwarder
15 from pylib.device import device_list
16 from pylib.device import device_utils
17 from pylib.perf import test_runner
18 from pylib.utils import test_environment
19
20
21 def _GetAllDevices():
22 devices_path = os.path.join(os.environ.get('CHROMIUM_OUT_DIR', 'out'),
23 device_list.LAST_DEVICES_FILENAME)
24 try:
25 devices = [device_utils.DeviceUtils(s)
26 for s in device_list.GetPersistentDeviceList(devices_path)]
27 except IOError as e:
28 logging.error('Unable to find %s [%s]', devices_path, e)
29 devices = device_utils.DeviceUtils.HealthyDevices()
30 return sorted(devices)
31
32
33 def _GetStepsDictFromSingleStep(test_options):
34 # Running a single command, build the tests structure.
35 steps_dict = {
36 'version': 1,
37 'steps': {
38 'single_step': {
39 'device_affinity': 0,
40 'cmd': test_options.single_step
41 },
42 }
43 }
44 return steps_dict
45
46
47 def _GetStepsDict(test_options):
48 if test_options.single_step:
49 return _GetStepsDictFromSingleStep(test_options)
50 if test_options.steps:
51 with file(test_options.steps, 'r') as f:
52 steps = json.load(f)
53
54 # Already using the new format.
55 assert steps['version'] == 1
56 return steps
57
58
59 def Setup(test_options):
60 """Create and return the test runner factory and tests.
61
62 Args:
63 test_options: A PerformanceOptions object.
64
65 Returns:
66 A tuple of (TestRunnerFactory, tests, devices).
67 """
68 # TODO(bulach): remove this once the bot side lands. BUG=318369
69 constants.SetBuildType('Release')
70 if os.path.exists(constants.PERF_OUTPUT_DIR):
71 shutil.rmtree(constants.PERF_OUTPUT_DIR)
72 os.makedirs(constants.PERF_OUTPUT_DIR)
73
74 # Before running the tests, kill any leftover server.
75 test_environment.CleanupLeftoverProcesses()
76
77 # We want to keep device affinity, so return all devices ever seen.
78 all_devices = _GetAllDevices()
79
80 steps_dict = _GetStepsDict(test_options)
81 sorted_step_names = sorted(steps_dict['steps'].keys())
82
83 if test_options.test_filter:
84 sorted_step_names = fnmatch.filter(sorted_step_names,
85 test_options.test_filter)
86
87 flaky_steps = []
88 if test_options.flaky_steps:
89 with file(test_options.flaky_steps, 'r') as f:
90 flaky_steps = json.load(f)
91
92 def TestRunnerFactory(device, shard_index):
93 return test_runner.TestRunner(
94 test_options, device, shard_index, len(all_devices),
95 steps_dict, flaky_steps)
96
97 return (TestRunnerFactory, sorted_step_names, all_devices)
OLDNEW
« no previous file with comments | « build/android/pylib/perf/perf_control_unittest.py ('k') | build/android/pylib/perf/surface_stats_collector.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698