| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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. |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 ('trunk/other@1', 'src/other'), | 394 ('trunk/other@1', 'src/other'), |
| 395 ('trunk/third_party/foo@2', 'src/third_party/prout')) | 395 ('trunk/third_party/foo@2', 'src/third_party/prout')) |
| 396 self.assertTree(tree) | 396 self.assertTree(tree) |
| 397 | 397 |
| 398 def testSyncJobs(self): | 398 def testSyncJobs(self): |
| 399 if not self.enabled: | 399 if not self.enabled: |
| 400 return | 400 return |
| 401 # TODO(maruel): safesync. | 401 # TODO(maruel): safesync. |
| 402 self.gclient(['config', self.svn_base + 'trunk/src/']) | 402 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 403 # Test unversioned checkout. | 403 # Test unversioned checkout. |
| 404 # Use --jobs 1 otherwise the order is not deterministic. |
| 404 self.parseGclient( | 405 self.parseGclient( |
| 405 ['sync', '--deps', 'mac', '--jobs', '8'], | 406 ['sync', '--deps', 'mac', '--jobs', '1'], |
| 406 ['running', 'running', | 407 [ |
| 407 # This is due to the way svn update is called for a | 408 'running', |
| 408 # single file when File() is used in a DEPS file. | 409 'running', |
| 409 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), | 410 # This is due to the way svn update is called for a |
| 410 'running', 'running', 'running', 'running'], | 411 # single file when File() is used in a DEPS file. |
| 412 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), |
| 413 'running', |
| 414 'running', |
| 415 'running', |
| 416 'running', |
| 417 ], |
| 411 untangle=True) | 418 untangle=True) |
| 412 tree = self.mangle_svn_tree( | 419 tree = self.mangle_svn_tree( |
| 413 ('trunk/src@2', 'src'), | 420 ('trunk/src@2', 'src'), |
| 414 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 421 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
| 415 ('trunk/other@2', 'src/other')) | 422 ('trunk/other@2', 'src/other')) |
| 416 tree['src/file/other/DEPS'] = ( | 423 tree['src/file/other/DEPS'] = ( |
| 417 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 424 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
| 418 tree['src/svn_hooked1'] = 'svn_hooked1' | 425 tree['src/svn_hooked1'] = 'svn_hooked1' |
| 419 self.assertTree(tree) | 426 self.assertTree(tree) |
| 420 | 427 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 tree['src/git_hooked2'] = 'git_hooked2' | 957 tree['src/git_hooked2'] = 'git_hooked2' |
| 951 self.assertTree(tree) | 958 self.assertTree(tree) |
| 952 | 959 |
| 953 # Manually remove git_hooked1 before synching to make sure it's not | 960 # Manually remove git_hooked1 before synching to make sure it's not |
| 954 # recreated. | 961 # recreated. |
| 955 os.remove(join(self.root_dir, 'src', 'git_hooked1')) | 962 os.remove(join(self.root_dir, 'src', 'git_hooked1')) |
| 956 | 963 |
| 957 # Test incremental versioned sync: sync backward. | 964 # Test incremental versioned sync: sync backward. |
| 958 expect3 = ('running', | 965 expect3 = ('running', |
| 959 os.path.join(self.root_dir, 'src', 'repo2', 'repo_renamed')) | 966 os.path.join(self.root_dir, 'src', 'repo2', 'repo_renamed')) |
| 967 # Use --jobs 1 otherwise the order is not deterministic. |
| 960 self.parseGclient( | 968 self.parseGclient( |
| 961 ['sync', '--revision', 'src@' + self.githash('repo_1', 1), | 969 ['sync', '--revision', 'src@' + self.githash('repo_1', 1), |
| 962 '--deps', 'mac', '--delete_unversioned_trees', '--jobs', '8'], | 970 '--deps', 'mac', '--delete_unversioned_trees', '--jobs', '1'], |
| 963 ['running', ('running', self.root_dir + '/src/repo4'), | 971 [ |
| 964 'running', ('running', self.root_dir + '/src/repo2/repo3'), | 972 'running', |
| 965 expect3, 'deleting'], | 973 ('running', self.root_dir + '/src/repo2/repo3'), |
| 974 'running', |
| 975 ('running', self.root_dir + '/src/repo4'), |
| 976 expect3, |
| 977 'deleting', |
| 978 ], |
| 966 untangle=True) | 979 untangle=True) |
| 967 tree = self.mangle_git_tree(('repo_1@1', 'src'), | 980 tree = self.mangle_git_tree(('repo_1@1', 'src'), |
| 968 ('repo_2@2', 'src/repo2'), | 981 ('repo_2@2', 'src/repo2'), |
| 969 ('repo_3@1', 'src/repo2/repo3'), | 982 ('repo_3@1', 'src/repo2/repo3'), |
| 970 ('repo_4@2', 'src/repo4')) | 983 ('repo_4@2', 'src/repo4')) |
| 971 tree['src/git_hooked2'] = 'git_hooked2' | 984 tree['src/git_hooked2'] = 'git_hooked2' |
| 972 self.assertTree(tree) | 985 self.assertTree(tree) |
| 973 # Test incremental sync: delete-unversioned_trees isn't there. | 986 # Test incremental sync: delete-unversioned_trees isn't there. |
| 974 expect4 = os.path.join(self.root_dir, 'src', 'repo2', 'repo3') | 987 expect4 = os.path.join(self.root_dir, 'src', 'repo2', 'repo3') |
| 975 expect5 = os.path.join(self.root_dir, 'src', 'repo4') | 988 expect5 = os.path.join(self.root_dir, 'src', 'repo4') |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 | 1368 |
| 1356 if '-c' in sys.argv: | 1369 if '-c' in sys.argv: |
| 1357 COVERAGE = True | 1370 COVERAGE = True |
| 1358 sys.argv.remove('-c') | 1371 sys.argv.remove('-c') |
| 1359 if os.path.exists('.coverage'): | 1372 if os.path.exists('.coverage'): |
| 1360 os.remove('.coverage') | 1373 os.remove('.coverage') |
| 1361 os.environ['COVERAGE_FILE'] = os.path.join( | 1374 os.environ['COVERAGE_FILE'] = os.path.join( |
| 1362 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1375 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 1363 '.coverage') | 1376 '.coverage') |
| 1364 unittest.main() | 1377 unittest.main() |
| OLD | NEW |