OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import collections | 6 import collections |
7 import imp | 7 import imp |
8 import json | 8 import json |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 | 488 |
489 def test_001_simple(self): | 489 def test_001_simple(self): |
490 """Tests a git solution with git-style DEPS, and no .DEPS.git.""" | 490 """Tests a git solution with git-style DEPS, and no .DEPS.git.""" |
491 solution = { | 491 solution = { |
492 'name': 'top', | 492 'name': 'top', |
493 'url': '%s/BotUpdateTest/test_001_simple/top.git' % self.git_server.url, | 493 'url': '%s/BotUpdateTest/test_001_simple/top.git' % self.git_server.url, |
494 'deps_file': 'DEPS' | 494 'deps_file': 'DEPS' |
495 } | 495 } |
496 gclient_spec = 'solutions=[%r]' % solution | 496 gclient_spec = 'solutions=[%r]' % solution |
497 self.bu_args.extend([ | 497 self.bu_args.extend([ |
498 '--post-flag-day', | |
499 '--specs', gclient_spec, | 498 '--specs', gclient_spec, |
500 '--revision', self.template_dict['top_revision_0']]) | 499 '--revision', self.template_dict['top_revision_0']]) |
501 result = self.run_bot_update() | 500 result = self.run_bot_update() |
502 if bool(result.status): | 501 if bool(result.status): |
503 self.dump_subproc(result) | 502 self.dump_subproc(result) |
504 self.fail('bot_update.py failed') | 503 self.fail('bot_update.py failed') |
505 expected_files = [ | 504 expected_files = [ |
506 'DEPS', | 505 'DEPS', |
507 'file1.txt', | 506 'file1.txt', |
508 'ext/dep1/path1/file1.txt', | 507 'ext/dep1/path1/file1.txt', |
509 'ext/dep2/path1/file1.txt', | 508 'ext/dep2/path1/file1.txt', |
510 'ext/dep2/path2/file2.txt', | 509 'ext/dep2/path2/file2.txt', |
511 ] | 510 ] |
512 topdir = os.path.join(self.builddir, 'top') | 511 topdir = os.path.join(self.builddir, 'top') |
513 self.assertItemsEqual(expected_files, self.get_files(topdir)) | 512 self.assertItemsEqual(expected_files, self.get_files(topdir)) |
514 expected_json = { | 513 expected_json = { |
515 'root': 'top', | 514 'root': 'top', |
516 'properties': {}, | 515 'properties': {'got_revision': self.template_dict['top_revision_0']}, |
Michael Achenbach
2014/10/10 07:31:39
Can't say much about this...
| |
517 'did_run': True, | 516 'did_run': True, |
518 'patch_root': None | 517 'patch_root': None |
519 } | 518 } |
520 with open(os.path.join(self.builddir, 'out.json')) as fh: | 519 with open(os.path.join(self.builddir, 'out.json')) as fh: |
521 actual_json = json.load(fh) | 520 actual_json = json.load(fh) |
522 self.assertDictContainsSubset(expected_json, actual_json) | 521 self.assertDictContainsSubset(expected_json, actual_json) |
523 | 522 |
524 def test_002_svn(self): | 523 def test_002_svn(self): |
525 """Tests an svn-based solution with svn DEPS and git .DEPS.git.""" | 524 """Tests an svn-based solution with svn DEPS and git .DEPS.git.""" |
526 solution = { | 525 solution = { |
(...skipping 18 matching lines...) Expand all Loading... | |
545 '.DEPS.git', | 544 '.DEPS.git', |
546 'file1.txt', | 545 'file1.txt', |
547 'ext/dep1/path1/file1.txt', | 546 'ext/dep1/path1/file1.txt', |
548 'ext/dep2/path1/file1.txt', | 547 'ext/dep2/path1/file1.txt', |
549 'ext/dep2/path2/file2.txt', | 548 'ext/dep2/path2/file2.txt', |
550 ] | 549 ] |
551 topdir = os.path.join(self.builddir, 'top') | 550 topdir = os.path.join(self.builddir, 'top') |
552 self.assertItemsEqual(expected_files, self.get_files(topdir)) | 551 self.assertItemsEqual(expected_files, self.get_files(topdir)) |
553 expected_json = { | 552 expected_json = { |
554 'root': 'top', | 553 'root': 'top', |
555 'properties': {}, | 554 'properties': {'got_revision': self.template_dict['top_revision_1']}, |
556 'did_run': True, | 555 'did_run': True, |
557 'patch_root': None | 556 'patch_root': None |
558 } | 557 } |
559 with open(os.path.join(self.builddir, 'out.json')) as fh: | 558 with open(os.path.join(self.builddir, 'out.json')) as fh: |
560 actual_json = json.load(fh) | 559 actual_json = json.load(fh) |
561 self.assertDictContainsSubset(expected_json, actual_json) | 560 self.assertDictContainsSubset(expected_json, actual_json) |
562 | 561 |
563 def test_003_patch(self): | 562 def test_003_patch(self): |
564 '''Git solution with rietveld issue applied.''' | 563 '''Git solution with rietveld issue applied.''' |
565 top_workdir = os.path.join(self.workdir, 'top_patch') | 564 top_workdir = os.path.join(self.workdir, 'top_patch') |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
608 'file1.txt', | 607 'file1.txt', |
609 'patched_file.txt', | 608 'patched_file.txt', |
610 'ext/dep1/path1/file1.txt', | 609 'ext/dep1/path1/file1.txt', |
611 'ext/dep2/path1/file1.txt', | 610 'ext/dep2/path1/file1.txt', |
612 'ext/dep2/path2/file2.txt', | 611 'ext/dep2/path2/file2.txt', |
613 ] | 612 ] |
614 topdir = os.path.join(self.builddir, 'top') | 613 topdir = os.path.join(self.builddir, 'top') |
615 self.assertItemsEqual(expected_files, self.get_files(topdir)) | 614 self.assertItemsEqual(expected_files, self.get_files(topdir)) |
616 expected_json = { | 615 expected_json = { |
617 'root': 'top', | 616 'root': 'top', |
618 'properties': {}, | 617 'properties': {'got_revision': self.template_dict['top_revision_1']}, |
619 'did_run': True, | 618 'did_run': True, |
620 'patch_root': 'top' | 619 'patch_root': 'top' |
621 } | 620 } |
622 with open(os.path.join(self.builddir, 'out.json')) as fh: | 621 with open(os.path.join(self.builddir, 'out.json')) as fh: |
623 actual_json = json.load(fh) | 622 actual_json = json.load(fh) |
624 self.assertDictContainsSubset(expected_json, actual_json) | 623 self.assertDictContainsSubset(expected_json, actual_json) |
625 | 624 |
626 if __name__ == '__main__': | 625 if __name__ == '__main__': |
627 unittest.main() | 626 unittest.main() |
OLD | NEW |