aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crosperf/download_images.py12
-rwxr-xr-xcrosperf/download_images_buildid_test.py2
-rwxr-xr-xcrosperf/download_images_unittest.py16
3 files changed, 15 insertions, 15 deletions
diff --git a/crosperf/download_images.py b/crosperf/download_images.py
index 55fda51b..33875208 100644
--- a/crosperf/download_images.py
+++ b/crosperf/download_images.py
@@ -24,7 +24,7 @@ class ImageDownloader(object):
self._logger,
log_level=self.log_level)
- def _GetBuildID(self, chromeos_root, xbuddy_label):
+ def GetBuildID(self, chromeos_root, xbuddy_label):
# Get the translation of the xbuddy_label into the real Google Storage
# image name.
command = ('cd ~/trunk/src/third_party/toolchain-utils/crosperf; '
@@ -39,7 +39,7 @@ class ImageDownloader(object):
return build_id
- def _DownloadImage(self, chromeos_root, build_id, image_name):
+ def DownloadImage(self, chromeos_root, build_id, image_name):
if self.log_level == 'average':
self._logger.LogOutput('Preparing to download %s image to local '
'directory.' % build_id)
@@ -65,7 +65,7 @@ class ImageDownloader(object):
else:
return None
- def _UncompressImage(self, chromeos_root, build_id):
+ def UncompressImage(self, chromeos_root, build_id):
# Check to see if the file has already been uncompresssed, etc.
if os.path.exists(os.path.join(chromeos_root, 'chroot/tmp', build_id,
'chromiumos_test_image.bin')):
@@ -82,7 +82,7 @@ class ImageDownloader(object):
return retval
def Run(self, chromeos_root, xbuddy_label):
- build_id = self._GetBuildID(chromeos_root, xbuddy_label)
+ build_id = self.GetBuildID(chromeos_root, xbuddy_label)
image_name = ('gs://chromeos-image-archive/%s/chromiumos_test_image.tar.xz'
% build_id)
@@ -94,10 +94,10 @@ class ImageDownloader(object):
status = self._ce.ChrootRunCommand(chromeos_root, cmd)
if status != 0:
raise MissingImage('Cannot find official image: %s.' % image_name)
- image_path = self._DownloadImage(chromeos_root, build_id, image_name)
+ image_path = self.DownloadImage(chromeos_root, build_id, image_name)
retval = 0
if image_path:
- retval = self._UncompressImage(chromeos_root, build_id)
+ retval = self.UncompressImage(chromeos_root, build_id)
else:
retval = 1
diff --git a/crosperf/download_images_buildid_test.py b/crosperf/download_images_buildid_test.py
index e3352f8e..690ebd98 100755
--- a/crosperf/download_images_buildid_test.py
+++ b/crosperf/download_images_buildid_test.py
@@ -68,7 +68,7 @@ class ImageDownloaderBuildIDTest(object):
print "Translating '%s'" % test_id
self.tests_run = self.tests_run + 1
- result = downloader._GetBuildID(self.chromeos_root, test_id)
+ result = downloader.GetBuildID(self.chromeos_root, test_id)
# Verify that we got a build id back.
self.assertIsNotNone(result, 'result')
diff --git a/crosperf/download_images_unittest.py b/crosperf/download_images_unittest.py
index 2cb79a15..1a885c61 100755
--- a/crosperf/download_images_unittest.py
+++ b/crosperf/download_images_unittest.py
@@ -45,7 +45,7 @@ class ImageDownloaderTestcast(unittest.TestCase):
# Set os.path.exists to always return False and run downloader
mock_path_exists.return_value = False
test_flag.SetTestMode(True)
- downloader._DownloadImage(test_chroot, test_build_id, image_path)
+ downloader.DownloadImage(test_chroot, test_build_id, image_path)
# Verify os.path.exists was called twice, with proper arguments.
self.assertEqual(mock_path_exists.call_count, 2)
@@ -75,7 +75,7 @@ class ImageDownloaderTestcast(unittest.TestCase):
mock_path_exists.return_value = True
# Run downloader
- downloader._DownloadImage(test_chroot, test_build_id, image_path)
+ downloader.DownloadImage(test_chroot, test_build_id, image_path)
# Verify os.path.exists was called twice, with proper arguments.
self.assertEqual(mock_path_exists.call_count, 2)
@@ -103,7 +103,7 @@ class ImageDownloaderTestcast(unittest.TestCase):
# Set os.path.exists to always return False and run uncompress.
mock_path_exists.return_value = False
- downloader._UncompressImage(test_chroot, test_build_id)
+ downloader.UncompressImage(test_chroot, test_build_id)
# Verify os.path.exists was called once, with correct arguments.
self.assertEqual(mock_path_exists.call_count, 1)
@@ -122,7 +122,7 @@ class ImageDownloaderTestcast(unittest.TestCase):
mock_path_exists.reset_mock()
mock_cmd_exec.reset_mock()
mock_path_exists.return_value = True
- downloader._UncompressImage(test_chroot, test_build_id)
+ downloader.UncompressImage(test_chroot, test_build_id)
# Verify os.path.exists was called once, with correct arguments.
self.assertEqual(mock_path_exists.call_count, 1)
@@ -171,9 +171,9 @@ class ImageDownloaderTestcast(unittest.TestCase):
downloader = download_images.ImageDownloader(logger_to_use=MOCK_LOGGER)
# Set downloader to call fake stubs.
- downloader._GetBuildID = FakeGetBuildID
- downloader._UncompressImage = FakeUncompressImage
- downloader._DownloadImage = GoodDownloadImage
+ downloader.GetBuildID = FakeGetBuildID
+ downloader.UncompressImage = FakeUncompressImage
+ downloader.DownloadImage = GoodDownloadImage
# Call Run.
downloader.Run(test_chroot, test_build_id)
@@ -185,7 +185,7 @@ class ImageDownloaderTestcast(unittest.TestCase):
# Reset values; Now use fake stub that simulates DownloadImage failing.
self.called_download_image = False
self.called_uncompress_image = False
- downloader._DownloadImage = BadDownloadImage
+ downloader.DownloadImage = BadDownloadImage
# Call Run again.
downloader.Run(test_chroot, test_build_id)