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

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

Issue 27502002: Android perf tests: only store the retry results if it's better. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/perf/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generates test runner factory and tests for performance tests.""" 5 """Generates test runner factory and tests for performance tests."""
6 6
7 import json 7 import json
8 import fnmatch 8 import fnmatch
9 import logging 9 import logging
10 import os 10 import os
11 import psutil 11 import psutil
12 import signal 12 import signal
13 import shutil
13 import time 14 import time
14 15
15 from pylib import android_commands 16 from pylib import android_commands
16 from pylib import cmd_helper 17 from pylib import cmd_helper
17 from pylib import constants 18 from pylib import constants
18 from pylib import forwarder 19 from pylib import forwarder
19 from pylib import ports 20 from pylib import ports
20 21
21 import test_runner 22 import test_runner
22 23
(...skipping 28 matching lines...) Expand all
51 52
52 def Setup(test_options): 53 def Setup(test_options):
53 """Create and return the test runner factory and tests. 54 """Create and return the test runner factory and tests.
54 55
55 Args: 56 Args:
56 test_options: A PerformanceOptions object. 57 test_options: A PerformanceOptions object.
57 58
58 Returns: 59 Returns:
59 A tuple of (TestRunnerFactory, tests). 60 A tuple of (TestRunnerFactory, tests).
60 """ 61 """
61 if not os.path.exists(constants.PERF_OUTPUT_DIR): 62 if os.path.exists(constants.PERF_OUTPUT_DIR):
62 os.makedirs(constants.PERF_OUTPUT_DIR) 63 shutil.rmtree(constants.PERF_OUTPUT_DIR)
64 os.makedirs(constants.PERF_OUTPUT_DIR)
63 65
64 # Before running the tests, kill any leftover server. 66 # Before running the tests, kill any leftover server.
65 _KillPendingServers() 67 _KillPendingServers()
66 68
67 with file(test_options.steps, 'r') as f: 69 with file(test_options.steps, 'r') as f:
68 tests = json.load(f) 70 tests = json.load(f)
69 71
70 # The list is necessary to keep the steps order, but internally 72 # The list is necessary to keep the steps order, but internally
71 # the format is squashed from a list of lists into a single dict: 73 # the format is squashed from a list of lists into a single dict:
72 # [["A", "cmd"], ["B", "cmd"]] into {"A": "cmd", "B": "cmd"} 74 # [["A", "cmd"], ["B", "cmd"]] into {"A": "cmd", "B": "cmd"}
73 sorted_test_names = [i[0] for i in tests] 75 sorted_test_names = [i[0] for i in tests]
74 tests_dict = dict(tests) 76 tests_dict = dict(tests)
75 77
76 if test_options.test_filter: 78 if test_options.test_filter:
77 sorted_test_names = fnmatch.filter(sorted_test_names, 79 sorted_test_names = fnmatch.filter(sorted_test_names,
78 test_options.test_filter) 80 test_options.test_filter)
79 tests_dict = dict((k, v) for k, v in tests_dict.iteritems() 81 tests_dict = dict((k, v) for k, v in tests_dict.iteritems()
80 if k in sorted_test_names) 82 if k in sorted_test_names)
81 83
82 flaky_steps = [] 84 flaky_steps = []
83 if test_options.flaky_steps: 85 if test_options.flaky_steps:
84 with file(test_options.flaky_steps, 'r') as f: 86 with file(test_options.flaky_steps, 'r') as f:
85 flaky_steps = json.load(f) 87 flaky_steps = json.load(f)
86 88
87 def TestRunnerFactory(device, shard_index): 89 def TestRunnerFactory(device, shard_index):
88 return test_runner.TestRunner( 90 return test_runner.TestRunner(
89 test_options, device, tests_dict, flaky_steps) 91 test_options, device, tests_dict, flaky_steps)
90 92
91 return (TestRunnerFactory, sorted_test_names) 93 return (TestRunnerFactory, sorted_test_names)
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/perf/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698