OLD | NEW |
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. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 ['sync', '--deps', 'mac', '--jobs', '1'], | 427 ['sync', '--deps', 'mac', '--jobs', '1'], |
428 ['running', 'running', 'running', 'running'], | 428 ['running', 'running', 'running', 'running'], |
429 untangle=True) | 429 untangle=True) |
430 tree = self.mangle_svn_tree( | 430 tree = self.mangle_svn_tree( |
431 ('trunk/src@2', 'src'), | 431 ('trunk/src@2', 'src'), |
432 ('trunk/third_party/prout@2', 'src/third_party/foo'), | 432 ('trunk/third_party/prout@2', 'src/third_party/foo'), |
433 ('trunk/src/third_party@2', 'new_deps')) | 433 ('trunk/src/third_party@2', 'new_deps')) |
434 tree['src/svn_hooked1'] = 'svn_hooked1' | 434 tree['src/svn_hooked1'] = 'svn_hooked1' |
435 self.assertTree(tree) | 435 self.assertTree(tree) |
436 | 436 |
| 437 def testSyncCustomDepsNoDeps(self): |
| 438 if not self.enabled: |
| 439 return |
| 440 out = ( |
| 441 'solutions = [\n' |
| 442 # This directory has no DEPS file. |
| 443 ' { "name" : "src/third_party",\n' |
| 444 ' "url" : "%(base)s/src/third_party",\n' |
| 445 ' "custom_deps" : {\n' |
| 446 # Add 1. |
| 447 ' "src/other": \'/trunk/other\',\n' |
| 448 ' },\n' |
| 449 ' "safesync_url": "",\n' |
| 450 ' },\n' |
| 451 ']\n\n' % |
| 452 { 'base': self.svn_base + 'trunk' }) |
| 453 fileobj = open(os.path.join(self.root_dir, '.gclient'), 'w') |
| 454 fileobj.write(out) |
| 455 fileobj.close() |
| 456 self.parseGclient( |
| 457 ['sync', '--deps', 'mac', '--jobs', '1'], |
| 458 ['running', 'running'], |
| 459 untangle=True) |
| 460 tree = self.mangle_svn_tree( |
| 461 ('trunk/src/third_party@2', 'src/third_party'), |
| 462 ('trunk/other@2', 'src/other')) |
| 463 self.assertTree(tree) |
| 464 |
437 def testRevertAndStatus(self): | 465 def testRevertAndStatus(self): |
438 if not self.enabled: | 466 if not self.enabled: |
439 return | 467 return |
440 self.gclient(['config', self.svn_base + 'trunk/src/']) | 468 self.gclient(['config', self.svn_base + 'trunk/src/']) |
441 # Tested in testSync. | 469 # Tested in testSync. |
442 self.gclient(['sync', '--deps', 'mac']) | 470 self.gclient(['sync', '--deps', 'mac']) |
443 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!') | 471 write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!') |
444 | 472 |
445 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], | 473 out = self.parseGclient(['status', '--deps', 'mac', '--jobs', '1'], |
446 [['running', join(self.root_dir, 'src')], | 474 [['running', join(self.root_dir, 'src')], |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 if __name__ == '__main__': | 1160 if __name__ == '__main__': |
1133 if '-c' in sys.argv: | 1161 if '-c' in sys.argv: |
1134 COVERAGE = True | 1162 COVERAGE = True |
1135 sys.argv.remove('-c') | 1163 sys.argv.remove('-c') |
1136 if os.path.exists('.coverage'): | 1164 if os.path.exists('.coverage'): |
1137 os.remove('.coverage') | 1165 os.remove('.coverage') |
1138 os.environ['COVERAGE_FILE'] = os.path.join( | 1166 os.environ['COVERAGE_FILE'] = os.path.join( |
1139 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1167 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
1140 '.coverage') | 1168 '.coverage') |
1141 unittest.main() | 1169 unittest.main() |
OLD | NEW |