Commit 782822fa authored by Sven Zheng's avatar Sven Zheng Committed by Commit Bot

[lacros] Fix sometimes script can't run tests locally

Error:
  File "build/lacros/test_runner.py", line 129, in _remove_unused_ash_chrome_versions
    age = time.time() - os.path.getatime(os.path.join(p, 'chrome'))
  File "/usr/local/google/home/svenzheng/.vpython-root/000cad/lib/python2.7/genericpath.py", line 67, in getatime
    return os.stat(filename).st_atime
OSError: [Errno 2] No such file or directory: 'build/lacros/prebuilt_ash_chrome/for_bots/chrome'

Bug: 1131739
Change-Id: I78dbaa624956a4e9019598eae3c07270907792bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429590Reviewed-by: default avatarYuke Liao <liaoyuke@chromium.org>
Commit-Queue: Sven Zheng <svenzheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811344}
parent 95344d66
......@@ -125,8 +125,10 @@ def _remove_unused_ash_chrome_versions(version_to_skip):
# them to keep the directory clean.
os.remove(p)
continue
age = time.time() - os.path.getatime(os.path.join(p, 'chrome'))
chrome_path = os.path.join(p, 'chrome')
if not os.path.exists(chrome_path):
chrome_path = p
age = time.time() - os.path.getatime(chrome_path)
if age > expiration_duration:
logging.info(
'Removing ash-chrome: "%s" as it hasn\'t been used in the '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment