aboutsummaryrefslogtreecommitdiff
path: root/crosperf/download_images_buildid_test.py
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2015-12-15 13:49:30 -0800
committerLuis Lozano <llozano@chromium.org>2015-12-16 17:36:06 +0000
commitf2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe (patch)
tree185d243c7eed7c7a0db6f0e640746cadc1479ea9 /crosperf/download_images_buildid_test.py
parent2a66f70fef907c1cb15229cb58e5129cb620ac98 (diff)
downloadtoolchain-utils-f2a3ef46f75d2196a93d3ed27f4d1fcf22b54fbe.tar.gz
Run pyformat on all the toolchain-utils files.
This gets rid of a lot of lint issues. Ran by doing this: for f in *.py; do echo -n "$f " ; if [ -x $f ]; then pyformat -i --remove_trailing_comma --yapf --force_quote_type=double $f ; else pyformat -i --remove_shebang --remove_trailing_comma --yapf --force_quote_type=double $f ; fi ; done BUG=chromium:567921 TEST=Ran simple crosperf run. Change-Id: I59778835fdaa5f706d2e1765924389f9e97433d1 Reviewed-on: https://chrome-internal-review.googlesource.com/242031 Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Luis Lozano <llozano@chromium.org> Tested-by: Luis Lozano <llozano@chromium.org> Reviewed-by: Yunlian Jiang <yunlian@google.com>
Diffstat (limited to 'crosperf/download_images_buildid_test.py')
-rwxr-xr-xcrosperf/download_images_buildid_test.py78
1 files changed, 38 insertions, 40 deletions
diff --git a/crosperf/download_images_buildid_test.py b/crosperf/download_images_buildid_test.py
index bfa61006..e3352f8e 100755
--- a/crosperf/download_images_buildid_test.py
+++ b/crosperf/download_images_buildid_test.py
@@ -7,7 +7,6 @@ import sys
import download_images
-
#On May 1, 2014:
#latest : lumpy-release/R34-5500.132.0
#latest-beta : lumpy-release/R35-5712.43.0
@@ -20,90 +19,89 @@ class ImageDownloaderBuildIDTest(object):
def __init__(self):
parser = optparse.OptionParser()
- parser.add_option("-c", "--chromeos_root", dest="chromeos_root",
- help="Directory containing ChromeOS root.")
+ parser.add_option('-c',
+ '--chromeos_root',
+ dest='chromeos_root',
+ help='Directory containing ChromeOS root.')
options = parser.parse_args(sys.argv[1:])[0]
if options.chromeos_root is None:
- self._usage(parser, "--chromeos_root must be set")
+ self._usage(parser, '--chromeos_root must be set')
self.chromeos_root = options.chromeos_root
self.tests_passed = 0
self.tests_run = 0
self.tests_failed = 0
def _usage(self, parser, message):
- print "ERROR: " + message
+ print 'ERROR: ' + message
parser.print_help()
sys.exit(0)
def print_test_status(self):
- print "----------------------------------------\n"
- print "Tests attempted: %d" % self.tests_run
- print "Tests passed: %d" % self.tests_passed
- print "Tests failed: %d" % self.tests_failed
- print "\n----------------------------------------"
-
- def assert_failure (self, msg):
- print "Assert failure: %s" % msg
+ print '----------------------------------------\n'
+ print 'Tests attempted: %d' % self.tests_run
+ print 'Tests passed: %d' % self.tests_passed
+ print 'Tests failed: %d' % self.tests_failed
+ print '\n----------------------------------------'
+
+ def assert_failure(self, msg):
+ print 'Assert failure: %s' % msg
self.print_test_status()
sys.exit(1)
-
def assertIsNotNone(self, arg, arg_name):
if arg == None:
self.tests_failed = self.tests_failed + 1
- self.assert_failure ("%s is not None" % arg_name)
-
+ self.assert_failure('%s is not None' % arg_name)
def assertNotEqual(self, arg1, arg2, arg1_name, arg2_name):
if arg1 == arg2:
self.tests_failed = self.tests_failed + 1
- self.assert_failure ("%s is not NotEqual to %s" % (arg1_name, arg2_name))
+ self.assert_failure('%s is not NotEqual to %s' % (arg1_name, arg2_name))
def assertEqual(self, arg1, arg2, arg1_name, arg2_name):
if arg1 != arg2:
self.tests_failed = self.tests_failed + 1
- self.assert_failure ("%s is not Equal to %s" % (arg1_name, arg2_name))
+ self.assert_failure('%s is not Equal to %s' % (arg1_name, arg2_name))
-
- def test_one_id (self, downloader, test_id, result_string, exact_match):
+ def test_one_id(self, downloader, test_id, result_string, exact_match):
print "Translating '%s'" % test_id
self.tests_run = self.tests_run + 1
result = downloader._GetBuildID(self.chromeos_root, test_id)
# Verify that we got a build id back.
- self.assertIsNotNone(result, "result")
+ self.assertIsNotNone(result, 'result')
# Verify that the result either contains or exactly matches the
# result_string, depending on the exact_match argument.
if exact_match:
- self.assertEqual (result, result_string, "result", result_string)
+ self.assertEqual(result, result_string, 'result', result_string)
else:
- self.assertNotEqual (result.find(result_string), -1, "result.find", "-1")
+ self.assertNotEqual(result.find(result_string), -1, 'result.find', '-1')
self.tests_passed = self.tests_passed + 1
def test_get_build_id(self):
+ """Test that the actual translating of xbuddy names is working properly.
"""
- Test that the actual translating of xbuddy names is working properly.
- """
- downloader = download_images.ImageDownloader(log_level="quiet")
-
- self.test_one_id (downloader, "remote/lumpy/latest-dev", "lumpy-release/R",
- False)
- self.test_one_id (downloader,
- "remote/trybot-lumpy-release-afdo-use/R35-5672.0.0-b86",
- "trybot-lumpy-release-afdo-use/R35-5672.0.0-b86", True)
- self.test_one_id (downloader, "remote/lumpy-release/R35-5672.0.0",
- "lumpy-release/R35-5672.0.0", True)
- self.test_one_id (downloader, "remote/lumpy/latest-dev", "lumpy-release/R",
- False)
- self.test_one_id (downloader, "remote/lumpy/latest-official",
- "lumpy-release/R", False)
- self.test_one_id (downloader, "remote/lumpy/latest-beta", "lumpy-release/R",
- False)
+ downloader = download_images.ImageDownloader(log_level='quiet')
+
+ self.test_one_id(downloader, 'remote/lumpy/latest-dev', 'lumpy-release/R',
+ False)
+ self.test_one_id(downloader,
+ 'remote/trybot-lumpy-release-afdo-use/R35-5672.0.0-b86',
+ 'trybot-lumpy-release-afdo-use/R35-5672.0.0-b86', True)
+ self.test_one_id(downloader, 'remote/lumpy-release/R35-5672.0.0',
+ 'lumpy-release/R35-5672.0.0', True)
+ self.test_one_id(downloader, 'remote/lumpy/latest-dev', 'lumpy-release/R',
+ False)
+ self.test_one_id(downloader, 'remote/lumpy/latest-official',
+ 'lumpy-release/R', False)
+ self.test_one_id(downloader, 'remote/lumpy/latest-beta', 'lumpy-release/R',
+ False)
self.print_test_status()
+
if __name__ == '__main__':
tester = ImageDownloaderBuildIDTest()
tester.test_get_build_id()