| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 CHANGELOG_FILE: None, | 52 CHANGELOG_FILE: None, |
| 53 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", | 53 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", |
| 54 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", | 54 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", |
| 55 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", | 55 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", |
| 56 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", | 56 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", |
| 57 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", | 57 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", |
| 58 SETTINGS_LOCATION: None, | 58 SETTINGS_LOCATION: None, |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None, | 62 def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None, a=None, |
| 63 status_password=None): | 63 status_password=None): |
| 64 """Convenience wrapper.""" | 64 """Convenience wrapper.""" |
| 65 class Options(object): | 65 class Options(object): |
| 66 pass | 66 pass |
| 67 options = Options() | 67 options = Options() |
| 68 options.s = s | 68 options.s = s |
| 69 options.l = l | 69 options.l = l |
| 70 options.f = f | 70 options.f = f |
| 71 options.m = m | 71 options.m = m |
| 72 options.r = r | 72 options.r = r |
| 73 options.c = c | 73 options.c = c |
| 74 options.a = a |
| 74 options.status_password = status_password | 75 options.status_password = status_password |
| 75 return options | 76 return options |
| 76 | 77 |
| 77 | 78 |
| 78 class ToplevelTest(unittest.TestCase): | 79 class ToplevelTest(unittest.TestCase): |
| 79 def testMakeComment(self): | 80 def testMakeComment(self): |
| 80 self.assertEquals("# Line 1\n# Line 2\n#", | 81 self.assertEquals("# Line 1\n# Line 2\n#", |
| 81 MakeComment(" Line 1\n Line 2\n")) | 82 MakeComment(" Line 1\n Line 2\n")) |
| 82 self.assertEquals("#Line 1\n#Line 2", | 83 self.assertEquals("#Line 1\n#Line 2", |
| 83 MakeComment("Line 1\n Line 2")) | 84 MakeComment("Line 1\n Line 2")) |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 ["log -1 --format=%H ChangeLog", "1234\n"], | 667 ["log -1 --format=%H ChangeLog", "1234\n"], |
| 667 ["log -1 1234", "Last push ouput\n"], | 668 ["log -1 1234", "Last push ouput\n"], |
| 668 ["log 1234..HEAD --format=%H", "rev1\n"], | 669 ["log 1234..HEAD --format=%H", "rev1\n"], |
| 669 ["log -1 rev1 --format=\"%s\"", "Log text 1.\n"], | 670 ["log -1 rev1 --format=\"%s\"", "Log text 1.\n"], |
| 670 ["log -1 rev1 --format=\"%B\"", "Text\nLOG=YES\nBUG=v8:321\nText\n"], | 671 ["log -1 rev1 --format=\"%B\"", "Text\nLOG=YES\nBUG=v8:321\nText\n"], |
| 671 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org\n"], | 672 ["log -1 rev1 --format=\"%an\"", "author1@chromium.org\n"], |
| 672 [("commit -a -m \"Prepare push to trunk. " | 673 [("commit -a -m \"Prepare push to trunk. " |
| 673 "Now working on version 3.22.6.%s\"" % review_suffix), | 674 "Now working on version 3.22.6.%s\"" % review_suffix), |
| 674 " 2 files changed\n", | 675 " 2 files changed\n", |
| 675 CheckPreparePush], | 676 CheckPreparePush], |
| 676 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag, | 677 [("cl upload --email \"author@chromium.org\" " |
| 678 "-r \"reviewer@chromium.org\" --send-mail%s" % force_flag), |
| 677 "done\n"], | 679 "done\n"], |
| 678 ["cl presubmit", "Presubmit successfull\n"], | 680 ["cl presubmit", "Presubmit successfull\n"], |
| 679 ["cl dcommit -f --bypass-hooks", "Closing issue\n"], | 681 ["cl dcommit -f --bypass-hooks", "Closing issue\n"], |
| 680 ["svn fetch", "fetch result\n"], | 682 ["svn fetch", "fetch result\n"], |
| 681 ["checkout svn/bleeding_edge", ""], | 683 ["checkout svn/bleeding_edge", ""], |
| 682 [("log -1 --format=%H --grep=\"Prepare push to trunk. " | 684 [("log -1 --format=%H --grep=\"Prepare push to trunk. " |
| 683 "Now working on version 3.22.6.\""), | 685 "Now working on version 3.22.6.\""), |
| 684 "hash1\n"], | 686 "hash1\n"], |
| 685 ["diff svn/trunk hash1", "patch content\n"], | 687 ["diff svn/trunk hash1", "patch content\n"], |
| 686 ["svn find-rev hash1", "123455\n"], | 688 ["svn find-rev hash1", "123455\n"], |
| 687 ["checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""], | 689 ["checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""], |
| 688 ["apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""], | 690 ["apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""], |
| 689 ["add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""], | 691 ["add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""], |
| 690 ["commit -F \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", CheckSVNCommit], | 692 ["commit -F \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", CheckSVNCommit], |
| 691 ["svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"], | 693 ["svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"], |
| 692 ["svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""], | 694 ["svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""], |
| 693 ["status -s -uno", ""], | 695 ["status -s -uno", ""], |
| 694 ["checkout master", ""], | 696 ["checkout master", ""], |
| 695 ["pull", ""], | 697 ["pull", ""], |
| 696 ["checkout -b v8-roll-123456", ""], | 698 ["checkout -b v8-roll-123456", ""], |
| 697 [("commit -am \"Update V8 to version 3.22.5 " | 699 [("commit -am \"Update V8 to version 3.22.5 " |
| 698 "(based on bleeding_edge revision r123455).\n\n" | 700 "(based on bleeding_edge revision r123455).\n\n" |
| 699 "TBR=reviewer@chromium.org\""), | 701 "TBR=reviewer@chromium.org\""), |
| 700 ""], | 702 ""], |
| 701 ["cl upload --send-mail%s" % force_flag, ""], | 703 ["cl upload --email \"author@chromium.org\" --send-mail%s" % force_flag, |
| 704 ""], |
| 702 ["checkout -f some_branch", ""], | 705 ["checkout -f some_branch", ""], |
| 703 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 706 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
| 704 ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""], | 707 ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""], |
| 705 ["branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""], | 708 ["branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""], |
| 706 ]) | 709 ]) |
| 707 | 710 |
| 708 # Expected keyboard input in manual mode: | 711 # Expected keyboard input in manual mode: |
| 709 if manual: | 712 if manual: |
| 710 self.ExpectReadline([ | 713 self.ExpectReadline([ |
| 711 "Y", # Confirm last push. | 714 "Y", # Confirm last push. |
| 712 "", # Open editor. | 715 "", # Open editor. |
| 713 "Y", # Increment build number. | 716 "Y", # Increment build number. |
| 714 "reviewer@chromium.org", # V8 reviewer. | 717 "reviewer@chromium.org", # V8 reviewer. |
| 715 "LGTX", # Enter LGTM for V8 CL (wrong). | 718 "LGTX", # Enter LGTM for V8 CL (wrong). |
| 716 "LGTM", # Enter LGTM for V8 CL. | 719 "LGTM", # Enter LGTM for V8 CL. |
| 717 "Y", # Sanity check. | 720 "Y", # Sanity check. |
| 718 "reviewer@chromium.org", # Chromium reviewer. | 721 "reviewer@chromium.org", # Chromium reviewer. |
| 719 ]) | 722 ]) |
| 720 | 723 |
| 721 # Expected keyboard input in semi-automatic mode: | 724 # Expected keyboard input in semi-automatic mode: |
| 722 if not manual and not force: | 725 if not manual and not force: |
| 723 self.ExpectReadline([ | 726 self.ExpectReadline([ |
| 724 "LGTM", # Enter LGTM for V8 CL. | 727 "LGTM", # Enter LGTM for V8 CL. |
| 725 ]) | 728 ]) |
| 726 | 729 |
| 727 # No keyboard input in forced mode: | 730 # No keyboard input in forced mode: |
| 728 if force: | 731 if force: |
| 729 self.ExpectReadline([]) | 732 self.ExpectReadline([]) |
| 730 | 733 |
| 731 options = MakeOptions(f=force, m=manual, | 734 options = MakeOptions(f=force, m=manual, a="author@chromium.org", |
| 732 r="reviewer@chromium.org" if not manual else None, | 735 r="reviewer@chromium.org" if not manual else None, |
| 733 c = TEST_CONFIG[CHROMIUM]) | 736 c = TEST_CONFIG[CHROMIUM]) |
| 734 RunPushToTrunk(TEST_CONFIG, PushToTrunkOptions(options), self) | 737 RunPushToTrunk(TEST_CONFIG, PushToTrunkOptions(options), self) |
| 735 | 738 |
| 736 deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 739 deps = FileToText(TEST_CONFIG[DEPS_FILE]) |
| 737 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 740 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) |
| 738 | 741 |
| 739 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 742 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 740 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 743 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
| 741 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) | 744 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 852 |
| 850 Review URL: https://codereview.chromium.org/83173002 | 853 Review URL: https://codereview.chromium.org/83173002 |
| 851 | 854 |
| 852 ------------------------------------------------------------------------""") | 855 ------------------------------------------------------------------------""") |
| 853 self.assertEquals( | 856 self.assertEquals( |
| 854 """Prepare push to trunk. Now working on version 3.23.11. | 857 """Prepare push to trunk. Now working on version 3.23.11. |
| 855 | 858 |
| 856 R=danno@chromium.org | 859 R=danno@chromium.org |
| 857 | 860 |
| 858 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 861 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
| OLD | NEW |