| 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 23 matching lines...) Expand all  Loading... | 
| 34 import auto_roll | 34 import auto_roll | 
| 35 from auto_roll import CheckLastPush | 35 from auto_roll import CheckLastPush | 
| 36 from auto_roll import FetchLatestRevision | 36 from auto_roll import FetchLatestRevision | 
| 37 from auto_roll import SETTINGS_LOCATION | 37 from auto_roll import SETTINGS_LOCATION | 
| 38 import common_includes | 38 import common_includes | 
| 39 from common_includes import * | 39 from common_includes import * | 
| 40 import merge_to_branch | 40 import merge_to_branch | 
| 41 from merge_to_branch import * | 41 from merge_to_branch import * | 
| 42 import push_to_trunk | 42 import push_to_trunk | 
| 43 from push_to_trunk import * | 43 from push_to_trunk import * | 
|  | 44 import chromium_roll | 
|  | 45 from chromium_roll import CHROMIUM | 
|  | 46 from chromium_roll import DEPS_FILE | 
|  | 47 from chromium_roll import ChromiumRoll | 
| 44 | 48 | 
| 45 | 49 | 
| 46 TEST_CONFIG = { | 50 TEST_CONFIG = { | 
| 47   BRANCHNAME: "test-prepare-push", | 51   BRANCHNAME: "test-prepare-push", | 
| 48   TRUNKBRANCH: "test-trunk-push", | 52   TRUNKBRANCH: "test-trunk-push", | 
| 49   PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile", | 53   PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile", | 
| 50   TEMP_BRANCH: "test-prepare-push-temporary-branch-created-by-script", | 54   TEMP_BRANCH: "test-prepare-push-temporary-branch-created-by-script", | 
| 51   DOT_GIT_LOCATION: None, | 55   DOT_GIT_LOCATION: None, | 
| 52   VERSION_FILE: None, | 56   VERSION_FILE: None, | 
| 53   CHANGELOG_FILE: None, | 57   CHANGELOG_FILE: None, | 
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 621   def _PushToTrunk(self, force=False, manual=False): | 625   def _PushToTrunk(self, force=False, manual=False): | 
| 622     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 626     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 
| 623 | 627 | 
| 624     # The version file on bleeding edge has build level 5, while the version | 628     # The version file on bleeding edge has build level 5, while the version | 
| 625     # file from trunk has build level 4. | 629     # file from trunk has build level 4. | 
| 626     TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 630     TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() | 
| 627     self.WriteFakeVersionFile(build=5) | 631     self.WriteFakeVersionFile(build=5) | 
| 628 | 632 | 
| 629     TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 633     TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() | 
| 630     TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 634     TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() | 
| 631     if not os.path.exists(TEST_CONFIG[CHROMIUM]): |  | 
| 632       os.makedirs(TEST_CONFIG[CHROMIUM]) |  | 
| 633     bleeding_edge_change_log = "2014-03-17: Sentinel\n" | 635     bleeding_edge_change_log = "2014-03-17: Sentinel\n" | 
| 634     TextToFile(bleeding_edge_change_log, TEST_CONFIG[CHANGELOG_FILE]) | 636     TextToFile(bleeding_edge_change_log, TEST_CONFIG[CHANGELOG_FILE]) | 
| 635     TextToFile("Some line\n   \"v8_revision\": \"123444\",\n  some line", |  | 
| 636                  TEST_CONFIG[DEPS_FILE]) |  | 
| 637     os.environ["EDITOR"] = "vi" | 637     os.environ["EDITOR"] = "vi" | 
| 638 | 638 | 
| 639     def CheckPreparePush(): | 639     def CheckPreparePush(): | 
| 640       self.assertEquals(bleeding_edge_change_log, | 640       self.assertEquals(bleeding_edge_change_log, | 
| 641                         FileToText(TEST_CONFIG[CHANGELOG_FILE])) | 641                         FileToText(TEST_CONFIG[CHANGELOG_FILE])) | 
| 642 | 642 | 
| 643       version = FileToText(TEST_CONFIG[VERSION_FILE]) | 643       version = FileToText(TEST_CONFIG[VERSION_FILE]) | 
| 644       self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) | 644       self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) | 
| 645 | 645 | 
| 646     def ResetChangeLog(): | 646     def ResetChangeLog(): | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 679 | 679 | 
| 680         Performance and stability improvements on all platforms. | 680         Performance and stability improvements on all platforms. | 
| 681 | 681 | 
| 682 | 682 | 
| 683 1999-04-05: Version 3.22.4 | 683 1999-04-05: Version 3.22.4 | 
| 684 | 684 | 
| 685         Performance and stability improvements on all platforms.\n""", | 685         Performance and stability improvements on all platforms.\n""", | 
| 686           change_log) | 686           change_log) | 
| 687 | 687 | 
| 688     force_flag = " -f" if not manual else "" | 688     force_flag = " -f" if not manual else "" | 
| 689     review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" |  | 
| 690     self.ExpectGit([ | 689     self.ExpectGit([ | 
| 691       Git("status -s -uno", ""), | 690       Git("status -s -uno", ""), | 
| 692       Git("status -s -b -uno", "## some_branch\n"), | 691       Git("status -s -b -uno", "## some_branch\n"), | 
| 693       Git("svn fetch", ""), | 692       Git("svn fetch", ""), | 
| 694       Git("branch", "  branch1\n* branch2\n"), | 693       Git("branch", "  branch1\n* branch2\n"), | 
| 695       Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 694       Git("checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 
| 696       Git("branch", "  branch1\n* branch2\n"), | 695       Git("branch", "  branch1\n* branch2\n"), | 
| 697       Git("branch", "  branch1\n* branch2\n"), | 696       Git("branch", "  branch1\n* branch2\n"), | 
| 698       Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""), | 697       Git("checkout -b %s svn/bleeding_edge" % TEST_CONFIG[BRANCHNAME], ""), | 
| 699       Git(("log -1 --format=%H --grep=" | 698       Git(("log -1 --format=%H --grep=" | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 718           cb=ResetToTrunk), | 717           cb=ResetToTrunk), | 
| 719       Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), | 718       Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""), | 
| 720       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[CHANGELOG_FILE], "", | 719       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[CHANGELOG_FILE], "", | 
| 721           cb=ResetChangeLog), | 720           cb=ResetChangeLog), | 
| 722       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[VERSION_FILE], "", | 721       Git("checkout -f svn/trunk -- %s" % TEST_CONFIG[VERSION_FILE], "", | 
| 723           cb=self.WriteFakeVersionFile), | 722           cb=self.WriteFakeVersionFile), | 
| 724       Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", | 723       Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", | 
| 725           cb=CheckSVNCommit), | 724           cb=CheckSVNCommit), | 
| 726       Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"), | 725       Git("svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"), | 
| 727       Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), | 726       Git("svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""), | 
| 728       Git("status -s -uno", ""), |  | 
| 729       Git("checkout -f master", ""), |  | 
| 730       Git("pull", ""), |  | 
| 731       Git("checkout -b v8-roll-123456", ""), |  | 
| 732       Git(("commit -am \"Update V8 to version 3.22.5 " |  | 
| 733            "(based on bleeding_edge revision r123455).\n\n" |  | 
| 734            "TBR=reviewer@chromium.org\""), |  | 
| 735           ""), |  | 
| 736       Git(("cl upload --send-mail --email \"author@chromium.org\"%s" |  | 
| 737            % force_flag), ""), |  | 
| 738       Git("checkout -f some_branch", ""), | 727       Git("checkout -f some_branch", ""), | 
| 739       Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 728       Git("branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""), | 
| 740       Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 729       Git("branch -D %s" % TEST_CONFIG[BRANCHNAME], ""), | 
| 741       Git("branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""), | 730       Git("branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""), | 
| 742     ]) | 731     ]) | 
| 743 | 732 | 
| 744     # Expected keyboard input in manual mode: | 733     # Expected keyboard input in manual mode: | 
| 745     if manual: | 734     if manual: | 
| 746       self.ExpectReadline([ | 735       self.ExpectReadline([ | 
| 747         RL("Y"),  # Confirm last push. | 736         RL("Y"),  # Confirm last push. | 
| 748         RL(""),  # Open editor. | 737         RL(""),  # Open editor. | 
| 749         RL("Y"),  # Increment build number. | 738         RL("Y"),  # Increment build number. | 
| 750         RL("Y"),  # Sanity check. | 739         RL("Y"),  # Sanity check. | 
| 751         RL("reviewer@chromium.org"),  # Chromium reviewer. |  | 
| 752       ]) | 740       ]) | 
| 753 | 741 | 
| 754     # Expected keyboard input in semi-automatic mode and forced mode: | 742     # Expected keyboard input in semi-automatic mode and forced mode: | 
| 755     if not manual: | 743     if not manual: | 
| 756       self.ExpectReadline([]) | 744       self.ExpectReadline([]) | 
| 757 | 745 | 
| 758     args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM]] | 746     args = ["-a", "author@chromium.org"] | 
| 759     if force: args.append("-f") | 747     if force: args.append("-f") | 
| 760     if manual: args.append("-m") | 748     if manual: args.append("-m") | 
| 761     else: args += ["-r", "reviewer@chromium.org"] | 749     else: args += ["-r", "reviewer@chromium.org"] | 
| 762     PushToTrunk(TEST_CONFIG, self).Run(args) | 750     PushToTrunk(TEST_CONFIG, self).Run(args) | 
| 763 | 751 | 
| 764     deps = FileToText(TEST_CONFIG[DEPS_FILE]) |  | 
| 765     self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) |  | 
| 766 |  | 
| 767     cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 752     cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 
| 768     self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 753     self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 
| 769     self.assertTrue(re.search(r"        Log text 1 \(issue 321\).", cl)) | 754     self.assertTrue(re.search(r"        Log text 1 \(issue 321\).", cl)) | 
| 770     self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 755     self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 
| 771 | 756 | 
| 772     # Note: The version file is on build number 5 again in the end of this test | 757     # Note: The version file is on build number 5 again in the end of this test | 
| 773     # since the git command that merges to the bleeding edge branch is mocked | 758     # since the git command that merges to the bleeding edge branch is mocked | 
| 774     # out. | 759     # out. | 
| 775 | 760 | 
| 776   def testPushToTrunkManual(self): | 761   def testPushToTrunkManual(self): | 
| 777     self._PushToTrunk(manual=True) | 762     self._PushToTrunk(manual=True) | 
| 778 | 763 | 
| 779   def testPushToTrunkSemiAutomatic(self): | 764   def testPushToTrunkSemiAutomatic(self): | 
| 780     self._PushToTrunk() | 765     self._PushToTrunk() | 
| 781 | 766 | 
| 782   def testPushToTrunkForced(self): | 767   def testPushToTrunkForced(self): | 
| 783     self._PushToTrunk(force=True) | 768     self._PushToTrunk(force=True) | 
| 784 | 769 | 
|  | 770 | 
|  | 771   def _ChromiumRoll(self, force=False, manual=False): | 
|  | 772     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 
|  | 773     if not os.path.exists(TEST_CONFIG[CHROMIUM]): | 
|  | 774       os.makedirs(TEST_CONFIG[CHROMIUM]) | 
|  | 775     TextToFile("Some line\n   \"v8_revision\": \"123444\",\n  some line", | 
|  | 776                TEST_CONFIG[DEPS_FILE]) | 
|  | 777 | 
|  | 778     os.environ["EDITOR"] = "vi" | 
|  | 779     force_flag = " -f" if not manual else "" | 
|  | 780     self.ExpectGit([ | 
|  | 781       Git("status -s -uno", ""), | 
|  | 782       Git("status -s -b -uno", "## some_branch\n"), | 
|  | 783       Git("svn fetch", ""), | 
|  | 784       Git(("log -1 --format=%H --grep=" | 
|  | 785            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 
|  | 786            "svn/trunk"), "push_hash\n"), | 
|  | 787       Git("svn find-rev push_hash", "123455\n"), | 
|  | 788       Git("log -1 --format=%s push_hash", | 
|  | 789           "Version 3.22.5 (based on bleeding_edge revision r123454)\n"), | 
|  | 790       Git("status -s -uno", ""), | 
|  | 791       Git("checkout -f master", ""), | 
|  | 792       Git("pull", ""), | 
|  | 793       Git("checkout -b v8-roll-123455", ""), | 
|  | 794       Git(("commit -am \"Update V8 to version 3.22.5 " | 
|  | 795            "(based on bleeding_edge revision r123454).\n\n" | 
|  | 796            "TBR=reviewer@chromium.org\""), | 
|  | 797           ""), | 
|  | 798       Git(("cl upload --send-mail --email \"author@chromium.org\"%s" | 
|  | 799            % force_flag), ""), | 
|  | 800     ]) | 
|  | 801 | 
|  | 802     # Expected keyboard input in manual mode: | 
|  | 803     if manual: | 
|  | 804       self.ExpectReadline([ | 
|  | 805         RL("reviewer@chromium.org"),  # Chromium reviewer. | 
|  | 806       ]) | 
|  | 807 | 
|  | 808     # Expected keyboard input in semi-automatic mode and forced mode: | 
|  | 809     if not manual: | 
|  | 810       self.ExpectReadline([]) | 
|  | 811 | 
|  | 812     args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM]] | 
|  | 813     if force: args.append("-f") | 
|  | 814     if manual: args.append("-m") | 
|  | 815     else: args += ["-r", "reviewer@chromium.org"] | 
|  | 816     ChromiumRoll(TEST_CONFIG, self).Run(args) | 
|  | 817 | 
|  | 818     deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 
|  | 819     self.assertTrue(re.search("\"v8_revision\": \"123455\"", deps)) | 
|  | 820 | 
|  | 821   def testChromiumRollManual(self): | 
|  | 822     self._ChromiumRoll(manual=True) | 
|  | 823 | 
|  | 824   def testChromiumRollSemiAutomatic(self): | 
|  | 825     self._ChromiumRoll() | 
|  | 826 | 
|  | 827   def testChromiumRollForced(self): | 
|  | 828     self._ChromiumRoll(force=True) | 
|  | 829 | 
| 785   def testCheckLastPushRecently(self): | 830   def testCheckLastPushRecently(self): | 
| 786     self.ExpectGit([ | 831     self.ExpectGit([ | 
| 787       Git("svn log -1 --oneline", "r101 | Text"), | 832       Git("svn log -1 --oneline", "r101 | Text"), | 
| 788       Git("svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."), | 833       Git("svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."), | 
| 789     ]) | 834     ]) | 
| 790 | 835 | 
| 791     self.RunStep(auto_roll.AutoRoll, FetchLatestRevision, AUTO_ROLL_ARGS) | 836     self.RunStep(auto_roll.AutoRoll, FetchLatestRevision, AUTO_ROLL_ARGS) | 
| 792     self.assertRaises(Exception, lambda: self.RunStep(auto_roll.AutoRoll, | 837     self.assertRaises(Exception, lambda: self.RunStep(auto_roll.AutoRoll, | 
| 793                                                       CheckLastPush, | 838                                                       CheckLastPush, | 
| 794                                                       AUTO_ROLL_ARGS)) | 839                                                       AUTO_ROLL_ARGS)) | 
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1011 | 1056 | 
| 1012 Review URL: https://codereview.chromium.org/83173002 | 1057 Review URL: https://codereview.chromium.org/83173002 | 
| 1013 | 1058 | 
| 1014 ------------------------------------------------------------------------""") | 1059 ------------------------------------------------------------------------""") | 
| 1015     self.assertEquals( | 1060     self.assertEquals( | 
| 1016 """Prepare push to trunk.  Now working on version 3.23.11. | 1061 """Prepare push to trunk.  Now working on version 3.23.11. | 
| 1017 | 1062 | 
| 1018 R=danno@chromium.org | 1063 R=danno@chromium.org | 
| 1019 | 1064 | 
| 1020 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1065 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 
| OLD | NEW | 
|---|