| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |