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

Side by Side Diff: tools/push-to-trunk/test_scripts.py

Issue 604853002: Add new git port to merge_to_branch script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Initial with simple copy of old merge_to_branch tests Created 6 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/common_includes.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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
Michael Achenbach 2014/09/25 15:41:39 For now: Copy paste of the complete test above wit
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 svn fetch", ""),
1205 Cmd("git branch", " branch1\n* branch2\n"),
1206 Cmd("git checkout -b %s svn/trunk" % TEST_CONFIG["BRANCHNAME"], ""),
1207 Cmd(("git log --format=%H --grep=\"Port r12345\" "
1208 "--reverse svn/bleeding_edge"),
1209 "hash1\nhash2"),
1210 Cmd("git svn find-rev hash1 svn/bleeding_edge", "45678"),
1211 Cmd("git log -1 --format=%s hash1", "Title1"),
1212 Cmd("git svn find-rev hash2 svn/bleeding_edge", "23456"),
1213 Cmd("git log -1 --format=%s hash2", "Title2"),
1214 Cmd(("git log --format=%H --grep=\"Port r23456\" "
1215 "--reverse svn/bleeding_edge"),
1216 ""),
1217 Cmd(("git log --format=%H --grep=\"Port r34567\" "
1218 "--reverse svn/bleeding_edge"),
1219 "hash3"),
1220 Cmd("git svn find-rev hash3 svn/bleeding_edge", "56789"),
1221 Cmd("git log -1 --format=%s hash3", "Title3"),
1222 RL("Y"), # Automatically add corresponding ports (34567, 56789)?
1223 Cmd("git svn find-rev r12345 svn/bleeding_edge", "hash4"),
1224 # Simulate svn being down which stops the script.
1225 Cmd("git svn find-rev r23456 svn/bleeding_edge", None),
1226 # Restart script in the failing step.
1227 Cmd("git svn find-rev r12345 svn/bleeding_edge", "hash4"),
1228 Cmd("git svn find-rev r23456 svn/bleeding_edge", "hash2"),
1229 Cmd("git svn find-rev r34567 svn/bleeding_edge", "hash3"),
1230 Cmd("git svn find-rev r45678 svn/bleeding_edge", "hash1"),
1231 Cmd("git svn find-rev r56789 svn/bleeding_edge", "hash5"),
1232 Cmd("git log -1 --format=%s hash4", "Title4"),
1233 Cmd("git log -1 --format=%s hash2", "Title2"),
1234 Cmd("git log -1 --format=%s hash3", "Title3"),
1235 Cmd("git log -1 --format=%s hash1", "Title1"),
1236 Cmd("git log -1 --format=%s hash5", "Revert \"Something\""),
1237 Cmd("git log -1 hash4", "Title4\nBUG=123\nBUG=234"),
1238 Cmd("git log -1 hash2", "Title2\n BUG = v8:123,345"),
1239 Cmd("git log -1 hash3", "Title3\nLOG=n\nBUG=567, 456"),
1240 Cmd("git log -1 hash1", "Title1\nBUG="),
1241 Cmd("git log -1 hash5", "Revert \"Something\"\nBUG=none"),
1242 Cmd("git log -1 -p hash4", "patch4"),
1243 Cmd(("git apply --index --reject \"%s\"" %
1244 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1245 "", cb=VerifyPatch("patch4")),
1246 Cmd("git log -1 -p hash2", "patch2"),
1247 Cmd(("git apply --index --reject \"%s\"" %
1248 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1249 "", cb=VerifyPatch("patch2")),
1250 Cmd("git log -1 -p hash3", "patch3"),
1251 Cmd(("git apply --index --reject \"%s\"" %
1252 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1253 "", cb=VerifyPatch("patch3")),
1254 Cmd("git log -1 -p hash1", "patch1"),
1255 Cmd(("git apply --index --reject \"%s\"" %
1256 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1257 "", cb=VerifyPatch("patch1")),
1258 Cmd("git log -1 -p hash5", "patch5\n"),
1259 Cmd(("git apply --index --reject \"%s\"" %
1260 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1261 "", cb=VerifyPatch("patch5\n")),
1262 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""),
1263 RL("Y"), # Automatically increment patch level?
1264 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""),
1265 RL("reviewer@chromium.org"), # V8 reviewer.
1266 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" "
1267 "--bypass-hooks -cc \"ulan@chromium.org\"", ""),
1268 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""),
1269 RL("LGTM"), # Enter LGTM for V8 CL.
1270 Cmd("git cl presubmit", "Presubmit successfull\n"),
1271 Cmd("git cl dcommit -f --bypass-hooks", "Closing issue\n",
1272 cb=VerifySVNCommit),
1273 Cmd("git svn tag 3.22.5.1 -m \"Tagging version 3.22.5.1\"", ""),
1274 Cmd("git checkout -f some_branch", ""),
1275 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1276 ])
1277
1278 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS
1279 # ports of r12345. r56789 is the MIPS port of r34567.
1280 args = ["-f", "-p", extra_patch, "--branch", "trunk", "--vc-port",
1281 "git_svn", "12345", "23456", "34567"]
1282
1283 # The first run of the script stops because of the svn being down.
1284 self.assertRaises(GitFailedException,
1158 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) 1285 lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
1159 1286
1160 # Test that state recovery after restarting the script works. 1287 # Test that state recovery after restarting the script works.
1161 args += ["-s", "3"] 1288 args += ["-s", "3"]
1162 MergeToBranch(TEST_CONFIG, self).Run(args) 1289 MergeToBranch(TEST_CONFIG, self).Run(args)
1163 1290
1164 def testReleases(self): 1291 def testReleases(self):
1165 tag_response_text = """ 1292 tag_response_text = """
1166 ------------------------------------------------------------------------ 1293 ------------------------------------------------------------------------
1167 r22631 | author1@chromium.org | 2014-07-28 02:05:29 +0200 (Mon, 28 Jul 2014) 1294 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
1514 self.Expect([ 1641 self.Expect([
1515 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""), 1642 Cmd("git diff --name-only lkgr_hash lkgr_hash^", ""),
1516 ]) 1643 ])
1517 1644
1518 self.assertEquals(0, 1645 self.assertEquals(0,
1519 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"])) 1646 self.RunStep(BumpUpVersion, LKGRVersionUpToDateBailout, ["--dry_run"]))
1520 1647
1521 1648
1522 class SystemTest(unittest.TestCase): 1649 class SystemTest(unittest.TestCase):
1523 def testReload(self): 1650 def testReload(self):
1651 options = ScriptsBase(
1652 TEST_CONFIG, DEFAULT_SIDE_EFFECT_HANDLER, {}).MakeOptions([])
1524 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, 1653 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={},
1654 options=options,
1525 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) 1655 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER)
1526 body = step.Reload( 1656 body = step.Reload(
1527 """------------------------------------------------------------------------ 1657 """------------------------------------------------------------------------
1528 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines 1658 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines
1529 1659
1530 Prepare push to trunk. Now working on version 3.23.11. 1660 Prepare push to trunk. Now working on version 3.23.11.
1531 1661
1532 R=danno@chromium.org 1662 R=danno@chromium.org
1533 1663
1534 Review URL: https://codereview.chromium.org/83173002 1664 Review URL: https://codereview.chromium.org/83173002
1535 1665
1536 ------------------------------------------------------------------------""") 1666 ------------------------------------------------------------------------""")
1537 self.assertEquals( 1667 self.assertEquals(
1538 """Prepare push to trunk. Now working on version 3.23.11. 1668 """Prepare push to trunk. Now working on version 3.23.11.
1539 1669
1540 R=danno@chromium.org 1670 R=danno@chromium.org
1541 1671
1542 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1672 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698