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

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

Issue 2391353002: Revert of Updating the SwarmingIsolatedScriptTest to upload chartjson results to the (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « scripts/slave/unittests/runtest_test.py ('k') | scripts/slave/upload_perf_dashboard_results.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 # TODO(eyaich): Udpate example logs as they are out of date. Source of truth
25 # is now git so the git-svn-id entry is no longer present. Remove BLINK_LOG
26 # once we remove the blink revision concept
27 CHROMIUM_LOG = """
28 Update GPU rasterization device whitelist
29
30 This replaces the whitelisting of all Qualcomm GPUs on
31 Android 4.4 with whitelisting all Android 4.4 devices
32 with GL ES version >= 3.0.
33
34 BUG=405646
35
36 Review URL: https://codereview.chromium.org/468103003
37
38 Cr-Commit-Position: refs/heads/master@{#291141}
39 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291140 0039d316-1c4b-4281
40 """
41
42 BLINK_LOG = """
43 [Sheriff-o-matic] Remove race condition on the commit list.
44
45 By always modifying the same list of commits, we ensure that data binding
46
47 As well, renamed "revisionLog" to "commitLog" everywhere, to better reflect
48
49 BUG=405327
50 NOTRY=true
51
52 Review URL: https://codereview.chromium.org/485253004
53
54 git-svn-id: svn://svn.chromium.org/blink/trunk@180728 bbb929c8-8fbe-4397-9dbb-9
55 """
56
57
58 class TestGetZipFileNames(unittest.TestCase): 21 class TestGetZipFileNames(unittest.TestCase):
59 def setUp(self): 22 def setUp(self):
60 super(TestGetZipFileNames, self).setUp() 23 super(TestGetZipFileNames, self).setUp()
61 chromium_utils.OverridePlatformName(sys.platform) 24 chromium_utils.OverridePlatformName(sys.platform)
62 25
63 def testNormalBuildName(self): 26 def testNormalBuildName(self):
64 (base_name, version_suffix) = slave_utils.GetZipFileNames( 27 (base_name, version_suffix) = slave_utils.GetZipFileNames(
65 '', None, None, 123) 28 '', None, None, 123)
66 self._verifyBaseName(base_name) 29 self._verifyBaseName(base_name)
67 self.assertEqual('_123', version_suffix) 30 self.assertEqual('_123', version_suffix)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 cache_control='mock_cache') 86 cache_control='mock_cache')
124 run_command_mock.assert_called_with(['/mock/gsutil', '-h', 87 run_command_mock.assert_called_with(['/mock/gsutil', '-h',
125 'Cache-Control:mock_cache', 'cp', 'file://foo', 88 'Cache-Control:mock_cache', 'cp', 'file://foo',
126 'file://bar/foo']) 89 'file://bar/foo'])
127 slave_utils.GSUtilCopyDir('foo', 'bar', 90 slave_utils.GSUtilCopyDir('foo', 'bar',
128 cache_control='mock_cache') 91 cache_control='mock_cache')
129 run_command_mock.assert_called_with(['/mock/gsutil', '-m', '-h', 92 run_command_mock.assert_called_with(['/mock/gsutil', '-m', '-h',
130 'Cache-Control:mock_cache', 'cp', '-R', 'foo', 'bar']) 93 'Cache-Control:mock_cache', 'cp', '-R', 'foo', 'bar'])
131 94
132 95
133 class GetGitRevisionTest(unittest.TestCase):
134 """Tests related to getting revisions from a directory."""
135 def test_GitSvnCase(self):
136 # pylint: disable=W0212
137 self.assertEqual(slave_utils._GetGitCommitPositionFromLog(CHROMIUM_LOG),
138 '291141')
139 # pylint: disable=W0212
140 self.assertEqual(slave_utils._GetGitCommitPositionFromLog(BLINK_LOG),
141 '180728')
142
143 def test_GetCommitPosFromBuildPropTest(self):
144 """Tests related to getting a commit position from build properties."""
145 # pylint: disable=W0212
146 self.assertEqual(slave_utils._GetCommitPos(
147 {'got_revision_cp': 'refs/heads/master@{#12345}'}), 12345)
148 # pylint: disable=W0212
149 self.assertIsNone(slave_utils._GetCommitPos({'got_revision': 12345}))
150
151 class TelemetryRevisionTest(unittest.TestCase):
152 def test_GetPerfDashboardRevisions(self):
153 point_id = 1470050195
154 revision = '294850'
155 webkit_revision = '34f9d01'
156 build_properties = {
157 'got_webrtc_revision': None,
158 'got_v8_revision': 'undefined',
159 'git_revision': '9a7b354',
160 }
161 versions = slave_utils.GetPerfDashboardRevisions(
162 build_properties, revision, webkit_revision, point_id)
163 self.assertEqual(
164 {'rev': '294850', 'webkit_rev': '34f9d01', 'git_revision': '9a7b354',
165 'point_id': 1470050195},
166 versions)
167
168
169 if __name__ == '__main__': 96 if __name__ == '__main__':
170 unittest.main() 97 unittest.main()
OLDNEW
« no previous file with comments | « scripts/slave/unittests/runtest_test.py ('k') | scripts/slave/upload_perf_dashboard_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698