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

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

Issue 1398033003: [Release] Update merge script to leverage auto-tag bot (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Truncate title more meaningful Created 4 years, 5 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
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 22 matching lines...) Expand all
33 import unittest 33 import unittest
34 34
35 import auto_push 35 import auto_push
36 from auto_push import LastReleaseBailout 36 from auto_push import LastReleaseBailout
37 import auto_roll 37 import auto_roll
38 import common_includes 38 import common_includes
39 from common_includes import * 39 from common_includes import *
40 import create_release 40 import create_release
41 from create_release import CreateRelease 41 from create_release import CreateRelease
42 import merge_to_branch 42 import merge_to_branch
43 from merge_to_branch import * 43 from merge_to_branch import MergeToBranch
44 import push_to_candidates 44 import push_to_candidates
45 from push_to_candidates import * 45 from push_to_candidates import *
46 import releases 46 import releases
47 from releases import Releases 47 from releases import Releases
48 from auto_tag import AutoTag 48 from auto_tag import AutoTag
49 49 import roll_merge
50 from roll_merge import RollMerge
50 51
51 TEST_CONFIG = { 52 TEST_CONFIG = {
52 "DEFAULT_CWD": None, 53 "DEFAULT_CWD": None,
53 "BRANCHNAME": "test-prepare-push", 54 "BRANCHNAME": "test-prepare-push",
54 "CANDIDATESBRANCH": "test-candidates-push", 55 "CANDIDATESBRANCH": "test-candidates-push",
55 "PERSISTFILE_BASENAME": "/tmp/test-v8-push-to-candidates-tempfile", 56 "PERSISTFILE_BASENAME": "/tmp/test-v8-push-to-candidates-tempfile",
56 "CHANGELOG_ENTRY_FILE": 57 "CHANGELOG_ENTRY_FILE":
57 "/tmp/test-v8-push-to-candidates-tempfile-changelog-entry", 58 "/tmp/test-v8-push-to-candidates-tempfile-changelog-entry",
58 "PATCH_FILE": "/tmp/test-v8-push-to-candidates-tempfile-patch", 59 "PATCH_FILE": "/tmp/test-v8-push-to-candidates-tempfile-patch",
59 "COMMITMSG_FILE": "/tmp/test-v8-push-to-candidates-tempfile-commitmsg", 60 "COMMITMSG_FILE": "/tmp/test-v8-push-to-candidates-tempfile-commitmsg",
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 522 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
522 Cmd("git fetch", ""), 523 Cmd("git fetch", ""),
523 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 524 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
524 Cmd("git fetch", ""), 525 Cmd("git fetch", ""),
525 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""), 526 Cmd("git log -1 --format=%H --grep=\"Title\" origin/candidates", ""),
526 ]) 527 ])
527 args = ["--branch", "candidates", "ab12345"] 528 args = ["--branch", "candidates", "ab12345"]
528 self._state["version"] = "tag_name" 529 self._state["version"] = "tag_name"
529 self._state["commit_title"] = "Title" 530 self._state["commit_title"] = "Title"
530 self.assertRaises(Exception, 531 self.assertRaises(Exception,
531 lambda: self.RunStep(MergeToBranch, TagRevision, args)) 532 lambda: self.RunStep(RollMerge, TagRevision, args))
532 533
533 def testReadAndPersistVersion(self): 534 def testReadAndPersistVersion(self):
534 self.WriteFakeVersionFile(build=5) 535 self.WriteFakeVersionFile(build=5)
535 step = self.MakeStep() 536 step = self.MakeStep()
536 step.ReadAndPersistVersion() 537 step.ReadAndPersistVersion()
537 self.assertEquals("3", step["major"]) 538 self.assertEquals("3", step["major"])
538 self.assertEquals("22", step["minor"]) 539 self.assertEquals("22", step["minor"])
539 self.assertEquals("5", step["build"]) 540 self.assertEquals("5", step["build"])
540 self.assertEquals("0", step["patch"]) 541 self.assertEquals("0", step["patch"])
541 542
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 Cmd("git log --format=%H abc3..abc123", "some_stuff\n"), 1169 Cmd("git log --format=%H abc3..abc123", "some_stuff\n"),
1169 ]) 1170 ])
1170 1171
1171 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) 1172 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"])
1172 1173
1173 state = json.loads(FileToText("%s-state.json" 1174 state = json.loads(FileToText("%s-state.json"
1174 % TEST_CONFIG["PERSISTFILE_BASENAME"])) 1175 % TEST_CONFIG["PERSISTFILE_BASENAME"]))
1175 1176
1176 self.assertEquals("abc123", state["candidate"]) 1177 self.assertEquals("abc123", state["candidate"])
1177 1178
1178 def testMergeToBranch(self): 1179 def testRollMerge(self):
1179 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() 1180 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
1180 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 1181 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
1181 self.WriteFakeVersionFile(build=5) 1182 self.WriteFakeVersionFile(build=5)
1182 os.environ["EDITOR"] = "vi" 1183 os.environ["EDITOR"] = "vi"
1183 extra_patch = self.MakeEmptyTempFile() 1184 extra_patch = self.MakeEmptyTempFile()
1184 1185
1185 def VerifyPatch(patch): 1186 def VerifyPatch(patch):
1186 return lambda: self.assertEquals(patch, 1187 return lambda: self.assertEquals(patch,
1187 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"])) 1188 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"]))
1188 1189
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), 1300 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1300 ]) 1301 ])
1301 1302
1302 # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the 1303 # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the
1303 # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567. 1304 # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567.
1304 args = ["-f", "-p", extra_patch, "--branch", "candidates", 1305 args = ["-f", "-p", extra_patch, "--branch", "candidates",
1305 "ab12345", "ab23456", "ab34567"] 1306 "ab12345", "ab23456", "ab34567"]
1306 1307
1307 # The first run of the script stops because of git being down. 1308 # The first run of the script stops because of git being down.
1308 self.assertRaises(GitFailedException, 1309 self.assertRaises(GitFailedException,
1310 lambda: RollMerge(TEST_CONFIG, self).Run(args))
1311
1312 # Test that state recovery after restarting the script works.
1313 args += ["-s", "4"]
1314 RollMerge(TEST_CONFIG, self).Run(args)
1315
1316 def testReleases(self):
1317 c_hash1_commit_log = """Update V8 to Version 4.2.71.
1318
1319 Cr-Commit-Position: refs/heads/master@{#5678}
1320 """
1321 c_hash2_commit_log = """Revert something.
1322
1323 BUG=12345
1324
1325 Reason:
1326 > Some reason.
1327 > Cr-Commit-Position: refs/heads/master@{#12345}
1328 > git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12345 003-1c4
1329
1330 Review URL: https://codereview.chromium.org/12345
1331
1332 Cr-Commit-Position: refs/heads/master@{#4567}
1333 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4567 0039-1c4b
1334
1335 """
1336 c_hash3_commit_log = """Simple.
1337
1338 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b
1339
1340 """
1341 c_hash_234_commit_log = """Version 3.3.1.1 (cherry-pick).
1342
1343 Merged abc12.
1344
1345 Review URL: fake.com
1346
1347 Cr-Commit-Position: refs/heads/candidates@{#234}
1348 """
1349 c_hash_123_commit_log = """Version 3.3.1.0
1350
1351 git-svn-id: googlecode@123 0039-1c4b
1352 """
1353 c_hash_345_commit_log = """Version 3.4.0.
1354
1355 Cr-Commit-Position: refs/heads/candidates@{#345}
1356 """
1357 c_hash_456_commit_log = """Version 4.2.71.
1358
1359 Cr-Commit-Position: refs/heads/4.2.71@{#1}
1360 """
1361 c_deps = "Line\n \"v8_revision\": \"%s\",\n line\n"
1362
1363 json_output = self.MakeEmptyTempFile()
1364 csv_output = self.MakeEmptyTempFile()
1365 self.WriteFakeVersionFile()
1366
1367 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1368 chrome_dir = TEST_CONFIG["CHROMIUM"]
1369 chrome_v8_dir = os.path.join(chrome_dir, "v8")
1370 os.makedirs(chrome_v8_dir)
1371
1372 def ResetVersion(major, minor, build, patch=0):
1373 return lambda: self.WriteFakeVersionFile(major=major,
1374 minor=minor,
1375 build=build,
1376 patch=patch)
1377
1378 self.Expect([
1379 Cmd("git status -s -uno", ""),
1380 Cmd("git checkout -f origin/master", ""),
1381 Cmd("git fetch", ""),
1382 Cmd("git branch", " branch1\n* branch2\n"),
1383 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""),
1384 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1385 Cmd("git rev-list --max-age=395200 --tags",
1386 "bad_tag\nhash_234\nhash_123\nhash_345\nhash_456\n"),
1387 Cmd("git describe --tags bad_tag", "3.23.42-1-deadbeef"),
1388 Cmd("git describe --tags hash_234", "3.3.1.1"),
1389 Cmd("git describe --tags hash_123", "3.21.2"),
1390 Cmd("git describe --tags hash_345", "3.22.3"),
1391 Cmd("git describe --tags hash_456", "4.2.71"),
1392 Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE),
1393 Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "",
1394 cb=ResetVersion(3, 3, 1, 1)),
1395 Cmd("git branch -r --contains hash_234", " branch-heads/3.3\n"),
1396 Cmd("git log -1 --format=%B hash_234", c_hash_234_commit_log),
1397 Cmd("git log -1 --format=%s hash_234", ""),
1398 Cmd("git log -1 --format=%B hash_234", c_hash_234_commit_log),
1399 Cmd("git log -1 --format=%ci hash_234", "18:15"),
1400 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
1401 cb=ResetVersion(3, 22, 5)),
1402 Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE),
1403 Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "",
1404 cb=ResetVersion(3, 21, 2)),
1405 Cmd("git branch -r --contains hash_123", " branch-heads/3.21\n"),
1406 Cmd("git log -1 --format=%B hash_123", c_hash_123_commit_log),
1407 Cmd("git log -1 --format=%s hash_123", ""),
1408 Cmd("git log -1 --format=%B hash_123", c_hash_123_commit_log),
1409 Cmd("git log -1 --format=%ci hash_123", "03:15"),
1410 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
1411 cb=ResetVersion(3, 22, 5)),
1412 Cmd("git diff --name-only hash_345 hash_345^", VERSION_FILE),
1413 Cmd("git checkout -f hash_345 -- %s" % VERSION_FILE, "",
1414 cb=ResetVersion(3, 22, 3)),
1415 Cmd("git branch -r --contains hash_345", " origin/candidates\n"),
1416 Cmd("git log -1 --format=%B hash_345", c_hash_345_commit_log),
1417 Cmd("git log -1 --format=%s hash_345", ""),
1418 Cmd("git log -1 --format=%B hash_345", c_hash_345_commit_log),
1419 Cmd("git log -1 --format=%ci hash_345", ""),
1420 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
1421 cb=ResetVersion(3, 22, 5)),
1422 Cmd("git diff --name-only hash_456 hash_456^", VERSION_FILE),
1423 Cmd("git checkout -f hash_456 -- %s" % VERSION_FILE, "",
1424 cb=ResetVersion(4, 2, 71)),
1425 Cmd("git branch -r --contains hash_456", " origin/4.2.71\n"),
1426 Cmd("git log -1 --format=%B hash_456", c_hash_456_commit_log),
1427 Cmd("git log -1 --format=%H 4.2.71", "hash_456"),
1428 Cmd("git log -1 --format=%s hash_456", "Version 4.2.71"),
1429 Cmd("git log -1 --format=%H hash_456^", "master_456"),
1430 Cmd("git log -1 --format=%B master_456",
1431 "Cr-Commit-Position: refs/heads/master@{#456}"),
1432 Cmd("git log -1 --format=%B hash_456", c_hash_456_commit_log),
1433 Cmd("git log -1 --format=%ci hash_456", "02:15"),
1434 Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "",
1435 cb=ResetVersion(3, 22, 5)),
1436 Cmd("git fetch origin +refs/heads/*:refs/remotes/origin/* "
1437 "+refs/branch-heads/*:refs/remotes/branch-heads/*", "",
1438 cwd=chrome_dir),
1439 Cmd("git fetch origin", "", cwd=chrome_v8_dir),
1440 Cmd("git log --format=%H --grep=\"V8\" origin/master -- DEPS",
1441 "c_hash1\nc_hash2\nc_hash3\n",
1442 cwd=chrome_dir),
1443 Cmd("git show c_hash1:DEPS", c_deps % "hash_456", cwd=chrome_dir),
1444 Cmd("git log -1 --format=%B c_hash1", c_hash1_commit_log,
1445 cwd=chrome_dir),
1446 Cmd("git show c_hash2:DEPS", c_deps % "hash_345", cwd=chrome_dir),
1447 Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log,
1448 cwd=chrome_dir),
1449 Cmd("git show c_hash3:DEPS", c_deps % "deadbeef", cwd=chrome_dir),
1450 Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log,
1451 cwd=chrome_dir),
1452 Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir),
1453 Cmd("git show refs/branch-heads/7:DEPS", c_deps % "hash_345",
1454 cwd=chrome_dir),
1455 URL("http://omahaproxy.appspot.com/all.json", """[{
1456 "os": "win",
1457 "versions": [{
1458 "version": "2.2.2.2",
1459 "v8_version": "22.2.2.2",
1460 "current_reldate": "04/09/15",
1461 "os": "win",
1462 "channel": "canary",
1463 "previous_version": "1.1.1.0"
1464 }]
1465 }]"""),
1466 URL("http://omahaproxy.appspot.com/v8.json?version=1.1.1.0", """{
1467 "chromium_version": "1.1.1.0",
1468 "v8_version": "11.1.1.0"
1469 }"""),
1470 Cmd("git rev-list -1 11.1.1", "v8_previous_version_hash"),
1471 Cmd("git rev-list -1 22.2.2.2", "v8_version_hash"),
1472 Cmd("git checkout -f origin/master", ""),
1473 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "")
1474 ])
1475
1476 args = ["-c", TEST_CONFIG["CHROMIUM"],
1477 "--json", json_output,
1478 "--csv", csv_output,
1479 "--max-releases", "1"]
1480 Releases(TEST_CONFIG, self).Run(args)
1481
1482 # Check expected output.
1483 csv = ("4.2.71,4.2.71,1,5678,\r\n"
1484 "3.22.3,candidates,345,4567:5677,\r\n"
1485 "3.21.2,3.21,123,,\r\n"
1486 "3.3.1.1,3.3,234,,abc12\r\n")
1487 self.assertEquals(csv, FileToText(csv_output))
1488
1489 expected_json = {"chrome_releases":{
1490 "canaries": [
1491 {
1492 "chrome_version": "2.2.2.2",
1493 "os": "win",
1494 "release_date": "04/09/15",
1495 "v8_version": "22.2.2.2",
1496 "v8_version_hash": "v8_version_hash",
1497 "v8_previous_version": "11.1.1.0",
1498 "v8_previous_version_hash": "v8_previous_version_hash "
1499 }]},
1500 "releases":[
1501 {
1502 "revision": "1",
1503 "revision_git": "hash_456",
1504 "master_position": "456",
1505 "master_hash": "master_456",
1506 "patches_merged": "",
1507 "version": "4.2.71",
1508 "chromium_revision": "5678",
1509 "branch": "4.2.71",
1510 "review_link": "",
1511 "date": "02:15",
1512 "chromium_branch": "",
1513 # FIXME(machenbach): Fix revisions link for git.
1514 "revision_link": "https://code.google.com/p/v8/source/detail?r=1",
1515 },
1516 {
1517 "revision": "345",
1518 "revision_git": "hash_345",
1519 "master_position": "",
1520 "master_hash": "",
1521 "patches_merged": "",
1522 "version": "3.22.3",
1523 "chromium_revision": "4567:5677",
1524 "branch": "candidates",
1525 "review_link": "",
1526 "date": "",
1527 "chromium_branch": "7",
1528 "revision_link": "https://code.google.com/p/v8/source/detail?r=345",
1529 },
1530 {
1531 "revision": "123",
1532 "revision_git": "hash_123",
1533 "patches_merged": "",
1534 "master_position": "",
1535 "master_hash": "",
1536 "version": "3.21.2",
1537 "chromium_revision": "",
1538 "branch": "3.21",
1539 "review_link": "",
1540 "date": "03:15",
1541 "chromium_branch": "",
1542 "revision_link": "https://code.google.com/p/v8/source/detail?r=123",
1543 },
1544 {
1545 "revision": "234",
1546 "revision_git": "hash_234",
1547 "patches_merged": "abc12",
1548 "master_position": "",
1549 "master_hash": "",
1550 "version": "3.3.1.1",
1551 "chromium_revision": "",
1552 "branch": "3.3",
1553 "review_link": "fake.com",
1554 "date": "18:15",
1555 "chromium_branch": "",
1556 "revision_link": "https://code.google.com/p/v8/source/detail?r=234",
1557 },],
1558 }
1559 self.assertEquals(expected_json, json.loads(FileToText(json_output)))
1560
1561 def testMergeToBranch(self):
1562 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
1563 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
1564 self.WriteFakeVersionFile(build=5)
1565 os.environ["EDITOR"] = "vi"
1566 extra_patch = self.MakeEmptyTempFile()
1567
1568
1569 def VerifyPatch(patch):
1570 return lambda: self.assertEquals(patch,
1571 FileToText(TEST_CONFIG["TEMPORARY_PATCH_FILE"]))
1572
1573 info_msg = ("NOTE: This script will no longer automatically "
1574 "update include/v8-version.h "
1575 "and create a tag. This is done automatically by the autotag bot. "
1576 "Please call the merge_to_branch.py with --help for more information.")
1577
1578 msg = """Merged: Squashed multiple commits.
1579
1580 Merged: Title4
1581 Revision: ab12345
1582
1583 Merged: Title2
1584 Revision: ab23456
1585
1586 Merged: Title3
1587 Revision: ab34567
1588
1589 Merged: Title1
1590 Revision: ab45678
1591
1592 Merged: Revert \"Something\"
1593 Revision: ab56789
1594
1595 BUG=123,234,345,456,567,v8:123
1596 LOG=N
1597 NOTRY=true
1598 NOPRESUBMIT=true
1599 NOTREECHECKS=true
1600 """
1601
1602 def VerifyLand():
1603 commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"])
1604 self.assertEquals(msg, commit)
1605
1606 self.Expect([
1607 Cmd("git status -s -uno", ""),
1608 Cmd("git checkout -f origin/master", ""),
1609 Cmd("git fetch", ""),
1610 Cmd("git branch", " branch1\n* branch2\n"),
1611 Cmd("git new-branch %s --upstream refs/remotes/origin/candidates" %
1612 TEST_CONFIG["BRANCHNAME"], ""),
1613 Cmd(("git log --format=%H --grep=\"^[Pp]ort ab12345\" "
1614 "--reverse origin/master"),
1615 "ab45678\nab23456"),
1616 Cmd("git log -1 --format=%s ab45678", "Title1"),
1617 Cmd("git log -1 --format=%s ab23456", "Title2"),
1618 Cmd(("git log --format=%H --grep=\"^[Pp]ort ab23456\" "
1619 "--reverse origin/master"),
1620 ""),
1621 Cmd(("git log --format=%H --grep=\"^[Pp]ort ab34567\" "
1622 "--reverse origin/master"),
1623 "ab56789"),
1624 Cmd("git log -1 --format=%s ab56789", "Title3"),
1625 RL("Y"), # Automatically add corresponding ports (ab34567, ab56789)?
1626 # Simulate git being down which stops the script.
1627 Cmd("git log -1 --format=%s ab12345", None),
1628 # Restart script in the failing step.
1629 Cmd("git log -1 --format=%s ab12345", "Title4"),
1630 Cmd("git log -1 --format=%s ab23456", "Title2"),
1631 Cmd("git log -1 --format=%s ab34567", "Title3"),
1632 Cmd("git log -1 --format=%s ab45678", "Title1"),
1633 Cmd("git log -1 --format=%s ab56789", "Revert \"Something\""),
1634 Cmd("git log -1 ab12345", "Title4\nBUG=123\nBUG=234"),
1635 Cmd("git log -1 ab23456", "Title2\n BUG = v8:123,345"),
1636 Cmd("git log -1 ab34567", "Title3\nLOG=n\nBUG=567, 456"),
1637 Cmd("git log -1 ab45678", "Title1\nBUG="),
1638 Cmd("git log -1 ab56789", "Revert \"Something\"\nBUG=none"),
1639 Cmd("git log -1 -p ab12345", "patch4"),
1640 Cmd(("git apply --index --reject \"%s\"" %
1641 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1642 "", cb=VerifyPatch("patch4")),
1643 Cmd("git log -1 -p ab23456", "patch2"),
1644 Cmd(("git apply --index --reject \"%s\"" %
1645 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1646 "", cb=VerifyPatch("patch2")),
1647 Cmd("git log -1 -p ab34567", "patch3"),
1648 Cmd(("git apply --index --reject \"%s\"" %
1649 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1650 "", cb=VerifyPatch("patch3")),
1651 Cmd("git log -1 -p ab45678", "patch1"),
1652 Cmd(("git apply --index --reject \"%s\"" %
1653 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1654 "", cb=VerifyPatch("patch1")),
1655 Cmd("git log -1 -p ab56789", "patch5\n"),
1656 Cmd(("git apply --index --reject \"%s\"" %
1657 TEST_CONFIG["TEMPORARY_PATCH_FILE"]),
1658 "", cb=VerifyPatch("patch5\n")),
1659 Cmd("git apply --index --reject \"%s\"" % extra_patch, ""),
1660 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], ""),
1661 RL("reviewer@chromium.org"), # V8 reviewer.
1662 Cmd("git cl upload --send-mail -r \"reviewer@chromium.org\" "
1663 "--bypass-hooks --cc \"ulan@chromium.org\"", ""),
1664 Cmd("git cl comments -a \"%s\"" % info_msg, ""),
1665 Cmd("git checkout -f %s" % TEST_CONFIG["BRANCHNAME"], ""),
1666 RL("LGTM"), # Enter LGTM for V8 CL.
1667 Cmd("git cl presubmit", "Presubmit successfull\n"),
1668 Cmd("git cl land -f --bypass-hooks", "Closing issue\n",
1669 cb=VerifyLand),
1670 Cmd("git checkout -f origin/master", ""),
1671 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1672 ])
1673
1674 # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the
1675 # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567.
1676 args = ["-f", "-p", extra_patch, "--branch", "candidates",
1677 "ab12345", "ab23456", "ab34567"]
1678
1679 # The first run of the script stops because of git being down.
1680 self.assertRaises(GitFailedException,
1309 lambda: MergeToBranch(TEST_CONFIG, self).Run(args)) 1681 lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
1310 1682
1311 # Test that state recovery after restarting the script works. 1683 # Test that state recovery after restarting the script works.
1312 args += ["-s", "4"] 1684 args += ["-s", "4"]
1313 MergeToBranch(TEST_CONFIG, self).Run(args) 1685 MergeToBranch(TEST_CONFIG, self).Run(args)
1314 1686
1315 def testReleases(self): 1687 def testReleases(self):
1316 c_hash1_commit_log = """Update V8 to Version 4.2.71. 1688 c_hash1_commit_log = """Update V8 to Version 4.2.71.
1317 1689
1318 Cr-Commit-Position: refs/heads/master@{#5678} 1690 Cr-Commit-Position: refs/heads/master@{#5678}
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 "branch": "3.3", 1923 "branch": "3.3",
1552 "review_link": "fake.com", 1924 "review_link": "fake.com",
1553 "date": "18:15", 1925 "date": "18:15",
1554 "chromium_branch": "", 1926 "chromium_branch": "",
1555 "revision_link": "https://code.google.com/p/v8/source/detail?r=234", 1927 "revision_link": "https://code.google.com/p/v8/source/detail?r=234",
1556 },], 1928 },],
1557 } 1929 }
1558 self.assertEquals(expected_json, json.loads(FileToText(json_output))) 1930 self.assertEquals(expected_json, json.loads(FileToText(json_output)))
1559 1931
1560 1932
1933
1934
1561 class SystemTest(unittest.TestCase): 1935 class SystemTest(unittest.TestCase):
1562 def testReload(self): 1936 def testReload(self):
1563 options = ScriptsBase( 1937 options = ScriptsBase(
1564 TEST_CONFIG, DEFAULT_SIDE_EFFECT_HANDLER, {}).MakeOptions([]) 1938 TEST_CONFIG, DEFAULT_SIDE_EFFECT_HANDLER, {}).MakeOptions([])
1565 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, 1939 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={},
1566 options=options, 1940 options=options,
1567 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) 1941 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER)
1568 body = step.Reload( 1942 body = step.Reload(
1569 """------------------------------------------------------------------------ 1943 """------------------------------------------------------------------------
1570 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines 1944 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines
1571 1945
1572 Prepare push to trunk. Now working on version 3.23.11. 1946 Prepare push to trunk. Now working on version 3.23.11.
1573 1947
1574 R=danno@chromium.org 1948 R=danno@chromium.org
1575 1949
1576 Review URL: https://codereview.chromium.org/83173002 1950 Review URL: https://codereview.chromium.org/83173002
1577 1951
1578 ------------------------------------------------------------------------""") 1952 ------------------------------------------------------------------------""")
1579 self.assertEquals( 1953 self.assertEquals(
1580 """Prepare push to trunk. Now working on version 3.23.11. 1954 """Prepare push to trunk. Now working on version 3.23.11.
1581 1955
1582 R=danno@chromium.org 1956 R=danno@chromium.org
1583 1957
1584 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1958 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« tools/release/merge_to_branch.py ('K') | « tools/release/roll_merge.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698