Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: tools/release/test_scripts.py

Issue 1468973002: [release] Merge auto-roll and wrapped chromium-roll scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/release/chromium_roll.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123455 123 996 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123455 123
997 997
998 """ 998 """
999 999
1000 C_V8_123456_LOG = """V8 CL. 1000 C_V8_123456_LOG = """V8 CL.
1001 1001
1002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123 1002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123
1003 1003
1004 """ 1004 """
1005 1005
1006 ROLL_COMMIT_MSG = """Update V8 to version 3.22.4 (based on abc). 1006 ROLL_COMMIT_MSG = """Update V8 to version 3.22.4.
1007 1007
1008 Summary of changes available at: 1008 Summary of changes available at:
1009 https://chromium.googlesource.com/v8/v8/+log/last_rol..roll_hsh 1009 https://chromium.googlesource.com/v8/v8/+log/last_rol..roll_hsh
1010 1010
1011 Please follow these instructions for assigning/CC'ing issues: 1011 Please follow these instructions for assigning/CC'ing issues:
1012 https://code.google.com/p/v8-wiki/wiki/TriagingIssues 1012 https://code.google.com/p/v8-wiki/wiki/TriagingIssues
1013 1013
1014 Please close rolling in case of a roll revert: 1014 Please close rolling in case of a roll revert:
1015 https://v8-roll.appspot.com/ 1015 https://v8-roll.appspot.com/
1016 This only works with a Google account. 1016 This only works with a Google account.
1017 1017
1018 TBR=reviewer@chromium.org""" 1018 TBR=reviewer@chromium.org"""
1019 1019
1020 # Snippet from the original DEPS file.
1021 FAKE_DEPS = """
1022 vars = {
1023 "v8_revision": "last_roll_hsh",
1024 }
1025 deps = {
1026 "src/v8":
1027 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" +
1028 Var("v8_revision"),
1029 }
1030 """
1031
1032 def testChromiumRollUpToDate(self):
1033 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1034 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
1035 self.Expect([
1036 Cmd("git fetch origin", ""),
1037 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1038 Cmd("git describe --tags last_roll_hsh", "3.22.4"),
1039 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1040 Cmd("git rev-list --max-age=740800 --tags",
1041 "bad_tag\nroll_hsh\nhash_123"),
1042 Cmd("git describe --tags bad_tag", ""),
1043 Cmd("git describe --tags roll_hsh", "3.22.4"),
1044 Cmd("git describe --tags hash_123", "3.22.3"),
1045 Cmd("git describe --tags roll_hsh", "3.22.4"),
1046 Cmd("git describe --tags hash_123", "3.22.3"),
1047 ])
1048
1049 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
1050 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]])
1051 self.assertEquals(0, result)
1052
1020 def testChromiumRoll(self): 1053 def testChromiumRoll(self):
1021 # Setup fake directory structures. 1054 # Setup fake directory structures.
1022 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() 1055 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1056 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
1023 TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git")) 1057 TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git"))
1024 chrome_dir = TEST_CONFIG["CHROMIUM"] 1058 chrome_dir = TEST_CONFIG["CHROMIUM"]
1025 os.makedirs(os.path.join(chrome_dir, "v8")) 1059 os.makedirs(os.path.join(chrome_dir, "v8"))
1026 1060
1027 # Write fake deps file.
1028 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line",
1029 os.path.join(chrome_dir, "DEPS"))
1030 def WriteDeps(): 1061 def WriteDeps():
1031 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", 1062 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line",
1032 os.path.join(chrome_dir, "DEPS")) 1063 os.path.join(chrome_dir, "DEPS"))
1033 1064
1034 expectations = [ 1065 expectations = [
1035 Cmd("git fetch origin", ""), 1066 Cmd("git fetch origin", ""),
1036 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), 1067 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1037 Cmd("git log -1 --format=%s roll_hsh", 1068 Cmd("git describe --tags last_roll_hsh", "3.22.3.1"),
1038 "Version 3.22.4 (based on abc)\n"), 1069 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1070 Cmd("git rev-list --max-age=740800 --tags",
1071 "bad_tag\nroll_hsh\nhash_123"),
1072 Cmd("git describe --tags bad_tag", ""),
1073 Cmd("git describe --tags roll_hsh", "3.22.4"),
1074 Cmd("git describe --tags hash_123", "3.22.3"),
1075 Cmd("git describe --tags roll_hsh", "3.22.4"),
1076 Cmd("git log -1 --format=%s roll_hsh", "Version 3.22.4\n"),
1039 Cmd("git describe --tags roll_hsh", "3.22.4"), 1077 Cmd("git describe --tags roll_hsh", "3.22.4"),
1040 Cmd("git describe --tags last_roll_hsh", "3.22.2.1"), 1078 Cmd("git describe --tags last_roll_hsh", "3.22.2.1"),
1041 Cmd("git status -s -uno", "", cwd=chrome_dir), 1079 Cmd("git status -s -uno", "", cwd=chrome_dir),
1042 Cmd("git checkout -f master", "", cwd=chrome_dir), 1080 Cmd("git checkout -f master", "", cwd=chrome_dir),
1043 Cmd("git branch", "", cwd=chrome_dir), 1081 Cmd("git branch", "", cwd=chrome_dir),
1044 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir), 1082 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir),
1045 Cmd("git pull", "", cwd=chrome_dir), 1083 Cmd("git pull", "", cwd=chrome_dir),
1046 Cmd("git fetch origin", ""), 1084 Cmd("git fetch origin", ""),
1047 Cmd("git new-branch work-branch", "", cwd=chrome_dir), 1085 Cmd("git new-branch work-branch", "", cwd=chrome_dir),
1048 Cmd("roll-dep-svn v8 roll_hsh", "rolled", cb=WriteDeps, cwd=chrome_dir), 1086 Cmd("roll-dep-svn v8 roll_hsh", "rolled", cb=WriteDeps, cwd=chrome_dir),
1049 Cmd(("git commit -am \"%s\" " 1087 Cmd(("git commit -am \"%s\" "
1050 "--author \"author@chromium.org <author@chromium.org>\"" % 1088 "--author \"author@chromium.org <author@chromium.org>\"" %
1051 self.ROLL_COMMIT_MSG), 1089 self.ROLL_COMMIT_MSG),
1052 "", cwd=chrome_dir), 1090 "", cwd=chrome_dir),
1053 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", "", 1091 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f "
1054 cwd=chrome_dir), 1092 "--use-commit-queue", "", cwd=chrome_dir),
1055 Cmd("git checkout -f master", "", cwd=chrome_dir), 1093 Cmd("git checkout -f master", "", cwd=chrome_dir),
1056 Cmd("git branch -D work-branch", "", cwd=chrome_dir), 1094 Cmd("git branch -D work-branch", "", cwd=chrome_dir),
1057 ] 1095 ]
1058 self.Expect(expectations) 1096 self.Expect(expectations)
1059 1097
1060 args = ["-a", "author@chromium.org", "-c", chrome_dir, 1098 args = ["-a", "author@chromium.org", "-c", chrome_dir,
1061 "-r", "reviewer@chromium.org", 1099 "-r", "reviewer@chromium.org"]
1062 "--last-roll", "last_roll_hsh", 1100 auto_roll.AutoRoll(TEST_CONFIG, self).Run(args)
1063 "roll_hsh"]
1064 ChromiumRoll(TEST_CONFIG, self).Run(args)
1065 1101
1066 deps = FileToText(os.path.join(chrome_dir, "DEPS")) 1102 deps = FileToText(os.path.join(chrome_dir, "DEPS"))
1067 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) 1103 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))
1068 1104
1069 def testCheckLastPushRecently(self): 1105 def testCheckLastPushRecently(self):
1070 self.Expect([ 1106 self.Expect([
1071 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), 1107 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1072 Cmd("git tag", self.TAGS), 1108 Cmd("git tag", self.TAGS),
1073 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), 1109 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
1074 Cmd("git log -1 --format=%s release_hash", 1110 Cmd("git log -1 --format=%s release_hash",
(...skipping 18 matching lines...) Expand all
1093 Cmd("git log --format=%H abc3..abc123", "some_stuff\n"), 1129 Cmd("git log --format=%H abc3..abc123", "some_stuff\n"),
1094 ]) 1130 ])
1095 1131
1096 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) 1132 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"])
1097 1133
1098 state = json.loads(FileToText("%s-state.json" 1134 state = json.loads(FileToText("%s-state.json"
1099 % TEST_CONFIG["PERSISTFILE_BASENAME"])) 1135 % TEST_CONFIG["PERSISTFILE_BASENAME"]))
1100 1136
1101 self.assertEquals("abc123", state["candidate"]) 1137 self.assertEquals("abc123", state["candidate"])
1102 1138
1103 # Snippet from the original DEPS file.
1104 FAKE_DEPS = """
1105 vars = {
1106 "v8_revision": "abcd123455",
1107 }
1108 deps = {
1109 "src/v8":
1110 (Var("googlecode_url") % "v8") + "/" + Var("v8_branch") + "@" +
1111 Var("v8_revision"),
1112 }
1113 """
1114
1115 def testAutoRollUpToDate(self):
1116 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1117 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
1118 self.Expect([
1119 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1120 Cmd("git rev-list --max-age=740800 --tags",
1121 "bad_tag\nhash_234\nhash_123"),
1122 Cmd("git describe --tags bad_tag", ""),
1123 Cmd("git describe --tags hash_234", "3.22.4"),
1124 Cmd("git describe --tags hash_123", "3.22.3"),
1125 Cmd("git describe --tags abcd123455", "3.22.4"),
1126 Cmd("git describe --tags hash_234", "3.22.4"),
1127 Cmd("git describe --tags hash_123", "3.22.3"),
1128 ])
1129
1130 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
1131 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]])
1132 self.assertEquals(0, result)
1133
1134 def testAutoRoll(self):
1135 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1136 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
1137
1138 self.Expect([
1139 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1140 Cmd("git rev-list --max-age=740800 --tags",
1141 "bad_tag\nhash_234\nhash_123"),
1142 Cmd("git describe --tags bad_tag", ""),
1143 Cmd("git describe --tags hash_234", "3.22.4"),
1144 Cmd("git describe --tags hash_123", "3.22.3"),
1145 Cmd("git describe --tags abcd123455", "3.22.3.1"),
1146 Cmd("git describe --tags hash_234", "3.22.4"),
1147 ])
1148
1149 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
1150 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"])
1151 self.assertEquals(0, result)
1152
1153 def testMergeToBranch(self): 1139 def testMergeToBranch(self):
1154 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() 1140 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
1155 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 1141 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
1156 self.WriteFakeVersionFile(build=5) 1142 self.WriteFakeVersionFile(build=5)
1157 os.environ["EDITOR"] = "vi" 1143 os.environ["EDITOR"] = "vi"
1158 extra_patch = self.MakeEmptyTempFile() 1144 extra_patch = self.MakeEmptyTempFile()
1159 1145
1160 def VerifyPatch(patch): 1146 def VerifyPatch(patch):
1161 return lambda: self.assertEquals(patch, 1147 return lambda: self.assertEquals(patch,
1162 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"])) 1148 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"]))
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 1536
1551 Review URL: https://codereview.chromium.org/83173002 1537 Review URL: https://codereview.chromium.org/83173002
1552 1538
1553 ------------------------------------------------------------------------""") 1539 ------------------------------------------------------------------------""")
1554 self.assertEquals( 1540 self.assertEquals(
1555 """Prepare push to trunk. Now working on version 3.23.11. 1541 """Prepare push to trunk. Now working on version 3.23.11.
1556 1542
1557 R=danno@chromium.org 1543 R=danno@chromium.org
1558 1544
1559 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1545 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/release/chromium_roll.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698