Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: scripts/slave/unittests/slave_utils_test.py

Issue 2330133002: Updating the SwarmingIsolatedScriptTest to upload chartjson results to the (Closed)
Patch Set: Updating steps.py to utilize new swarming api Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import sys 7 import sys
8 import unittest 8 import unittest
9 9
10 import test_env # pylint: disable=W0403,W0611 10 import test_env # pylint: disable=W0403,W0611
11 11
12 import mock 12 import mock
13 import slave.slave_utils as slave_utils 13 import slave.slave_utils as slave_utils
14 from common import chromium_utils 14 from common import chromium_utils
15 15
16 # build/scripts/slave/unittests 16 # build/scripts/slave/unittests
17 _SCRIPT_DIR = os.path.dirname(__file__) 17 _SCRIPT_DIR = os.path.dirname(__file__)
18 _BUILD_DIR = os.path.abspath(os.path.join( 18 _BUILD_DIR = os.path.abspath(os.path.join(
19 _SCRIPT_DIR, os.pardir, os.pardir)) 19 _SCRIPT_DIR, os.pardir, os.pardir))
20 20
21
22 # Note: The git-svn id / cr pos is intentionally modified.
23 # Also commit messages modified to be < 80 char.
24 CHROMIUM_LOG = """
25 Update GPU rasterization device whitelist
26
27 This replaces the whitelisting of all Qualcomm GPUs on
28 Android 4.4 with whitelisting all Android 4.4 devices
29 with GL ES version >= 3.0.
30
31 BUG=405646
32
33 Review URL: https://codereview.chromium.org/468103003
34
35 Cr-Commit-Position: refs/heads/master@{#291141}
36 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291140 0039d316-1c4b-4281
37 """
38
39 BLINK_LOG = """
40 [Sheriff-o-matic] Remove race condition on the commit list.
41
42 By always modifying the same list of commits, we ensure that data binding
43
44 As well, renamed "revisionLog" to "commitLog" everywhere, to better reflect
45
46 BUG=405327
47 NOTRY=true
48
49 Review URL: https://codereview.chromium.org/485253004
50
51 git-svn-id: svn://svn.chromium.org/blink/trunk@180728 bbb929c8-8fbe-4397-9dbb-9
52 """
53
54
21 class TestGetZipFileNames(unittest.TestCase): 55 class TestGetZipFileNames(unittest.TestCase):
22 def setUp(self): 56 def setUp(self):
23 super(TestGetZipFileNames, self).setUp() 57 super(TestGetZipFileNames, self).setUp()
24 chromium_utils.OverridePlatformName(sys.platform) 58 chromium_utils.OverridePlatformName(sys.platform)
25 59
26 def testNormalBuildName(self): 60 def testNormalBuildName(self):
27 (base_name, version_suffix) = slave_utils.GetZipFileNames( 61 (base_name, version_suffix) = slave_utils.GetZipFileNames(
28 '', None, None, 123) 62 '', None, None, 123)
29 self._verifyBaseName(base_name) 63 self._verifyBaseName(base_name)
30 self.assertEqual('_123', version_suffix) 64 self.assertEqual('_123', version_suffix)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 cache_control='mock_cache') 120 cache_control='mock_cache')
87 run_command_mock.assert_called_with(['/mock/gsutil', '-h', 121 run_command_mock.assert_called_with(['/mock/gsutil', '-h',
88 'Cache-Control:mock_cache', 'cp', 'file://foo', 122 'Cache-Control:mock_cache', 'cp', 'file://foo',
89 'file://bar/foo']) 123 'file://bar/foo'])
90 slave_utils.GSUtilCopyDir('foo', 'bar', 124 slave_utils.GSUtilCopyDir('foo', 'bar',
91 cache_control='mock_cache') 125 cache_control='mock_cache')
92 run_command_mock.assert_called_with(['/mock/gsutil', '-m', '-h', 126 run_command_mock.assert_called_with(['/mock/gsutil', '-m', '-h',
93 'Cache-Control:mock_cache', 'cp', '-R', 'foo', 'bar']) 127 'Cache-Control:mock_cache', 'cp', '-R', 'foo', 'bar'])
94 128
95 129
130 class GetGitRevisionTest(unittest.TestCase):
131 """Tests related to getting revisions from a directory."""
132 def test_GitSvnCase(self):
133 # pylint: disable=W0212
134 self.assertEqual(slave_utils._GetGitCommitPositionFromLog(CHROMIUM_LOG),
135 '291141')
136 # pylint: disable=W0212
137 self.assertEqual(slave_utils._GetGitCommitPositionFromLog(BLINK_LOG),
138 '180728')
139
140 def test_GetCommitPosFromBuildPropTest(self):
141 """Tests related to getting a commit position from build properties."""
142 # pylint: disable=W0212
143 self.assertEqual(slave_utils._GetCommitPos(
144 {'got_revision_cp': 'refs/heads/master@{#12345}'}), 12345)
145 # pylint: disable=W0212
146 self.assertIsNone(slave_utils._GetCommitPos({'got_revision': 12345}))
147
148 class TelemetryRevisionTest(unittest.TestCase):
149 def test_GetTelemetryRevisions(self):
150 point_id = 1470050195
151 revision = '294850'
152 webkit_revision = '34f9d01'
153 build_properties = {
154 'got_webrtc_revision': None,
155 'got_v8_revision': 'undefined',
156 'git_revision': '9a7b354',
157 }
158 versions = slave_utils.GetTelemetryRevisions(
159 build_properties, revision, webkit_revision, point_id)
160 self.assertEqual(
161 {'rev': '294850', 'webkit_rev': '34f9d01', 'git_revision': '9a7b354',
162 'point_id': 1470050195},
163 versions)
164
165
96 if __name__ == '__main__': 166 if __name__ == '__main__':
97 unittest.main() 167 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698