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

Side by Side Diff: tools-webrtc/autoroller/unittests/roll_deps_test.py

Issue 1414343008: DEPS: Sync Git subtree mirrors instead of symlinking into chromium/src (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 3 years, 12 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 | « tools-webrtc/autoroller/roll_deps.py ('k') | tools-webrtc/autoroller/unittests/testdata/DEPS » ('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 (c) 2015 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 import glob 10 import glob
11 import os 11 import os
12 import shutil 12 import shutil
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 import unittest 15 import unittest
16 16
17 17
18 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 18 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
19 PARENT_DIR = os.path.join(SCRIPT_DIR, os.pardir) 19 PARENT_DIR = os.path.join(SCRIPT_DIR, os.pardir)
20 sys.path.append(PARENT_DIR) 20 sys.path.append(PARENT_DIR)
21 import roll_deps 21 import roll_deps
22 from roll_deps import CalculateChangedDepsProper, GetMatchingDepsEntries, \ 22 from roll_deps import CalculateChangedDeps, GetMatchingDepsEntries, \
23 ParseDepsDict, ParseLocalDepsFile, UpdateDepsFile 23 ParseDepsDict, ParseLocalDepsFile, UpdateDepsFile
24 24
25 25
26 TEST_DATA_VARS = { 26 TEST_DATA_VARS = {
27 'chromium_git': 'https://chromium.googlesource.com', 27 'chromium_git': 'https://chromium.googlesource.com',
28 'chromium_revision': '1b9c098a08e40114e44b6c1ec33ddf95c40b901d', 28 'chromium_revision': '1b9c098a08e40114e44b6c1ec33ddf95c40b901d',
29 } 29 }
30 30
31 DEPS_ENTRIES = { 31 DEPS_ENTRIES = {
32 'src/build': 'https://build.com', 32 'src/build': 'https://build.com',
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 def testGetMatchingDepsEntriesHandlesSimilarStartingPaths(self): 113 def testGetMatchingDepsEntriesHandlesSimilarStartingPaths(self):
114 entries = GetMatchingDepsEntries(DEPS_ENTRIES, 'src/testing') 114 entries = GetMatchingDepsEntries(DEPS_ENTRIES, 'src/testing')
115 self.assertEquals(len(entries), 2) 115 self.assertEquals(len(entries), 2)
116 116
117 def testGetMatchingDepsEntriesHandlesTwoPathsWithIdenticalFirstParts(self): 117 def testGetMatchingDepsEntriesHandlesTwoPathsWithIdenticalFirstParts(self):
118 entries = GetMatchingDepsEntries(DEPS_ENTRIES, 'src/build') 118 entries = GetMatchingDepsEntries(DEPS_ENTRIES, 'src/build')
119 self.assertEquals(len(entries), 1) 119 self.assertEquals(len(entries), 1)
120 self.assertEquals(entries[0], DEPS_ENTRIES['src/build']) 120 self.assertEquals(entries[0], DEPS_ENTRIES['src/build'])
121 121
122 def testCalculateChangedDepsProper(self): 122 def testCalculateChangedDeps(self):
123 _SetupGitLsRemoteCall(self.fake, 123 _SetupGitLsRemoteCall(self.fake,
124 'https://chromium.googlesource.com/chromium/src/build', BUILD_NEW_REV) 124 'https://chromium.googlesource.com/chromium/src/build', BUILD_NEW_REV)
125 webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile) 125 webrtc_deps = ParseLocalDepsFile(self._webrtc_depsfile)
126 new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile) 126 new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile)
127 changed_deps = CalculateChangedDepsProper(webrtc_deps, new_cr_deps) 127 changed_deps = CalculateChangedDeps(webrtc_deps, new_cr_deps)
128 self.assertEquals(len(changed_deps), 2) 128 self.assertEquals(len(changed_deps), 2)
129 self.assertEquals(changed_deps[0].path, 'src/build') 129 self.assertEquals(changed_deps[0].path, 'src/build')
130 self.assertEquals(changed_deps[0].current_rev, BUILD_OLD_REV) 130 self.assertEquals(changed_deps[0].current_rev, BUILD_OLD_REV)
131 self.assertEquals(changed_deps[0].new_rev, BUILD_NEW_REV) 131 self.assertEquals(changed_deps[0].new_rev, BUILD_NEW_REV)
132 132
133 self.assertEquals(changed_deps[1].path, 'src/buildtools') 133 self.assertEquals(changed_deps[1].path, 'src/buildtools')
134 self.assertEquals(changed_deps[1].current_rev, BUILDTOOLS_OLD_REV) 134 self.assertEquals(changed_deps[1].current_rev, BUILDTOOLS_OLD_REV)
135 self.assertEquals(changed_deps[1].new_rev, BUILDTOOLS_NEW_REV) 135 self.assertEquals(changed_deps[1].new_rev, BUILDTOOLS_NEW_REV)
136 136
137 def testCalculateChangedDepsLegacy(self):
138 old_cr_deps = ParseLocalDepsFile(self._old_cr_depsfile)
139 new_cr_deps = ParseLocalDepsFile(self._new_cr_depsfile)
140 changed_deps = CalculateChangedDepsProper(old_cr_deps, new_cr_deps)
141 self.assertEquals(len(changed_deps), 1)
142 self.assertEquals(changed_deps[0].path, 'src/buildtools')
143 self.assertEquals(changed_deps[0].current_rev, BUILDTOOLS_OLD_REV)
144 self.assertEquals(changed_deps[0].new_rev, BUILDTOOLS_NEW_REV)
145
146 137
147 def _SetupGitLsRemoteCall(cmd_fake, url, revision): 138 def _SetupGitLsRemoteCall(cmd_fake, url, revision):
148 cmd = ['git', 'ls-remote', url, revision] 139 cmd = ['git', 'ls-remote', url, revision]
149 cmd_fake.add_expectation(cmd, _returns=(revision, None)) 140 cmd_fake.add_expectation(cmd, _returns=(revision, None))
150 141
151 142
152 if __name__ == '__main__': 143 if __name__ == '__main__':
153 unittest.main() 144 unittest.main()
OLDNEW
« no previous file with comments | « tools-webrtc/autoroller/roll_deps.py ('k') | tools-webrtc/autoroller/unittests/testdata/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698