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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

Issue 489093002: Enabling archiving of test results by default in run-webkit-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing failures Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
index b5d4cce27c8d5b33c1ca1a3a9811b38f2f6aa9d0..ee9b6f9adaacaed50cd5da5ac6743f2baf099c78 100644
--- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
+++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
@@ -155,30 +155,33 @@ class Manager(object):
def _rename_results_folder(self):
try:
timestamp = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime(self._filesystem.mtime(self._filesystem.join(self._results_directory, "results.html"))))
- except OSError, e:
+ except (IOError, OSError), e:
# It might be possible that results.html was not generated in previous run, because the test
# run was interrupted even before testing started. In those cases, don't archive the folder.
# Simply override the current folder contents with new results.
import errno
- if e.errno == errno.EEXIST:
+ if e.errno == errno.EEXIST or e.errno == errno.ENOENT:
_log.warning("No results.html file found in previous run, skipping it.")
return None
archived_name = ''.join((self._filesystem.basename(self._results_directory), "_", timestamp))
archived_path = self._filesystem.join(self._filesystem.dirname(self._results_directory), archived_name)
self._filesystem.move(self._results_directory, archived_path)
- def _clobber_old_archived_results(self):
+ def _delete_dirs(self, dir_list):
+ for dir in dir_list:
+ self._filesystem.rmtree(dir)
+
+ def _limit_archived_results_count(self):
results_directory_path = self._filesystem.dirname(self._results_directory)
file_list = self._filesystem.listdir(results_directory_path)
results_directories = []
for dir in file_list:
file_path = self._filesystem.join(results_directory_path, dir)
- if self._filesystem.isdir(file_path):
+ if self._filesystem.isdir(file_path) and self._results_directory in file_path:
results_directories.append(file_path)
results_directories.sort(key=lambda x: self._filesystem.mtime(x))
- self._printer.write_update("Clobbering old archived results in %s" % results_directory_path)
- for dir in results_directories[:-self.ARCHIVED_RESULTS_LIMIT]:
- self._filesystem.rmtree(dir)
+ self._printer.write_update("Clobbering excess archived results in %s" % results_directory_path)
+ self._delete_dirs(results_directories[:-self.ARCHIVED_RESULTS_LIMIT])
def _set_up_run(self, test_names):
self._printer.write_update("Checking build ...")
@@ -202,14 +205,12 @@ class Manager(object):
self._port.stop_helper()
return exit_code
- if self._options.enable_versioned_results and self._filesystem.exists(self._results_directory):
- if self._options.clobber_old_results:
- _log.warning("Flag --enable_versioned_results overrides --clobber-old-results.")
- self._clobber_old_archived_results()
+ if self._options.clobber_old_results:
+ self._clobber_old_results()
+ elif self._filesystem.exists(self._results_directory):
+ self._limit_archived_results_count()
# Rename the existing results folder for archiving.
self._rename_results_folder()
- elif self._options.clobber_old_results:
- self._clobber_old_results()
# Create the output directory if it doesn't already exist.
self._port.host.filesystem.maybe_make_directory(self._results_directory)
@@ -395,16 +396,17 @@ class Manager(object):
writer.write_crash_log(crash_log)
def _clobber_old_results(self):
- # Just clobber the actual test results directories since the other
- # files in the results directory are explicitly used for cross-run
- # tracking.
- self._printer.write_update("Clobbering old results in %s" %
- self._results_directory)
- layout_tests_dir = self._port.layout_tests_dir()
- possible_dirs = self._port.test_dirs()
- for dirname in possible_dirs:
- if self._filesystem.isdir(self._filesystem.join(layout_tests_dir, dirname)):
- self._filesystem.rmtree(self._filesystem.join(self._results_directory, dirname))
+ dir_above_results_path = self._filesystem.dirname(self._results_directory)
+ self._printer.write_update("Clobbering old results in %s" % dir_above_results_path)
+ if not self._filesystem.exists(dir_above_results_path):
+ return
+ file_list = self._filesystem.listdir(dir_above_results_path)
+ results_directories = []
+ for dir in file_list:
+ file_path = self._filesystem.join(dir_above_results_path, dir)
+ if self._filesystem.isdir(file_path) and self._results_directory in file_path:
+ results_directories.append(file_path)
+ self._delete_dirs(results_directories)
# Port specific clean-up.
self._port.clobber_old_port_specific_results()
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698