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

Side by Side Diff: tests/gclient_smoketest.py

Issue 5695007: Enhance RunPylint to use white_list and black_list arguments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: address review comment Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « tests/gclient_scm_test.py ('k') | tests/gclient_utils_test.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 """Smoke tests for gclient.py. 6 """Smoke tests for gclient.py.
7 7
8 Shell out 'gclient' and run basic conformance tests. 8 Shell out 'gclient' and run basic conformance tests.
9 9
10 This test assumes GClientSmokeBase.URL_BASE is valid. 10 This test assumes GClientSmokeBase.URL_BASE is valid.
11 """ 11 """
12 12
13 # pylint: disable=E1103,W0403
14
13 import logging 15 import logging
14 import os 16 import os
15 import re 17 import re
16 import subprocess 18 import subprocess
17 import sys 19 import sys
18 import unittest 20 import unittest
19 21
20 from fake_repos import check_call, join, write, FakeReposTestBase 22 from fake_repos import check_call, join, write, FakeReposTestBase
21 23
22 GCLIENT_PATH = join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 24 GCLIENT_PATH = join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 verb = items[i][0] 122 verb = items[i][0]
121 path = items[i][1] 123 path = items[i][1]
122 else: 124 else:
123 verb = items[i] 125 verb = items[i]
124 path = self.root_dir 126 path = self.root_dir
125 self.checkString(results[i][0][0], verb, (i, results[i][0][0], verb)) 127 self.checkString(results[i][0][0], verb, (i, results[i][0][0], verb))
126 self.checkString(results[i][0][2], path, (i, results[i][0][2], path)) 128 self.checkString(results[i][0][2], path, (i, results[i][0][2], path))
127 self.assertEquals(len(results), len(items), (stdout, items, len(results))) 129 self.assertEquals(len(results), len(items), (stdout, items, len(results)))
128 return results 130 return results
129 131
130 def svnBlockCleanup(self, out): 132 @staticmethod
133 def svnBlockCleanup(out):
131 """Work around svn status difference between svn 1.5 and svn 1.6 134 """Work around svn status difference between svn 1.5 and svn 1.6
132 I don't know why but on Windows they are reversed. So sorts the items.""" 135 I don't know why but on Windows they are reversed. So sorts the items."""
133 for i in xrange(len(out)): 136 for i in xrange(len(out)):
134 if len(out[i]) < 2: 137 if len(out[i]) < 2:
135 continue 138 continue
136 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]]) 139 out[i] = [out[i][0]] + sorted([x[1:].strip() for x in out[i][1:]])
137 return out 140 return out
138 141
139 142
140 class GClientSmoke(GClientSmokeBase): 143 class GClientSmoke(GClientSmokeBase):
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 src = join(self.root_dir, 'src') 656 src = join(self.root_dir, 'src')
654 res = self.gclient(['status', '--jobs', '1'], src) 657 res = self.gclient(['status', '--jobs', '1'], src)
655 self.checkBlock(res[0], [('running', src)]) 658 self.checkBlock(res[0], [('running', src)])
656 659
657 def testInitialCheckoutNotYetDone(self): 660 def testInitialCheckoutNotYetDone(self):
658 # Check that gclient can be executed when the initial checkout hasn't been 661 # Check that gclient can be executed when the initial checkout hasn't been
659 # done yet. 662 # done yet.
660 if not self.enabled: 663 if not self.enabled:
661 return 664 return
662 self.gclient(['config', self.svn_base + 'trunk/src/']) 665 self.gclient(['config', self.svn_base + 'trunk/src/'])
663 self.parseGclient(['sync', '--jobs', '1'], 666 self.parseGclient(
664 ['running', 'running', 667 ['sync', '--jobs', '1'],
665 # This is due to the way svn update is called for a 668 ['running', 'running',
666 # single file when File() is used in a DEPS file. 669 # This is due to the way svn update is called for a
667 ('running', os.path.join(self.root_dir, 'src', 'file', 'o ther')), 670 # single file when File() is used in a DEPS file.
668 'running', 'running', 'running', 'running']) 671 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')),
672 'running', 'running', 'running', 'running'])
669 673
670 def testInitialCheckoutFailed(self): 674 def testInitialCheckoutFailed(self):
671 # Check that gclient can be executed from an arbitrary sub directory if the 675 # Check that gclient can be executed from an arbitrary sub directory if the
672 # initial checkout has failed. 676 # initial checkout has failed.
673 if not self.enabled: 677 if not self.enabled:
674 return 678 return
675 self.gclient(['config', self.svn_base + 'trunk/src/']) 679 self.gclient(['config', self.svn_base + 'trunk/src/'])
676 self.gclient(['sync']) 680 self.gclient(['sync'])
677 # Cripple the checkout. 681 # Cripple the checkout.
678 os.remove(join(self.root_dir, '.gclient_entries')) 682 os.remove(join(self.root_dir, '.gclient_entries'))
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 if not self.enabled: 880 if not self.enabled:
877 return 881 return
878 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src']) 882 self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
879 self.gclient(['sync', '--deps', 'mac']) 883 self.gclient(['sync', '--deps', 'mac'])
880 results = self.gclient(['revinfo', '--deps', 'mac']) 884 results = self.gclient(['revinfo', '--deps', 'mac'])
881 out = ('src: %(base)srepo_1\n' 885 out = ('src: %(base)srepo_1\n'
882 'src/repo2: %(base)srepo_2@%(hash2)s\n' 886 'src/repo2: %(base)srepo_2@%(hash2)s\n'
883 'src/repo2/repo_renamed: %(base)srepo_3\n' % 887 'src/repo2/repo_renamed: %(base)srepo_3\n' %
884 { 888 {
885 'base': self.git_base, 889 'base': self.git_base,
886 'hash1': self.githash('repo_1', 2)[:7],
887 'hash2': self.githash('repo_2', 1)[:7], 890 'hash2': self.githash('repo_2', 1)[:7],
888 'hash3': self.githash('repo_3', 2)[:7],
889 }) 891 })
890 self.check((out, '', 0), results) 892 self.check((out, '', 0), results)
891 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) 893 results = self.gclient(['revinfo', '--deps', 'mac', '--actual'])
892 out = ('src: %(base)srepo_1@%(hash1)s\n' 894 out = ('src: %(base)srepo_1@%(hash1)s\n'
893 'src/repo2: %(base)srepo_2@%(hash2)s\n' 895 'src/repo2: %(base)srepo_2@%(hash2)s\n'
894 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' % 896 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' %
895 { 897 {
896 'base': self.git_base, 898 'base': self.git_base,
897 'hash1': self.githash('repo_1', 2), 899 'hash1': self.githash('repo_1', 2),
898 'hash2': self.githash('repo_2', 1), 900 'hash2': self.githash('repo_2', 1),
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 results = self.gclient(['revinfo', '--deps', 'mac']) 1007 results = self.gclient(['revinfo', '--deps', 'mac'])
1006 out = ('src: %(svn_base)s/src/\n' 1008 out = ('src: %(svn_base)s/src/\n'
1007 'src-git: %(git_base)srepo_1\n' 1009 'src-git: %(git_base)srepo_1\n'
1008 'src/file/other: File("%(svn_base)s/other/DEPS")\n' 1010 'src/file/other: File("%(svn_base)s/other/DEPS")\n'
1009 'src/other: %(svn_base)s/other\n' 1011 'src/other: %(svn_base)s/other\n'
1010 'src/repo2: %(git_base)srepo_2@%(hash2)s\n' 1012 'src/repo2: %(git_base)srepo_2@%(hash2)s\n'
1011 'src/repo2/repo_renamed: %(git_base)srepo_3\n' 1013 'src/repo2/repo_renamed: %(git_base)srepo_3\n'
1012 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { 1014 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % {
1013 'svn_base': self.svn_base + 'trunk', 1015 'svn_base': self.svn_base + 'trunk',
1014 'git_base': self.git_base, 1016 'git_base': self.git_base,
1015 'hash1': self.githash('repo_1', 2)[:7],
1016 'hash2': self.githash('repo_2', 1)[:7], 1017 'hash2': self.githash('repo_2', 1)[:7],
1017 'hash3': self.githash('repo_3', 2)[:7],
1018 } 1018 }
1019 self.check((out, '', 0), results) 1019 self.check((out, '', 0), results)
1020 results = self.gclient(['revinfo', '--deps', 'mac', '--actual']) 1020 results = self.gclient(['revinfo', '--deps', 'mac', '--actual'])
1021 out = ('src: %(svn_base)s/src/@2\n' 1021 out = ('src: %(svn_base)s/src/@2\n'
1022 'src-git: %(git_base)srepo_1@%(hash1)s\n' 1022 'src-git: %(git_base)srepo_1@%(hash1)s\n'
1023 'src/file/other: %(svn_base)s/other/DEPS@2\n' 1023 'src/file/other: %(svn_base)s/other/DEPS@2\n'
1024 'src/other: %(svn_base)s/other@2\n' 1024 'src/other: %(svn_base)s/other@2\n'
1025 'src/repo2: %(git_base)srepo_2@%(hash2)s\n' 1025 'src/repo2: %(git_base)srepo_2@%(hash2)s\n'
1026 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s\n' 1026 'src/repo2/repo_renamed: %(git_base)srepo_3@%(hash3)s\n'
1027 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % { 1027 'src/third_party/foo: %(svn_base)s/third_party/foo@1\n') % {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 #expected = ( 1142 #expected = (
1143 # './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n', 1143 # './: None\nfoo/bar: svn://127.0.0.1/svn/trunk/third_party/foo@1\n',
1144 # '', 0) 1144 # '', 0)
1145 #self.check(expected, results) 1145 #self.check(expected, results)
1146 1146
1147 def testRest(self): 1147 def testRest(self):
1148 if not self.enabled: 1148 if not self.enabled:
1149 return 1149 return
1150 self.gclient(['sync']) 1150 self.gclient(['sync'])
1151 # TODO(maruel): This is incorrect, it should run on ./ too. 1151 # TODO(maruel): This is incorrect, it should run on ./ too.
1152 out = self.parseGclient( 1152 self.parseGclient(
1153 ['cleanup', '--deps', 'mac', '--verbose', '--jobs', '1'], 1153 ['cleanup', '--deps', 'mac', '--verbose', '--jobs', '1'],
1154 [('running', join(self.root_dir, 'foo', 'bar'))]) 1154 [('running', join(self.root_dir, 'foo', 'bar'))])
1155 out = self.parseGclient( 1155 self.parseGclient(
1156 ['diff', '--deps', 'mac', '--verbose', '--jobs', '1'], 1156 ['diff', '--deps', 'mac', '--verbose', '--jobs', '1'],
1157 [('running', join(self.root_dir, 'foo', 'bar'))]) 1157 [('running', join(self.root_dir, 'foo', 'bar'))])
1158 1158
1159 1159
1160 if __name__ == '__main__': 1160 if __name__ == '__main__':
1161 if '-c' in sys.argv: 1161 if '-c' in sys.argv:
1162 COVERAGE = True 1162 COVERAGE = True
1163 sys.argv.remove('-c') 1163 sys.argv.remove('-c')
1164 if os.path.exists('.coverage'): 1164 if os.path.exists('.coverage'):
1165 os.remove('.coverage') 1165 os.remove('.coverage')
1166 os.environ['COVERAGE_FILE'] = os.path.join( 1166 os.environ['COVERAGE_FILE'] = os.path.join(
1167 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 1167 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
1168 '.coverage') 1168 '.coverage')
1169 unittest.main() 1169 unittest.main()
OLDNEW
« no previous file with comments | « tests/gclient_scm_test.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698