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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 Cmd("git cl presubmit", "Presubmit successfull\n"), | 1143 Cmd("git cl presubmit", "Presubmit successfull\n"), |
1144 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n", | 1144 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n", |
1145 cb=VerifySVNCommit), | 1145 cb=VerifySVNCommit), |
1146 Cmd("git svn tag 3.22.5.1 -m \"Tagging version 3.22.5.1\"", ""), | 1146 Cmd("git svn tag 3.22.5.1 -m \"Tagging version 3.22.5.1\"", ""), |
1147 Cmd("git checkout -f some_branch", ""), | 1147 Cmd("git checkout -f some_branch", ""), |
1148 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), | 1148 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), |
1149 ]) | 1149 ]) |
1150 | 1150 |
1151 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS | 1151 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS |
1152 # ports of r12345. r56789 is the MIPS port of r34567. | 1152 # ports of r12345. r56789 is the MIPS port of r34567. |
1153 args = ["-f", "-p", extra_patch, "--branch", "trunk", "12345", "23456", | 1153 args = ["-f", "-p", extra_patch, "--branch", "trunk", "--vc-port", |
1154 "34567"] | 1154 "git_svn", "12345", "23456", "34567"] |
1155 | 1155 |
1156 # The first run of the script stops because of the svn being down. | 1156 # The first run of the script stops because of the svn being down. |
1157 self.assertRaises(GitFailedException, | 1157 self.assertRaises(GitFailedException, |
| 1158 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) |
| 1159 |
| 1160 # Test that state recovery after restarting the script works. |
| 1161 args += ["-s", "3"] |
| 1162 MergeToBranch(TEST_CONFIG, self).Run(args) |
| 1163 |
| 1164 def testMergeToBranchNewGit(self): |
| 1165 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() |
| 1166 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
| 1167 self.WriteFakeVersionFile(build=5) |
| 1168 os.environ["EDITOR"] = "vi" |
| 1169 extra_patch = self.MakeEmptyTempFile() |
| 1170 |
| 1171 def VerifyPatch(patch): |
| 1172 return lambda: self.assertEquals(patch, |
| 1173 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"])) |
| 1174 |
| 1175 msg = """Version 3.22.5.1 (merged r12345, r23456, r34567, r45678, r56789) |
| 1176 |
| 1177 Title4 |
| 1178 |
| 1179 Title2 |
| 1180 |
| 1181 Title3 |
| 1182 |
| 1183 Title1 |
| 1184 |
| 1185 Revert "Something" |
| 1186 |
| 1187 BUG=123,234,345,456,567,v8:123 |
| 1188 LOG=N |
| 1189 """ |
| 1190 |
| 1191 def VerifySVNCommit(): |
| 1192 commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"]) |
| 1193 self.assertEquals(msg, commit) |
| 1194 version = FileToText( |
| 1195 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE)) |
| 1196 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
| 1197 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
| 1198 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+1", version)) |
| 1199 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
| 1200 |
| 1201 self.Expect([ |
| 1202 Cmd("git status -s -uno", ""), |
| 1203 Cmd("git status -s -b -uno", "## some_branch\n"), |
| 1204 Cmd("git fetch", ""), |
| 1205 Cmd("git branch", " branch1\n* branch2\n"), |
| 1206 Cmd("git checkout -b %s origin/branch-heads/candidates" % |
| 1207 TEST_CONFIG["BRANCHNAME"], ""), |
| 1208 Cmd(("git log --format=%H --grep=\"Port r12345\" " |
| 1209 "--reverse origin/master"), |
| 1210 "hash1\nhash2"), |
| 1211 Cmd("git svn find-rev hash1 origin/master", "45678"), |
| 1212 Cmd("git log -1 --format=%s hash1", "Title1"), |
| 1213 Cmd("git svn find-rev hash2 origin/master", "23456"), |
| 1214 Cmd("git log -1 --format=%s hash2", "Title2"), |
| 1215 Cmd(("git log --format=%H --grep=\"Port r23456\" " |
| 1216 "--reverse origin/master"), |
| 1217 ""), |
| 1218 Cmd(("git log --format=%H --grep=\"Port r34567\" " |
| 1219 "--reverse origin/master"), |
| 1220 "hash3"), |
| 1221 Cmd("git svn find-rev hash3 origin/master", "56789"), |
| 1222 Cmd("git log -1 --format=%s hash3", "Title3"), |
| 1223 RL("Y"), # Automatically add corresponding ports (34567, 56789)? |
| 1224 Cmd("git svn find-rev r12345 origin/master", "hash4"), |
| 1225 # Simulate svn being down which stops the script. |
| 1226 Cmd("git svn find-rev r23456 origin/master", None), |
| 1227 # Restart script in the failing step. |
| 1228 Cmd("git svn find-rev r12345 origin/master", "hash4"), |
| 1229 Cmd("git svn find-rev r23456 origin/master", "hash2"), |
| 1230 Cmd("git svn find-rev r34567 origin/master", "hash3"), |
| 1231 Cmd("git svn find-rev r45678 origin/master", "hash1"), |
| 1232 Cmd("git svn find-rev r56789 origin/master", "hash5"), |
| 1233 Cmd("git log -1 --format=%s hash4", "Title4"), |
| 1234 Cmd("git log -1 --format=%s hash2", "Title2"), |
| 1235 Cmd("git log -1 --format=%s hash3", "Title3"), |
| 1236 Cmd("git log -1 --format=%s hash1", "Title1"), |
| 1237 Cmd("git log -1 --format=%s hash5", "Revert \"Something\""), |
| 1238 Cmd("git log -1 hash4", "Title4\nBUG=123\nBUG=234"), |
| 1239 Cmd("git log -1 hash2", "Title2\n BUG = v8:123,345"), |
| 1240 Cmd("git log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"), |
| 1241 Cmd("git log -1 hash1", "Title1\nBUG="), |
| 1242 Cmd("git log -1 hash5", "Revert \"Something\"\nBUG=none"), |
| 1243 Cmd("git log -1 -p hash4", "patch4"), |
| 1244 Cmd(("git apply --index --reject \"%s\"" % |
| 1245 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), |
| 1246 "", cb=VerifyPatch("patch4")), |
| 1247 Cmd("git log -1 -p hash2", "patch2"), |
| 1248 Cmd(("git apply --index --reject \"%s\"" % |
| 1249 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), |
| 1250 "", cb=VerifyPatch("patch2")), |
| 1251 Cmd("git log -1 -p hash3", "patch3"), |
| 1252 Cmd(("git apply --index --reject \"%s\"" % |
| 1253 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), |
| 1254 "", cb=VerifyPatch("patch3")), |
| 1255 Cmd("git log -1 -p hash1", "patch1"), |
| 1256 Cmd(("git apply --index --reject \"%s\"" % |
| 1257 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), |
| 1258 "", cb=VerifyPatch("patch1")), |
| 1259 Cmd("git log -1 -p hash5", "patch5\n"), |
| 1260 Cmd(("git apply --index --reject \"%s\"" % |
| 1261 TEST_CONFIG["TEMPORARY_PATCH_FILE"]), |
| 1262 "", cb=VerifyPatch("patch5\n")), |
| 1263 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""), |
| 1264 RL("Y"), # Automatically increment patch level? |
| 1265 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""), |
| 1266 RL("reviewer@chromium.org"), # V8 reviewer. |
| 1267 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" " |
| 1268 "--bypass-hooks -cc \"ulan@chromium.org\"", ""), |
| 1269 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""), |
| 1270 RL("LGTM"), # Enter LGTM for V8 CL. |
| 1271 Cmd("git cl presubmit", "Presubmit successfull\n"), |
| 1272 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n", |
| 1273 cb=VerifySVNCommit), |
| 1274 Cmd("git svn tag 3.22.5.1 -m \"Tagging version 3.22.5.1\"", ""), |
| 1275 Cmd("git checkout -f some_branch", ""), |
| 1276 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), |
| 1277 ]) |
| 1278 |
| 1279 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS |
| 1280 # ports of r12345. r56789 is the MIPS port of r34567. |
| 1281 args = ["-f", "-p", extra_patch, "--branch", "candidates", "--vc-port", |
| 1282 "git_read_svn_write", "12345", "23456", "34567"] |
| 1283 |
| 1284 # The first run of the script stops because of the svn being down. |
| 1285 self.assertRaises(GitFailedException, |
1158 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) | 1286 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) |
1159 | 1287 |
1160 # Test that state recovery after restarting the script works. | 1288 # Test that state recovery after restarting the script works. |
1161 args += ["-s", "3"] | 1289 args += ["-s", "3"] |
1162 MergeToBranch(TEST_CONFIG, self).Run(args) | 1290 MergeToBranch(TEST_CONFIG, self).Run(args) |
1163 | 1291 |
1164 def testReleases(self): | 1292 def testReleases(self): |
1165 tag_response_text = """ | 1293 tag_response_text = """ |
1166 ------------------------------------------------------------------------ | 1294 ------------------------------------------------------------------------ |
1167 r22631 | author1@chromium.org | 2014-07-28 02:05:29 +0200 (Mon, 28 Jul 2014) | 1295 r22631 | author1@chromium.org | 2014-07-28 02:05:29 +0200 (Mon, 28 Jul 2014) |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 self.Expect([ | 1642 self.Expect([ |
1515 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""), | 1643 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""), |
1516 ]) | 1644 ]) |
1517 | 1645 |
1518 self.assertEquals(0, | 1646 self.assertEquals(0, |
1519 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) | 1647 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) |
1520 | 1648 |
1521 | 1649 |
1522 class SystemTest(unittest.TestCase): | 1650 class SystemTest(unittest.TestCase): |
1523 def testReload(self): | 1651 def testReload(self): |
| 1652 options = ScriptsBase( |
| 1653 TEST_CONFIG, DEFAULT_SIDE_EFFECT_HANDLER, {}).MakeOptions([]) |
1524 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, | 1654 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, |
| 1655 options=options, |
1525 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) | 1656 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) |
1526 body = step.Reload( | 1657 body = step.Reload( |
1527 """------------------------------------------------------------------------ | 1658 """------------------------------------------------------------------------ |
1528 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines | 1659 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines |
1529 | 1660 |
1530 Prepare push to trunk. Now working on version 3.23.11. | 1661 Prepare push to trunk. Now working on version 3.23.11. |
1531 | 1662 |
1532 R=danno@chromium.org | 1663 R=danno@chromium.org |
1533 | 1664 |
1534 Review URL: https://codereview.chromium.org/83173002 | 1665 Review URL: https://codereview.chromium.org/83173002 |
1535 | 1666 |
1536 ------------------------------------------------------------------------""") | 1667 ------------------------------------------------------------------------""") |
1537 self.assertEquals( | 1668 self.assertEquals( |
1538 """Prepare push to trunk. Now working on version 3.23.11. | 1669 """Prepare push to trunk. Now working on version 3.23.11. |
1539 | 1670 |
1540 R=danno@chromium.org | 1671 R=danno@chromium.org |
1541 | 1672 |
1542 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1673 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
OLD | NEW |