From b00c32c3355af5accc1dc59ee2f298684f680957 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Sat, 23 Oct 2010 23:38:48 -0700 Subject: [PATCH] Fix the tree by stating to right path. Change-Id: I33e861066e8a585ce839ebc7a8c23243fb18cd1c BUG=8083 TEST=Ran unit tests Review URL: http://codereview.chromium.org/4053007 --- bin/cbuildbot.py | 4 ++-- bin/cbuildbot_unittest.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/cbuildbot.py b/bin/cbuildbot.py index 721dd70573..d58a72727b 100755 --- a/bin/cbuildbot.py +++ b/bin/cbuildbot.py @@ -406,8 +406,8 @@ def _ArchiveTestResults(buildroot, board, archive_dir, test_results_dir): dir_entries = os.listdir(ARCHIVE_BASE) if len(dir_entries) >= ARCHIVE_COUNT: oldest_dirs = heapq.nsmallest((len(dir_entries) - ARCHIVE_COUNT) + 1, - [filename for filename in dir_entries], - key=lambda fn: os.stat(fn).st_mtime) + [os.path.join(ARCHIVE_BASE, filename) for filename in dir_entries], + key=lambda fn: os.stat(fn).st_mtime) Info('Removing archive dirs %s' % oldest_dirs) for oldest_dir in oldest_dirs: shutil.rmtree(os.path.join(ARCHIVE_BASE, oldest_dir)) diff --git a/bin/cbuildbot_unittest.py b/bin/cbuildbot_unittest.py index e699f0c9cb..bbbc56c6f7 100755 --- a/bin/cbuildbot_unittest.py +++ b/bin/cbuildbot_unittest.py @@ -131,8 +131,8 @@ class CBuildBotTest(mox.MoxTestBase): # Expected calls. os.path.exists(cbuildbot.ARCHIVE_BASE).AndReturn(True) os.listdir(os.path.join(cbuildbot.ARCHIVE_BASE)).AndReturn(dir_listing) - os.stat('file1').AndReturn(stat1) - os.stat('file2').AndReturn(stat2) + os.stat(os.path.join(cbuildbot.ARCHIVE_BASE, 'file1')).AndReturn(stat1) + os.stat(os.path.join(cbuildbot.ARCHIVE_BASE, 'file2')).AndReturn(stat2) # Should remove the oldest path. shutil.rmtree(os.path.join(cbuildbot.ARCHIVE_BASE, 'file2')) @@ -145,7 +145,7 @@ class CBuildBotTest(mox.MoxTestBase): os.path.exists(path_to_archive_dir).AndReturn(False) cbuildbot.RunCommand(['sudo', 'chmod', '-R', '+r', path_to_results]) shutil.copytree(path_to_results, path_to_archive_dir) - cbuildbot.RunCommand(['gzip', '-f', path_to_image]) + cbuildbot.RunCommand(['gzip', '-f', '--fast', path_to_image]) shutil.copyfile(path_to_image + '.gz', os.path.join( path_to_archive_dir, 'chromiumos_qemu_image.bin.gz'))