| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 def testSync(self): | 258 def testSync(self): |
| 259 # TODO(maruel): safesync. | 259 # TODO(maruel): safesync. |
| 260 if not self.enabled: | 260 if not self.enabled: |
| 261 return | 261 return |
| 262 self.gclient(['config', self.svn_base + 'trunk/src/']) | 262 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 263 # Test unversioned checkout. | 263 # Test unversioned checkout. |
| 264 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], | 264 self.parseGclient(['sync', '--deps', 'mac', '--jobs', '1'], |
| 265 ['running', 'running', | 265 ['running', 'running', |
| 266 # This is due to the way svn update is called for a | 266 # This is due to the way svn update is called for a |
| 267 # single file when File() is used in a DEPS file. | 267 # single file when File() is used in a DEPS file. |
| 268 ('running', self.root_dir + '/src/file/other'), | 268 ('running', os.path.join(self.root_dir, 'src', 'file', 'o
ther')), |
| 269 'running', 'running', 'running', 'running']) | 269 'running', 'running', 'running', 'running']) |
| 270 tree = self.mangle_svn_tree( | 270 tree = self.mangle_svn_tree( |
| 271 ('trunk/src@2', 'src'), | 271 ('trunk/src@2', 'src'), |
| 272 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 272 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
| 273 ('trunk/other@2', 'src/other')) | 273 ('trunk/other@2', 'src/other')) |
| 274 tree['src/file/other/DEPS'] = ( | 274 tree['src/file/other/DEPS'] = ( |
| 275 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 275 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
| 276 tree['src/svn_hooked1'] = 'svn_hooked1' | 276 tree['src/svn_hooked1'] = 'svn_hooked1' |
| 277 self.assertTree(tree) | 277 self.assertTree(tree) |
| 278 | 278 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 """TODO(maruel): This will become an error soon.""" | 311 """TODO(maruel): This will become an error soon.""" |
| 312 if not self.enabled: | 312 if not self.enabled: |
| 313 return | 313 return |
| 314 self.gclient(['config', self.svn_base + 'trunk/src/']) | 314 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 315 results = self.gclient( | 315 results = self.gclient( |
| 316 ['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1']) | 316 ['sync', '--deps', 'mac', '-r', 'invalid@1', '--jobs', '1']) |
| 317 self.checkBlock(results[0], [ | 317 self.checkBlock(results[0], [ |
| 318 'running', 'running', | 318 'running', 'running', |
| 319 # This is due to the way svn update is called for a single file when | 319 # This is due to the way svn update is called for a single file when |
| 320 # File() is used in a DEPS file. | 320 # File() is used in a DEPS file. |
| 321 ('running', self.root_dir + '/src/file/other'), | 321 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), |
| 322 'running', 'running', 'running', 'running']) | 322 'running', 'running', 'running', 'running']) |
| 323 self.checkString('Please fix your script, having invalid --revision flags ' | 323 self.checkString('Please fix your script, having invalid --revision flags ' |
| 324 'will soon considered an error.\n', results[1]) | 324 'will soon considered an error.\n', results[1]) |
| 325 self.assertEquals(0, results[2]) | 325 self.assertEquals(0, results[2]) |
| 326 tree = self.mangle_svn_tree( | 326 tree = self.mangle_svn_tree( |
| 327 ('trunk/src@2', 'src'), | 327 ('trunk/src@2', 'src'), |
| 328 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 328 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
| 329 ('trunk/other@2', 'src/other')) | 329 ('trunk/other@2', 'src/other')) |
| 330 tree['src/file/other/DEPS'] = ( | 330 tree['src/file/other/DEPS'] = ( |
| 331 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 331 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 350 if not self.enabled: | 350 if not self.enabled: |
| 351 return | 351 return |
| 352 # TODO(maruel): safesync. | 352 # TODO(maruel): safesync. |
| 353 self.gclient(['config', self.svn_base + 'trunk/src/']) | 353 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 354 # Test unversioned checkout. | 354 # Test unversioned checkout. |
| 355 self.parseGclient( | 355 self.parseGclient( |
| 356 ['sync', '--deps', 'mac', '--jobs', '8'], | 356 ['sync', '--deps', 'mac', '--jobs', '8'], |
| 357 ['running', 'running', | 357 ['running', 'running', |
| 358 # This is due to the way svn update is called for a | 358 # This is due to the way svn update is called for a |
| 359 # single file when File() is used in a DEPS file. | 359 # single file when File() is used in a DEPS file. |
| 360 ('running', self.root_dir + '/src/file/other'), | 360 ('running', os.path.join(self.root_dir, 'src', 'file', 'other')), |
| 361 'running', 'running', 'running', 'running'], | 361 'running', 'running', 'running', 'running'], |
| 362 untangle=True) | 362 untangle=True) |
| 363 tree = self.mangle_svn_tree( | 363 tree = self.mangle_svn_tree( |
| 364 ('trunk/src@2', 'src'), | 364 ('trunk/src@2', 'src'), |
| 365 ('trunk/third_party/foo@1', 'src/third_party/foo'), | 365 ('trunk/third_party/foo@1', 'src/third_party/foo'), |
| 366 ('trunk/other@2', 'src/other')) | 366 ('trunk/other@2', 'src/other')) |
| 367 tree['src/file/other/DEPS'] = ( | 367 tree['src/file/other/DEPS'] = ( |
| 368 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) | 368 self.FAKE_REPOS.svn_revs[2]['trunk/other/DEPS']) |
| 369 tree['src/svn_hooked1'] = 'svn_hooked1' | 369 tree['src/svn_hooked1'] = 'svn_hooked1' |
| 370 self.assertTree(tree) | 370 self.assertTree(tree) |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 def testInitialCheckoutNotYetDone(self): | 597 def testInitialCheckoutNotYetDone(self): |
| 598 # Check that gclient can be executed when the initial checkout hasn't been | 598 # Check that gclient can be executed when the initial checkout hasn't been |
| 599 # done yet. | 599 # done yet. |
| 600 if not self.enabled: | 600 if not self.enabled: |
| 601 return | 601 return |
| 602 self.gclient(['config', self.svn_base + 'trunk/src/']) | 602 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 603 self.parseGclient(['sync', '--jobs', '1'], | 603 self.parseGclient(['sync', '--jobs', '1'], |
| 604 ['running', 'running', | 604 ['running', 'running', |
| 605 # This is due to the way svn update is called for a | 605 # This is due to the way svn update is called for a |
| 606 # single file when File() is used in a DEPS file. | 606 # single file when File() is used in a DEPS file. |
| 607 ('running', self.root_dir + '/src/file/other'), | 607 ('running', os.path.join(self.root_dir, 'src', 'file', 'o
ther')), |
| 608 'running', 'running', 'running', 'running']) | 608 'running', 'running', 'running', 'running']) |
| 609 | 609 |
| 610 def testInitialCheckoutFailed(self): | 610 def testInitialCheckoutFailed(self): |
| 611 # Check that gclient can be executed from an arbitrary sub directory if the | 611 # Check that gclient can be executed from an arbitrary sub directory if the |
| 612 # initial checkout has failed. | 612 # initial checkout has failed. |
| 613 if not self.enabled: | 613 if not self.enabled: |
| 614 return | 614 return |
| 615 self.gclient(['config', self.svn_base + 'trunk/src/']) | 615 self.gclient(['config', self.svn_base + 'trunk/src/']) |
| 616 self.gclient(['sync']) | 616 self.gclient(['sync']) |
| 617 # Cripple the checkout. | 617 # Cripple the checkout. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 if __name__ == '__main__': | 1100 if __name__ == '__main__': |
| 1101 if '-c' in sys.argv: | 1101 if '-c' in sys.argv: |
| 1102 COVERAGE = True | 1102 COVERAGE = True |
| 1103 sys.argv.remove('-c') | 1103 sys.argv.remove('-c') |
| 1104 if os.path.exists('.coverage'): | 1104 if os.path.exists('.coverage'): |
| 1105 os.remove('.coverage') | 1105 os.remove('.coverage') |
| 1106 os.environ['COVERAGE_FILE'] = os.path.join( | 1106 os.environ['COVERAGE_FILE'] = os.path.join( |
| 1107 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | 1107 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), |
| 1108 '.coverage') | 1108 '.coverage') |
| 1109 unittest.main() | 1109 unittest.main() |
| OLD | NEW |