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

Side by Side Diff: tools/isolate/trace_test_cases.py

Issue 10411003: Make the .test_cases file more compact when large (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A manual version of trace_inputs.py that is specialized in tracing each 6 """A manual version of trace_inputs.py that is specialized in tracing each
7 google-test test case individually. 7 google-test test case individually.
8 8
9 This is mainly written to work around bugs in strace w.r.t. browser_tests. 9 This is mainly written to work around bugs in strace w.r.t. browser_tests.
10 """ 10 """
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 print 'Got a timeout while processing a task item %s' % e 141 print 'Got a timeout while processing a task item %s' % e
142 # Be sure to stop the pool on exception. 142 # Be sure to stop the pool on exception.
143 pool.terminate() 143 pool.terminate()
144 return 1 144 return 1
145 except Exception, e: 145 except Exception, e:
146 # Be sure to stop the pool on exception. 146 # Be sure to stop the pool on exception.
147 pool.terminate() 147 pool.terminate()
148 raise 148 raise
149 finally: 149 finally:
150 with open('%s.test_cases' % executable, 'w') as f: 150 with open('%s.test_cases' % executable, 'w') as f:
151 json.dump(out, f, indent=2, sort_keys=True) 151 if len(out) > 20:
152 # Pack it dense since the file is going to be pretty large.
153 json.dump(out, f, separators=(',',':'))
154 else:
155 # Keep it human readable.
156 json.dump(out, f, indent=2, sort_keys=True)
152 pool.close() 157 pool.close()
153 pool.join() 158 pool.join()
154 159
155 160
156 def main(): 161 def main():
157 """CLI frontend to validate arguments.""" 162 """CLI frontend to validate arguments."""
158 parser = optparse.OptionParser( 163 parser = optparse.OptionParser(
159 usage='%prog <options> [gtest]') 164 usage='%prog <options> [gtest]')
160 parser.allow_interspersed_args = False 165 parser.allow_interspersed_args = False
161 parser.add_option( 166 parser.add_option(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 options.cwd, 209 options.cwd,
205 options.product_dir, 210 options.product_dir,
206 options.leak, 211 options.leak,
207 options.skip, 212 options.skip,
208 options.jobs, 213 options.jobs,
209 options.timeout) 214 options.timeout)
210 215
211 216
212 if __name__ == '__main__': 217 if __name__ == '__main__':
213 sys.exit(main()) 218 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698