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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 80 |
81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR | 81 self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR |
82 self.PERF_SUBDIR = 'perf' | 82 self.PERF_SUBDIR = 'perf' |
83 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR | 83 self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR |
84 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' | 84 self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests' |
| 85 self.ARCHIVED_RESULTS_LIMIT = 25 |
85 self._http_server_started = False | 86 self._http_server_started = False |
86 self._websockets_server_started = False | 87 self._websockets_server_started = False |
87 | 88 |
88 self._results_directory = self._port.results_directory() | 89 self._results_directory = self._port.results_directory() |
89 self._finder = LayoutTestFinder(self._port, self._options) | 90 self._finder = LayoutTestFinder(self._port, self._options) |
90 self._runner = LayoutTestRunner(self._options, self._port, self._printer
, self._results_directory, self._test_is_slow) | 91 self._runner = LayoutTestRunner(self._options, self._port, self._printer
, self._results_directory, self._test_is_slow) |
91 | 92 |
92 def _collect_tests(self, args): | 93 def _collect_tests(self, args): |
93 return self._finder.find_tests(self._options, args) | 94 return self._finder.find_tests(self._options, args) |
94 | 95 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 # run was interrupted even before testing started. In those cases, d
on't archive the folder. | 160 # run was interrupted even before testing started. In those cases, d
on't archive the folder. |
160 # Simply override the current folder contents with new results. | 161 # Simply override the current folder contents with new results. |
161 import errno | 162 import errno |
162 if e.errno == errno.EEXIST: | 163 if e.errno == errno.EEXIST: |
163 _log.warning("No results.html file found in previous run, skippi
ng it.") | 164 _log.warning("No results.html file found in previous run, skippi
ng it.") |
164 return None | 165 return None |
165 archived_name = ''.join((self._filesystem.basename(self._results_directo
ry), "_", timestamp)) | 166 archived_name = ''.join((self._filesystem.basename(self._results_directo
ry), "_", timestamp)) |
166 archived_path = self._filesystem.join(self._filesystem.dirname(self._res
ults_directory), archived_name) | 167 archived_path = self._filesystem.join(self._filesystem.dirname(self._res
ults_directory), archived_name) |
167 self._filesystem.move(self._results_directory, archived_path) | 168 self._filesystem.move(self._results_directory, archived_path) |
168 | 169 |
| 170 def _clobber_old_archived_results(self): |
| 171 results_directory_path = self._filesystem.dirname(self._results_director
y) |
| 172 file_list = self._filesystem.listdir(results_directory_path) |
| 173 results_directories = [] |
| 174 for dir in file_list: |
| 175 file_path = self._filesystem.join(results_directory_path, dir) |
| 176 if self._filesystem.isdir(file_path): |
| 177 results_directories.append(file_path) |
| 178 results_directories.sort(key=lambda x: self._filesystem.mtime(x)) |
| 179 self._printer.write_update("Clobbering old archived results in %s" % res
ults_directory_path) |
| 180 for dir in results_directories[:-self.ARCHIVED_RESULTS_LIMIT]: |
| 181 self._filesystem.rmtree(dir) |
| 182 |
169 def _set_up_run(self, test_names): | 183 def _set_up_run(self, test_names): |
170 self._printer.write_update("Checking build ...") | 184 self._printer.write_update("Checking build ...") |
171 if self._options.build: | 185 if self._options.build: |
172 exit_code = self._port.check_build(self.needs_servers(test_names), s
elf._printer) | 186 exit_code = self._port.check_build(self.needs_servers(test_names), s
elf._printer) |
173 if exit_code: | 187 if exit_code: |
174 _log.error("Build check failed") | 188 _log.error("Build check failed") |
175 return exit_code | 189 return exit_code |
176 | 190 |
177 # This must be started before we check the system dependencies, | 191 # This must be started before we check the system dependencies, |
178 # since the helper may do things to make the setup correct. | 192 # since the helper may do things to make the setup correct. |
179 if self._options.pixel_tests: | 193 if self._options.pixel_tests: |
180 self._printer.write_update("Starting pixel test helper ...") | 194 self._printer.write_update("Starting pixel test helper ...") |
181 self._port.start_helper() | 195 self._port.start_helper() |
182 | 196 |
183 # Check that the system dependencies (themes, fonts, ...) are correct. | 197 # Check that the system dependencies (themes, fonts, ...) are correct. |
184 if not self._options.nocheck_sys_deps: | 198 if not self._options.nocheck_sys_deps: |
185 self._printer.write_update("Checking system dependencies ...") | 199 self._printer.write_update("Checking system dependencies ...") |
186 exit_code = self._port.check_sys_deps(self.needs_servers(test_names)
) | 200 exit_code = self._port.check_sys_deps(self.needs_servers(test_names)
) |
187 if exit_code: | 201 if exit_code: |
188 self._port.stop_helper() | 202 self._port.stop_helper() |
189 return exit_code | 203 return exit_code |
190 | 204 |
191 # FIXME : Add a condition here to limit the number of archived results (
total_archived_results < MAX_ARCHIVE_RESULTS) | |
192 if self._options.enable_versioned_results and self._filesystem.exists(se
lf._results_directory): | 205 if self._options.enable_versioned_results and self._filesystem.exists(se
lf._results_directory): |
193 if self._options.clobber_old_results: | 206 if self._options.clobber_old_results: |
194 _log.warning("Flag --enable_versioned_results overrides --clobbe
r-old-results.") | 207 _log.warning("Flag --enable_versioned_results overrides --clobbe
r-old-results.") |
| 208 self._clobber_old_archived_results() |
195 # Rename the existing results folder for archiving. | 209 # Rename the existing results folder for archiving. |
196 self._rename_results_folder() | 210 self._rename_results_folder() |
197 elif self._options.clobber_old_results: | 211 elif self._options.clobber_old_results: |
198 self._clobber_old_results() | 212 self._clobber_old_results() |
199 | 213 |
200 # Create the output directory if it doesn't already exist. | 214 # Create the output directory if it doesn't already exist. |
201 self._port.host.filesystem.maybe_make_directory(self._results_directory) | 215 self._port.host.filesystem.maybe_make_directory(self._results_directory) |
202 | 216 |
203 self._port.setup_test_run() | 217 self._port.setup_test_run() |
204 return test_run_results.OK_EXIT_STATUS | 218 return test_run_results.OK_EXIT_STATUS |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 return int(worker_name.split('/')[1]) if worker_name else -1 | 472 return int(worker_name.split('/')[1]) if worker_name else -1 |
459 | 473 |
460 stats = {} | 474 stats = {} |
461 for result in initial_results.results_by_name.values(): | 475 for result in initial_results.results_by_name.values(): |
462 if result.type != test_expectations.SKIP: | 476 if result.type != test_expectations.SKIP: |
463 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))} | 477 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))} |
464 stats_trie = {} | 478 stats_trie = {} |
465 for name, value in stats.iteritems(): | 479 for name, value in stats.iteritems(): |
466 json_results_generator.add_path_to_trie(name, value, stats_trie) | 480 json_results_generator.add_path_to_trie(name, value, stats_trie) |
467 return stats_trie | 481 return stats_trie |
OLD | NEW |