OLD | NEW |
---|---|
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged | 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 Args: | 70 Args: |
71 port: an object implementing port-specific | 71 port: an object implementing port-specific |
72 options: a dictionary of command line options | 72 options: a dictionary of command line options |
73 printer: a Printer object to record updates to. | 73 printer: a Printer object to record updates to. |
74 """ | 74 """ |
75 self._port = port | 75 self._port = port |
76 self._filesystem = port.host.filesystem | 76 self._filesystem = port.host.filesystem |
77 self._options = options | 77 self._options = options |
78 self._printer = printer | 78 self._printer = printer |
79 self._expectations = None | 79 self._expectations = None |
80 # Actions related to archiving of the results. | |
81 self.ARCHIVED_PATH = None | |
Dirk Pranke
2014/07/15 20:50:00
ARCHIVED_PATH isn't a constant; don't use upper ca
patro
2014/07/16 14:37:36
Done.
| |
82 self.REVISION_INFO = '' | |
80 | 83 |
81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR | 84 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR |
82 self.PERF_SUBDIR = 'perf' | 85 self.PERF_SUBDIR = 'perf' |
83 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR | 86 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR |
84 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' | 87 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' |
85 self._http_server_started = False | 88 self._http_server_started = False |
86 self._websockets_server_started = False | 89 self._websockets_server_started = False |
87 | 90 |
88 self._results_directory = self._port.results_directory() | 91 self._results_directory = self._port.results_directory() |
89 self._finder = LayoutTestFinder(self._port, self._options) | 92 self._finder = LayoutTestFinder(self._port, self._options) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 def _test_is_expected_missing(self, test_file): | 147 def _test_is_expected_missing(self, test_file): |
145 expectations = self._expectations.model().get_expectations(test_file) | 148 expectations = self._expectations.model().get_expectations(test_file) |
146 return test_expectations.MISSING in expectations or test_expectations.NE EDS_REBASELINE in expectations or test_expectations.NEEDS_MANUAL_REBASELINE in e xpectations | 149 return test_expectations.MISSING in expectations or test_expectations.NE EDS_REBASELINE in expectations or test_expectations.NEEDS_MANUAL_REBASELINE in e xpectations |
147 | 150 |
148 def _test_is_slow(self, test_file): | 151 def _test_is_slow(self, test_file): |
149 return test_expectations.SLOW in self._expectations.model().get_expectat ions(test_file) | 152 return test_expectations.SLOW in self._expectations.model().get_expectat ions(test_file) |
150 | 153 |
151 def needs_servers(self, test_names): | 154 def needs_servers(self, test_names): |
152 return any(self._test_requires_lock(test_name) for test_name in test_nam es) | 155 return any(self._test_requires_lock(test_name) for test_name in test_nam es) |
153 | 156 |
157 def _rename_results_folder_if_required(self): | |
158 try: | |
159 timestamp = time.strftime("%Y-%m-%d-%H-%M-%S", time.gmtime(self._fil esystem.mtime(self._filesystem.join(self._results_directory, "results.html")))) | |
160 archived_name = ''.join((self._filesystem.basename(self._results_dir ectory), "_", timestamp)) | |
161 archived_path = self._filesystem.join(self._filesystem.dirname(self. _results_directory), archived_name) | |
162 self._filesystem.move(self._results_directory, archived_path) | |
163 return archived_path | |
164 except OSError, e: | |
165 # It might be possible that results.html was not generated in previo us run, because the test | |
166 # run was interrupted even before testing started. In those cases, d on't archive the folder. | |
167 # Simply override the current folder contents with new results. | |
168 import errno | |
169 if e.errno == errno.EEXIST: | |
170 print "Found no result.html in the folder, ignoring this result and overwritten the folder..." | |
171 _log.info("Found no result.html in the folder, ignoring this res ult and overwritten the folder...") | |
Dirk Pranke
2014/07/15 20:50:00
Don't use both a print and a _log.info(). Just use
patro
2014/07/16 14:37:36
Done.
| |
172 return None | |
173 | |
154 def _set_up_run(self, test_names): | 174 def _set_up_run(self, test_names): |
155 self._printer.write_update("Checking build ...") | 175 self._printer.write_update("Checking build ...") |
156 if self._options.build: | 176 if self._options.build: |
157 exit_code = self._port.check_build(self.needs_servers(test_names), s elf._printer) | 177 exit_code = self._port.check_build(self.needs_servers(test_names), s elf._printer) |
158 if exit_code: | 178 if exit_code: |
159 _log.error("Build check failed") | 179 _log.error("Build check failed") |
160 return exit_code | 180 return exit_code |
161 | 181 |
162 # This must be started before we check the system dependencies, | 182 # This must be started before we check the system dependencies, |
163 # since the helper may do things to make the setup correct. | 183 # since the helper may do things to make the setup correct. |
164 if self._options.pixel_tests: | 184 if self._options.pixel_tests: |
165 self._printer.write_update("Starting pixel test helper ...") | 185 self._printer.write_update("Starting pixel test helper ...") |
166 self._port.start_helper() | 186 self._port.start_helper() |
167 | 187 |
168 # Check that the system dependencies (themes, fonts, ...) are correct. | 188 # Check that the system dependencies (themes, fonts, ...) are correct. |
169 if not self._options.nocheck_sys_deps: | 189 if not self._options.nocheck_sys_deps: |
170 self._printer.write_update("Checking system dependencies ...") | 190 self._printer.write_update("Checking system dependencies ...") |
171 exit_code = self._port.check_sys_deps(self.needs_servers(test_names) ) | 191 exit_code = self._port.check_sys_deps(self.needs_servers(test_names) ) |
172 if exit_code: | 192 if exit_code: |
173 self._port.stop_helper() | 193 self._port.stop_helper() |
174 return exit_code | 194 return exit_code |
175 | 195 |
176 if self._options.clobber_old_results: | 196 if self._options.clobber_old_results: |
177 self._clobber_old_results() | 197 self._clobber_old_results() |
178 | 198 |
199 # FIXME:: Here the condition has to be (archive_prev_results) and (total _archived_results < MAX_ARCHIVE_RESULTS) | |
Dirk Pranke
2014/07/15 20:50:00
This comment is referring to things that don't exi
patro
2014/07/16 14:37:36
Done.
| |
200 if self._options.enable_versioned_results and self._filesystem.exists(se lf._results_directory): | |
201 # Rename the existing results folder for archiving. | |
202 self.ARCHIVED_PATH = self._rename_results_folder_if_required() | |
Dirk Pranke
2014/07/15 20:50:00
the actual method is renaming the folder unconditi
patro
2014/07/16 14:37:36
Making the flags --enable-versioned-results --clob
| |
203 | |
179 # Create the output directory if it doesn't already exist. | 204 # Create the output directory if it doesn't already exist. |
180 self._port.host.filesystem.maybe_make_directory(self._results_directory) | 205 self._port.host.filesystem.maybe_make_directory(self._results_directory) |
181 | 206 |
182 self._port.setup_test_run() | 207 self._port.setup_test_run() |
183 return test_run_results.OK_EXIT_STATUS | 208 return test_run_results.OK_EXIT_STATUS |
184 | 209 |
185 def run(self, args): | 210 def run(self, args): |
186 """Run the tests and return a RunDetails object with the results.""" | 211 """Run the tests and return a RunDetails object with the results.""" |
187 start_time = time.time() | 212 start_time = time.time() |
188 self._printer.write_update("Collecting tests ...") | 213 self._printer.write_update("Collecting tests ...") |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 return int(worker_name.split('/')[1]) if worker_name else -1 | 462 return int(worker_name.split('/')[1]) if worker_name else -1 |
438 | 463 |
439 stats = {} | 464 stats = {} |
440 for result in initial_results.results_by_name.values(): | 465 for result in initial_results.results_by_name.values(): |
441 if result.type != test_expectations.SKIP: | 466 if result.type != test_expectations.SKIP: |
442 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int(result.test_run_time * 1000), int (result.total_run_time * 1000))} | 467 stats[result.test_name] = {'results': (_worker_number(result.wor ker_name), result.test_number, result.pid, int(result.test_run_time * 1000), int (result.total_run_time * 1000))} |
443 stats_trie = {} | 468 stats_trie = {} |
444 for name, value in stats.iteritems(): | 469 for name, value in stats.iteritems(): |
445 json_results_generator.add_path_to_trie(name, value, stats_trie) | 470 json_results_generator.add_path_to_trie(name, value, stats_trie) |
446 return stats_trie | 471 return stats_trie |
OLD | NEW |