| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 def crash_handler_report(self): | 64 def crash_handler_report(self): |
| 65 pass | 65 pass |
| 66 | 66 |
| 67 | 67 |
| 68 def assert_(self, expr, msg='Assertion failed.'): | 68 def assert_(self, expr, msg='Assertion failed.'): |
| 69 if not expr: | 69 if not expr: |
| 70 raise error.TestError(msg) | 70 raise error.TestError(msg) |
| 71 | 71 |
| 72 | 72 |
| 73 def write_test_keyval(self, attr_dict): | 73 def write_test_keyval(self, attr_dict): |
| 74 utils.write_keyval(self.outputdir, attr_dict) | 74 utils.write_keyval(self.outputdir, attr_dict, |
| 75 | 75 tap_report=self.job._tap) |
| 76 | 76 |
| 77 @staticmethod | 77 @staticmethod |
| 78 def _append_type_to_keys(dictionary, typename): | 78 def _append_type_to_keys(dictionary, typename): |
| 79 new_dict = {} | 79 new_dict = {} |
| 80 for key, value in dictionary.iteritems(): | 80 for key, value in dictionary.iteritems(): |
| 81 new_key = "%s{%s}" % (key, typename) | 81 new_key = "%s{%s}" % (key, typename) |
| 82 new_dict[new_key] = value | 82 new_dict[new_key] = value |
| 83 return new_dict | 83 return new_dict |
| 84 | 84 |
| 85 | 85 |
| 86 def write_perf_keyval(self, perf_dict): | 86 def write_perf_keyval(self, perf_dict): |
| 87 self.write_iteration_keyval({}, perf_dict) | 87 self.write_iteration_keyval({}, perf_dict, |
| 88 tap_report=self.job._tap) |
| 88 | 89 |
| 89 | 90 |
| 90 def write_attr_keyval(self, attr_dict): | 91 def write_attr_keyval(self, attr_dict): |
| 91 self.write_iteration_keyval(attr_dict, {}) | 92 self.write_iteration_keyval(attr_dict, {}, |
| 93 tap_report=self.job._tap) |
| 92 | 94 |
| 93 | 95 |
| 94 def write_iteration_keyval(self, attr_dict, perf_dict): | 96 def write_iteration_keyval(self, attr_dict, perf_dict, tap_report=None): |
| 95 # append the dictionaries before they have the {perf} and {attr} added | 97 # append the dictionaries before they have the {perf} and {attr} added |
| 96 self._keyvals.append({'attr':attr_dict, 'perf':perf_dict}) | 98 self._keyvals.append({'attr':attr_dict, 'perf':perf_dict}) |
| 97 self._new_keyval = True | 99 self._new_keyval = True |
| 98 | 100 |
| 99 if attr_dict: | 101 if attr_dict: |
| 100 attr_dict = self._append_type_to_keys(attr_dict, "attr") | 102 attr_dict = self._append_type_to_keys(attr_dict, "attr") |
| 101 utils.write_keyval(self.resultsdir, attr_dict, type_tag="attr") | 103 utils.write_keyval(self.resultsdir, attr_dict, type_tag="attr", |
| 104 tap_report=tap_report) |
| 102 | 105 |
| 103 if perf_dict: | 106 if perf_dict: |
| 104 perf_dict = self._append_type_to_keys(perf_dict, "perf") | 107 perf_dict = self._append_type_to_keys(perf_dict, "perf") |
| 105 utils.write_keyval(self.resultsdir, perf_dict, type_tag="perf") | 108 utils.write_keyval(self.resultsdir, perf_dict, type_tag="perf", |
| 109 tap_report=tap_report) |
| 106 | 110 |
| 107 keyval_path = os.path.join(self.resultsdir, "keyval") | 111 keyval_path = os.path.join(self.resultsdir, "keyval") |
| 108 print >> open(keyval_path, "a"), "" | 112 print >> open(keyval_path, "a"), "" |
| 109 | 113 |
| 110 | 114 |
| 111 def analyze_perf_constraints(self, constraints): | 115 def analyze_perf_constraints(self, constraints): |
| 112 if not self._new_keyval: | 116 if not self._new_keyval: |
| 113 return | 117 return |
| 114 | 118 |
| 115 # create a dict from the keyvals suitable as an environment for eval | 119 # create a dict from the keyvals suitable as an environment for eval |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 if before_iteration_hook: | 686 if before_iteration_hook: |
| 683 mytest.register_before_iteration_hook(before_iteration_hook) | 687 mytest.register_before_iteration_hook(before_iteration_hook) |
| 684 if after_iteration_hook: | 688 if after_iteration_hook: |
| 685 mytest.register_after_iteration_hook(after_iteration_hook) | 689 mytest.register_after_iteration_hook(after_iteration_hook) |
| 686 mytest._exec(args, dargs) | 690 mytest._exec(args, dargs) |
| 687 finally: | 691 finally: |
| 688 os.chdir(pwd) | 692 os.chdir(pwd) |
| 689 if after_test_hook: | 693 if after_test_hook: |
| 690 after_test_hook(mytest) | 694 after_test_hook(mytest) |
| 691 shutil.rmtree(mytest.tmpdir, ignore_errors=True) | 695 shutil.rmtree(mytest.tmpdir, ignore_errors=True) |
| OLD | NEW |