| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS 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 import copy | 6 import copy |
| 7 import mox | 7 import mox |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import sys | 10 import sys |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 self.mox.VerifyAll() | 394 self.mox.VerifyAll() |
| 395 | 395 |
| 396 def doRsyncUpload(self, suffix): | 396 def doRsyncUpload(self, suffix): |
| 397 self.mox.StubOutWithMock(prebuilt, '_RetryRun') | 397 self.mox.StubOutWithMock(prebuilt, '_RetryRun') |
| 398 remote_path = '/dir/%s' % suffix.rstrip('/') | 398 remote_path = '/dir/%s' % suffix.rstrip('/') |
| 399 full_remote_path = 'chromeos-prebuilt:%s' % remote_path | 399 full_remote_path = 'chromeos-prebuilt:%s' % remote_path |
| 400 cmds = ['ssh chromeos-prebuilt mkdir -p %s' % remote_path, | 400 cmds = ['ssh chromeos-prebuilt mkdir -p %s' % remote_path, |
| 401 'rsync -av --chmod=a+r fake %s/Packages' % full_remote_path, | 401 'rsync -av --chmod=a+r fake %s/Packages' % full_remote_path, |
| 402 'rsync -Rav private.tbz2 %s/' % full_remote_path] | 402 'rsync -Rav private.tbz2 %s/' % full_remote_path] |
| 403 for cmd in cmds: | 403 for cmd in cmds: |
| 404 prebuilt._RetryRun(cmd, shell=True, cwd='/packages').AndReturn(True) | 404 prebuilt._RetryRun(cmd, cwd='/packages').AndReturn(True) |
| 405 self.mox.ReplayAll() | 405 self.mox.ReplayAll() |
| 406 uri = self.pkgindex.header['URI'] | 406 uri = self.pkgindex.header['URI'] |
| 407 uploader = prebuilt.PrebuiltUploader('chromeos-prebuilt:/dir', | 407 uploader = prebuilt.PrebuiltUploader('chromeos-prebuilt:/dir', |
| 408 'public-read', uri, []) | 408 'public-read', uri, []) |
| 409 uploader._UploadPrebuilt('/packages', suffix) | 409 uploader._UploadPrebuilt('/packages', suffix) |
| 410 | 410 |
| 411 def testSuccessfulGsUpload(self): | 411 def testSuccessfulGsUpload(self): |
| 412 uploads = {'/packages/private.tbz2': 'gs://foo/private.tbz2'} | 412 uploads = {'/packages/private.tbz2': 'gs://foo/private.tbz2'} |
| 413 self.mox.StubOutWithMock(prebuilt, 'GenerateUploadDict') | 413 self.mox.StubOutWithMock(prebuilt, 'GenerateUploadDict') |
| 414 prebuilt.GenerateUploadDict('/packages', 'gs://foo/suffix', | 414 prebuilt.GenerateUploadDict('/packages', 'gs://foo/suffix', |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 options.sync_binhost_conf) | 525 options.sync_binhost_conf) |
| 526 self.mox.StubOutWithMock(prebuilt.PrebuiltUploader, '_SyncBoardPrebuilts') | 526 self.mox.StubOutWithMock(prebuilt.PrebuiltUploader, '_SyncBoardPrebuilts') |
| 527 prebuilt.PrebuiltUploader._SyncBoardPrebuilts(options.board, | 527 prebuilt.PrebuiltUploader._SyncBoardPrebuilts(options.board, |
| 528 options.build_path, mox.IgnoreArg(), options.key, options.git_sync, | 528 options.build_path, mox.IgnoreArg(), options.key, options.git_sync, |
| 529 options.sync_binhost_conf) | 529 options.sync_binhost_conf) |
| 530 self.mox.ReplayAll() | 530 self.mox.ReplayAll() |
| 531 prebuilt.main() | 531 prebuilt.main() |
| 532 | 532 |
| 533 if __name__ == '__main__': | 533 if __name__ == '__main__': |
| 534 unittest.main() | 534 unittest.main() |
| OLD | NEW |