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

Side by Side Diff: appengine/findit/util_scripts/crash_queries/delta_test/run-delta-test.py

Issue 2605943002: Removing the mutation in the factories for getting dep repositories (Closed)
Patch Set: Added the Factory method to CachedGitilesRepository Created 3 years, 11 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
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 """Runs delta test on two Predator revisions.""" 5 """Runs delta test on two Predator revisions."""
6 6
7 import argparse 7 import argparse
8 from datetime import date 8 from datetime import date
9 from datetime import timedelta 9 from datetime import timedelta
10 import logging 10 import logging
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 git_hash2 = delta_util.ParseGitHash(args.revisions[1]) 132 git_hash2 = delta_util.ParseGitHash(args.revisions[1])
133 133
134 delta_result_prefix = '%s_%s_%s..%s.delta' % (git_hash1[:7], git_hash2[:7], 134 delta_result_prefix = '%s_%s_%s..%s.delta' % (git_hash1[:7], git_hash2[:7],
135 args.since, args.until) 135 args.since, args.until)
136 delta_csv_path = os.path.join(DELTA_RESULTS_DIRECTORY, 136 delta_csv_path = os.path.join(DELTA_RESULTS_DIRECTORY,
137 '%s.csv' % delta_result_prefix) 137 '%s.csv' % delta_result_prefix)
138 delta_path = os.path.join(DELTA_RESULTS_DIRECTORY, 138 delta_path = os.path.join(DELTA_RESULTS_DIRECTORY,
139 delta_result_prefix) 139 delta_result_prefix)
140 140
141 # Check if delta results already existed. 141 # Check if delta results already existed.
142 # TODO: this code has race conditions for interacting with the file system.
142 if os.path.exists(delta_csv_path): 143 if os.path.exists(delta_csv_path):
143 print 'Delta results existed in\n%s' % delta_csv_path 144 print 'Delta results existed in\n%s' % delta_csv_path
144 if not os.path.exists(delta_path): 145 if not os.path.exists(delta_path):
145 print 'Cannot print out delta results, please open %s to see the results.' 146 print 'Cannot print out delta results, please open %s to see the results.'
146 return 147 return
147 148
148 with open(delta_path) as f: 149 with open(delta_path) as f:
149 deltas, crash_num = pickle.load(f) 150 deltas, crash_num = pickle.load(f)
150 else: 151 else:
151 print 'Running delta test...' 152 print 'Running delta test...'
152 print ('WARNING: Please commit any local change before running delta test, ' 153 print ('WARNING: Please commit any local change before running delta test, '
153 'and do not make any new changes while running the delta test.') 154 'and do not make any new changes while running the delta test.')
154 # Get delta of results between git_hash1 and git_hash2. 155 # Get delta of results between git_hash1 and git_hash2.
155 deltas, crash_num = delta_test.DeltaEvaluator( 156 deltas, crash_num = delta_test.DeltaEvaluator(
156 git_hash1, git_hash2, args.client, args.app, 157 git_hash1, git_hash2, args.client, args.app,
157 start_date=args.since, end_date=args.until, 158 start_date=args.since, end_date=args.until,
158 batch_size=args.batch, verbose=args.verbose) 159 batch_size=args.batch, verbose=args.verbose)
159 delta_util.FlushResult([deltas, crash_num], delta_path) 160 delta_util.FlushResult([deltas, crash_num], delta_path)
160 delta_util.WriteDeltaToCSV(deltas, crash_num, args.app, 161 delta_util.WriteDeltaToCSV(deltas, crash_num, args.app,
161 git_hash1, git_hash2, delta_csv_path) 162 git_hash1, git_hash2, delta_csv_path)
162 163
163 # Print delta results to users. 164 # Print delta results to users.
164 print '\n========================= Summary =========================' 165 print '\n========================= Summary ========================='
165 delta_util.PrintDelta(deltas, crash_num, args.app) 166 delta_util.PrintDelta(deltas, crash_num, args.app)
166 167
167 168
168 if __name__ == '__main__': 169 if __name__ == '__main__':
169 RunDeltaTest() 170 RunDeltaTest()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698