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 multiprocessing | 9 import multiprocessing |
10 import shutil | 10 import shutil |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 self.mox.VerifyAll() | 395 self.mox.VerifyAll() |
396 | 396 |
397 def doRsyncUpload(self, suffix): | 397 def doRsyncUpload(self, suffix): |
398 self.mox.StubOutWithMock(prebuilt, '_RetryRun') | 398 self.mox.StubOutWithMock(prebuilt, '_RetryRun') |
399 remote_path = '/dir/%s' % suffix.rstrip('/') | 399 remote_path = '/dir/%s' % suffix.rstrip('/') |
400 full_remote_path = 'chromeos-prebuilt:%s' % remote_path | 400 full_remote_path = 'chromeos-prebuilt:%s' % remote_path |
401 cmds = ['ssh chromeos-prebuilt mkdir -p %s' % remote_path, | 401 cmds = ['ssh chromeos-prebuilt mkdir -p %s' % remote_path, |
402 'rsync -av --chmod=a+r fake %s/Packages' % full_remote_path, | 402 'rsync -av --chmod=a+r fake %s/Packages' % full_remote_path, |
403 'rsync -Rav private.tbz2 %s/' % full_remote_path] | 403 'rsync -Rav private.tbz2 %s/' % full_remote_path] |
404 for cmd in cmds: | 404 for cmd in cmds: |
405 prebuilt._RetryRun(cmd, shell=True, cwd='/packages').AndReturn(True) | 405 prebuilt._RetryRun(cmd, cwd='/packages').AndReturn(True) |
406 self.mox.ReplayAll() | 406 self.mox.ReplayAll() |
407 uri = self.pkgindex.header['URI'] | 407 uri = self.pkgindex.header['URI'] |
408 uploader = prebuilt.PrebuiltUploader('chromeos-prebuilt:/dir', | 408 uploader = prebuilt.PrebuiltUploader('chromeos-prebuilt:/dir', |
409 'public-read', uri, []) | 409 'public-read', uri, []) |
410 uploader._UploadPrebuilt('/packages', suffix) | 410 uploader._UploadPrebuilt('/packages', suffix) |
411 | 411 |
412 def testSuccessfulGsUpload(self): | 412 def testSuccessfulGsUpload(self): |
413 uploads = {'/packages/private.tbz2': 'gs://foo/private.tbz2'} | 413 uploads = {'/packages/private.tbz2': 'gs://foo/private.tbz2'} |
414 self.mox.StubOutWithMock(prebuilt, 'GenerateUploadDict') | 414 self.mox.StubOutWithMock(prebuilt, 'GenerateUploadDict') |
415 prebuilt.GenerateUploadDict('/packages', 'gs://foo/suffix', | 415 prebuilt.GenerateUploadDict('/packages', 'gs://foo/suffix', |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 options.sync_binhost_conf) | 541 options.sync_binhost_conf) |
542 self.mox.StubOutWithMock(prebuilt.PrebuiltUploader, '_SyncBoardPrebuilts') | 542 self.mox.StubOutWithMock(prebuilt.PrebuiltUploader, '_SyncBoardPrebuilts') |
543 prebuilt.PrebuiltUploader._SyncBoardPrebuilts(options.board, | 543 prebuilt.PrebuiltUploader._SyncBoardPrebuilts(options.board, |
544 options.build_path, mox.IgnoreArg(), options.key, options.git_sync, | 544 options.build_path, mox.IgnoreArg(), options.key, options.git_sync, |
545 options.sync_binhost_conf, options.upload_board_tarball) | 545 options.sync_binhost_conf, options.upload_board_tarball) |
546 self.mox.ReplayAll() | 546 self.mox.ReplayAll() |
547 prebuilt.main() | 547 prebuilt.main() |
548 | 548 |
549 if __name__ == '__main__': | 549 if __name__ == '__main__': |
550 unittest.main() | 550 unittest.main() |
OLD | NEW |