diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 16:20:29 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 16:20:29 +0000 |
commit | 2f22829db1e3977543953ab58627281b6c8c7fa7 (patch) | |
tree | e2b4bbc6ca2858e57b2741a851e149a7526af4bd | |
parent | e0801156e169e1e91a73a6d3aa5dc7b22dae1cb3 (diff) | |
download | chromium_src-2f22829db1e3977543953ab58627281b6c8c7fa7.zip chromium_src-2f22829db1e3977543953ab58627281b6c8c7fa7.tar.gz chromium_src-2f22829db1e3977543953ab58627281b6c8c7fa7.tar.bz2 |
Increase verbosity in run_test_from_archive.py to figure out a problem in it.
NOTRY=true
TBR=csharp@chromium.org
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/10519009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140299 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | tools/isolate/run_test_from_archive.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/tools/isolate/run_test_from_archive.py b/tools/isolate/run_test_from_archive.py index 735b3bd..4f8f4ff 100755 --- a/tools/isolate/run_test_from_archive.py +++ b/tools/isolate/run_test_from_archive.py @@ -186,17 +186,18 @@ class Cache(object): def trim(self): """Trims anything we don't know, make sure enough free space exists.""" # Ensure that all files listed in the state still exist. - for f in self.state: - if not os.path.exists(os.path.join(self.cache_dir, f)): - self.state.remove(f) + for filename in self.state: + if not os.path.exists(self.path(filename)): + logging.info('Removing lost file %s' % filename) + self.state.remove(filename) - for f in os.listdir(self.cache_dir): - if f == self.STATE_FILE or f in self.state: + for filename in os.listdir(self.cache_dir): + if filename == self.STATE_FILE or filename in self.state: continue - logging.warn('Unknown file %s from cache' % f) + logging.warn('Unknown file %s from cache' % filename) # Insert as the oldest file. It will be deleted eventually if not # accessed. - self.state.insert(0, f) + self.state.insert(0, filename) # Ensure enough free space. while ( @@ -204,17 +205,27 @@ class Cache(object): self.state and get_free_space(self.cache_dir) < self.min_free_space): try: - os.remove(self.path(self.state.pop(0))) + filename = self.state.pop(0) + logging.info('Trimming %s' % filename) + os.remove(self.path(filename)) except OSError as e: logging.error('Error attempting to delete a file\n%s' % e) # Ensure maximum cache size. if self.max_cache_size and self.state: - sizes = [os.stat(self.path(f)).st_size for f in self.state] + try: + sizes = [os.stat(self.path(f)).st_size for f in self.state] + except OSError: + logging.error( + 'At least one file is missing; %s\n' % '\n'.join(self.state)) + raise + while sizes and sum(sizes) > self.max_cache_size: # Delete the oldest item. try: - os.remove(self.path(self.state.pop(0))) + filename = self.state.pop(0) + logging.info('Trimming %s' % filename) + os.remove(self.path(filename)) except OSError as e: logging.error('Error attempting to delete a file\n%s' % e) sizes.pop(0) @@ -296,7 +307,7 @@ def main(): parser = optparse.OptionParser( usage='%prog <options>', description=sys.modules[__name__].__doc__) parser.add_option( - '-v', '--verbose', action='count', default=0, help='Use multiple times') + '-v', '--verbose', action='count', default=1, help='Use multiple times') parser.add_option( '-m', '--manifest', metavar='FILE', |