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

Side by Side Diff: client/common_lib/test.py

Issue 6598041: Merge remote branch 'autotest-upstream/master' into merge-upstream (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 9 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 | client/common_lib/test_unittest.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 # Shell class for a test, inherited by all individual tests 1 # Shell class for a test, inherited by all individual tests
2 # 2 #
3 # Methods: 3 # Methods:
4 # __init__ initialise 4 # __init__ initialise
5 # initialize run once for each job 5 # initialize run once for each job
6 # setup run once for each new version of the test installed 6 # setup run once for each new version of the test installed
7 # run run the test (wrapped by job.run_test()) 7 # run run the test (wrapped by job.run_test())
8 # 8 #
9 # Data: 9 # Data:
10 # job backreference to the job this test instance is part of 10 # job backreference to the job this test instance is part of
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 194
195 def _call_run_once(self, constraints, profile_only, 195 def _call_run_once(self, constraints, profile_only,
196 postprocess_profiled_run, args, dargs): 196 postprocess_profiled_run, args, dargs):
197 self.drop_caches_between_iterations() 197 self.drop_caches_between_iterations()
198 198
199 # execute iteration hooks 199 # execute iteration hooks
200 for hook in self.before_iteration_hooks: 200 for hook in self.before_iteration_hooks:
201 hook(self) 201 hook(self)
202 202
203 if profile_only: 203 try:
204 if not self.job.profilers.present(): 204 if profile_only:
205 self.job.record('WARN', None, None, 'No profilers have been ' 205 if not self.job.profilers.present():
206 'added but profile_only is set - nothing ' 206 self.job.record('WARN', None, None,
207 'will be run') 207 'No profilers have been added but '
208 self.run_once_profiling(postprocess_profiled_run, *args, **dargs) 208 'profile_only is set - nothing '
209 else: 209 'will be run')
210 self.before_run_once() 210 self.run_once_profiling(postprocess_profiled_run,
211 self.run_once(*args, **dargs) 211 *args, **dargs)
212 self.after_run_once() 212 else:
213 self.before_run_once()
214 self.run_once(*args, **dargs)
215 self.after_run_once()
213 216
214 for hook in self.after_iteration_hooks: 217 self.postprocess_iteration()
215 hook(self) 218 self.analyze_perf_constraints(constraints)
216 219 finally:
217 self.postprocess_iteration() 220 for hook in self.after_iteration_hooks:
218 self.analyze_perf_constraints(constraints) 221 hook(self)
219 222
220 223
221 def execute(self, iterations=None, test_length=None, profile_only=None, 224 def execute(self, iterations=None, test_length=None, profile_only=None,
222 _get_time=time.time, postprocess_profiled_run=None, 225 _get_time=time.time, postprocess_profiled_run=None,
223 constraints=(), *args, **dargs): 226 constraints=(), *args, **dargs):
224 """ 227 """
225 This is the basic execute method for the tests inherited from base_test. 228 This is the basic execute method for the tests inherited from base_test.
226 If you want to implement a benchmark test, it's better to implement 229 If you want to implement a benchmark test, it's better to implement
227 the run_once function, to cope with the profiling infrastructure. For 230 the run_once function, to cope with the profiling infrastructure. For
228 other tests, you can just override the default implementation. 231 other tests, you can just override the default implementation.
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 if before_iteration_hook: 689 if before_iteration_hook:
687 mytest.register_before_iteration_hook(before_iteration_hook) 690 mytest.register_before_iteration_hook(before_iteration_hook)
688 if after_iteration_hook: 691 if after_iteration_hook:
689 mytest.register_after_iteration_hook(after_iteration_hook) 692 mytest.register_after_iteration_hook(after_iteration_hook)
690 mytest._exec(args, dargs) 693 mytest._exec(args, dargs)
691 finally: 694 finally:
692 os.chdir(pwd) 695 os.chdir(pwd)
693 if after_test_hook: 696 if after_test_hook:
694 after_test_hook(mytest) 697 after_test_hook(mytest)
695 shutil.rmtree(mytest.tmpdir, ignore_errors=True) 698 shutil.rmtree(mytest.tmpdir, ignore_errors=True)
OLDNEW
« no previous file with comments | « no previous file | client/common_lib/test_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698