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

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

Issue 1002383002: Make release scripts more robust. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 def testGitMock(self): 431 def testGitMock(self):
432 self.Expect([Cmd("git --version", "git version 1.2.3"), 432 self.Expect([Cmd("git --version", "git version 1.2.3"),
433 Cmd("git dummy", "")]) 433 Cmd("git dummy", "")])
434 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version")) 434 self.assertEquals("git version 1.2.3", self.MakeStep().Git("--version"))
435 self.assertEquals("", self.MakeStep().Git("dummy")) 435 self.assertEquals("", self.MakeStep().Git("dummy"))
436 436
437 def testCommonPrepareDefault(self): 437 def testCommonPrepareDefault(self):
438 self.Expect([ 438 self.Expect([
439 Cmd("git status -s -uno", ""), 439 Cmd("git status -s -uno", ""),
440 Cmd("git status -s -b -uno", "## some_branch"), 440 Cmd("git checkout -f origin/master", ""),
441 Cmd("git fetch", ""), 441 Cmd("git fetch", ""),
442 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), 442 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]),
443 RL("Y"), 443 RL("Y"),
444 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), 444 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
445 ]) 445 ])
446 self.MakeStep().CommonPrepare() 446 self.MakeStep().CommonPrepare()
447 self.MakeStep().PrepareBranch() 447 self.MakeStep().PrepareBranch()
448 self.assertEquals("some_branch", self._state["current_branch"])
449 448
450 def testCommonPrepareNoConfirm(self): 449 def testCommonPrepareNoConfirm(self):
451 self.Expect([ 450 self.Expect([
452 Cmd("git status -s -uno", ""), 451 Cmd("git status -s -uno", ""),
453 Cmd("git status -s -b -uno", "## some_branch"), 452 Cmd("git checkout -f origin/master", ""),
454 Cmd("git fetch", ""), 453 Cmd("git fetch", ""),
455 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), 454 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]),
456 RL("n"), 455 RL("n"),
457 ]) 456 ])
458 self.MakeStep().CommonPrepare() 457 self.MakeStep().CommonPrepare()
459 self.assertRaises(Exception, self.MakeStep().PrepareBranch) 458 self.assertRaises(Exception, self.MakeStep().PrepareBranch)
460 self.assertEquals("some_branch", self._state["current_branch"])
461 459
462 def testCommonPrepareDeleteBranchFailure(self): 460 def testCommonPrepareDeleteBranchFailure(self):
463 self.Expect([ 461 self.Expect([
464 Cmd("git status -s -uno", ""), 462 Cmd("git status -s -uno", ""),
465 Cmd("git status -s -b -uno", "## some_branch"), 463 Cmd("git checkout -f origin/master", ""),
466 Cmd("git fetch", ""), 464 Cmd("git fetch", ""),
467 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]), 465 Cmd("git branch", " branch1\n* %s" % TEST_CONFIG["BRANCHNAME"]),
468 RL("Y"), 466 RL("Y"),
469 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], None), 467 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], None),
470 ]) 468 ])
471 self.MakeStep().CommonPrepare() 469 self.MakeStep().CommonPrepare()
472 self.assertRaises(Exception, self.MakeStep().PrepareBranch) 470 self.assertRaises(Exception, self.MakeStep().PrepareBranch)
473 self.assertEquals("some_branch", self._state["current_branch"])
474 471
475 def testInitialEnvironmentChecks(self): 472 def testInitialEnvironmentChecks(self):
476 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 473 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
477 os.environ["EDITOR"] = "vi" 474 os.environ["EDITOR"] = "vi"
478 self.Expect([ 475 self.Expect([
479 Cmd("which vi", "/usr/bin/vi"), 476 Cmd("which vi", "/usr/bin/vi"),
480 ]) 477 ])
481 self.MakeStep().InitialEnvironmentChecks(TEST_CONFIG["DEFAULT_CWD"]) 478 self.MakeStep().InitialEnvironmentChecks(TEST_CONFIG["DEFAULT_CWD"])
482 479
483 def testTagTimeout(self): 480 def testTagTimeout(self):
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 764
768 Performance and stability improvements on all platforms.\n""", 765 Performance and stability improvements on all platforms.\n""",
769 change_log) 766 change_log)
770 767
771 force_flag = " -f" if not manual else "" 768 force_flag = " -f" if not manual else ""
772 expectations = [] 769 expectations = []
773 if not force: 770 if not force:
774 expectations.append(Cmd("which vi", "/usr/bin/vi")) 771 expectations.append(Cmd("which vi", "/usr/bin/vi"))
775 expectations += [ 772 expectations += [
776 Cmd("git status -s -uno", ""), 773 Cmd("git status -s -uno", ""),
777 Cmd("git status -s -b -uno", "## some_branch\n"), 774 Cmd("git checkout -f origin/master", ""),
778 Cmd("git fetch", ""), 775 Cmd("git fetch", ""),
779 Cmd("git branch", " branch1\n* branch2\n"), 776 Cmd("git branch", " branch1\n* branch2\n"),
780 Cmd("git branch", " branch1\n* branch2\n"), 777 Cmd("git branch", " branch1\n* branch2\n"),
781 Cmd(("git new-branch %s --upstream origin/master" % 778 Cmd(("git new-branch %s --upstream origin/master" %
782 TEST_CONFIG["BRANCHNAME"]), ""), 779 TEST_CONFIG["BRANCHNAME"]), ""),
783 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), 780 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
784 Cmd("git tag", self.TAGS), 781 Cmd("git tag", self.TAGS),
785 Cmd("git checkout -f origin/master -- include/v8-version.h", 782 Cmd("git checkout -f origin/master -- include/v8-version.h",
786 "", cb=self.WriteFakeVersionFile), 783 "", cb=self.WriteFakeVersionFile),
787 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), 784 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 TEST_CONFIG["CANDIDATESBRANCH"]), "", cb=ResetToCandidates), 818 TEST_CONFIG["CANDIDATESBRANCH"]), "", cb=ResetToCandidates),
822 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "", 819 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "",
823 cb=CheckVersionCommit), 820 cb=CheckVersionCommit),
824 Cmd("git cl land -f --bypass-hooks", ""), 821 Cmd("git cl land -f --bypass-hooks", ""),
825 Cmd("git fetch", ""), 822 Cmd("git fetch", ""),
826 Cmd("git log -1 --format=%H --grep=" 823 Cmd("git log -1 --format=%H --grep="
827 "\"Version 3.22.5 (based on push_hash)\"" 824 "\"Version 3.22.5 (based on push_hash)\""
828 " origin/candidates", "hsh_to_tag"), 825 " origin/candidates", "hsh_to_tag"),
829 Cmd("git tag 3.22.5 hsh_to_tag", ""), 826 Cmd("git tag 3.22.5 hsh_to_tag", ""),
830 Cmd("git push origin 3.22.5", ""), 827 Cmd("git push origin 3.22.5", ""),
831 Cmd("git checkout -f some_branch", ""), 828 Cmd("git checkout -f origin/master", ""),
832 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), 829 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
833 Cmd("git branch -D %s" % TEST_CONFIG["CANDIDATESBRANCH"], ""), 830 Cmd("git branch -D %s" % TEST_CONFIG["CANDIDATESBRANCH"], ""),
834 ] 831 ]
835 self.Expect(expectations) 832 self.Expect(expectations)
836 833
837 args = ["-a", "author@chromium.org", "--revision", "push_hash"] 834 args = ["-a", "author@chromium.org", "--revision", "push_hash"]
838 if force: args.append("-f") 835 if force: args.append("-f")
839 if manual: args.append("-m") 836 if manual: args.append("-m")
840 else: args += ["-r", "reviewer@chromium.org"] 837 else: args += ["-r", "reviewer@chromium.org"]
841 PushToCandidates(TEST_CONFIG, self).Run(args) 838 PushToCandidates(TEST_CONFIG, self).Run(args)
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 version = FileToText( 1179 version = FileToText(
1183 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE)) 1180 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE))
1184 self.assertTrue(re.search(r"#define V8_MINOR_VERSION\s+22", version)) 1181 self.assertTrue(re.search(r"#define V8_MINOR_VERSION\s+22", version))
1185 self.assertTrue(re.search(r"#define V8_BUILD_NUMBER\s+5", version)) 1182 self.assertTrue(re.search(r"#define V8_BUILD_NUMBER\s+5", version))
1186 self.assertTrue(re.search(r"#define V8_PATCH_LEVEL\s+1", version)) 1183 self.assertTrue(re.search(r"#define V8_PATCH_LEVEL\s+1", version))
1187 self.assertTrue( 1184 self.assertTrue(
1188 re.search(r"#define V8_IS_CANDIDATE_VERSION\s+0", version)) 1185 re.search(r"#define V8_IS_CANDIDATE_VERSION\s+0", version))
1189 1186
1190 self.Expect([ 1187 self.Expect([
1191 Cmd("git status -s -uno", ""), 1188 Cmd("git status -s -uno", ""),
1192 Cmd("git status -s -b -uno", "## some_branch\n"), 1189 Cmd("git checkout -f origin/master", ""),
1193 Cmd("git fetch", ""), 1190 Cmd("git fetch", ""),
1194 Cmd("git branch", " branch1\n* branch2\n"), 1191 Cmd("git branch", " branch1\n* branch2\n"),
1195 Cmd("git new-branch %s --upstream refs/remotes/origin/candidates" % 1192 Cmd("git new-branch %s --upstream refs/remotes/origin/candidates" %
1196 TEST_CONFIG["BRANCHNAME"], ""), 1193 TEST_CONFIG["BRANCHNAME"], ""),
1197 Cmd(("git log --format=%H --grep=\"Port ab12345\" " 1194 Cmd(("git log --format=%H --grep=\"Port ab12345\" "
1198 "--reverse origin/master"), 1195 "--reverse origin/master"),
1199 "ab45678\nab23456"), 1196 "ab45678\nab23456"),
1200 Cmd("git log -1 --format=%s ab45678", "Title1"), 1197 Cmd("git log -1 --format=%s ab45678", "Title1"),
1201 Cmd("git log -1 --format=%s ab23456", "Title2"), 1198 Cmd("git log -1 --format=%s ab23456", "Title2"),
1202 Cmd(("git log --format=%H --grep=\"Port ab23456\" " 1199 Cmd(("git log --format=%H --grep=\"Port ab23456\" "
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 "Version 3.22.5.1 (cherry-pick)" 1253 "Version 3.22.5.1 (cherry-pick)"
1257 "\" refs/remotes/origin/candidates", 1254 "\" refs/remotes/origin/candidates",
1258 ""), 1255 ""),
1259 Cmd("git fetch", ""), 1256 Cmd("git fetch", ""),
1260 Cmd("git log -1 --format=%H --grep=\"" 1257 Cmd("git log -1 --format=%H --grep=\""
1261 "Version 3.22.5.1 (cherry-pick)" 1258 "Version 3.22.5.1 (cherry-pick)"
1262 "\" refs/remotes/origin/candidates", 1259 "\" refs/remotes/origin/candidates",
1263 "hsh_to_tag"), 1260 "hsh_to_tag"),
1264 Cmd("git tag 3.22.5.1 hsh_to_tag", ""), 1261 Cmd("git tag 3.22.5.1 hsh_to_tag", ""),
1265 Cmd("git push origin 3.22.5.1", ""), 1262 Cmd("git push origin 3.22.5.1", ""),
1266 Cmd("git checkout -f some_branch", ""), 1263 Cmd("git checkout -f origin/master", ""),
1267 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), 1264 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1268 ]) 1265 ])
1269 1266
1270 # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the 1267 # ab12345 and ab34567 are patches. ab23456 (included) and ab45678 are the
1271 # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567. 1268 # MIPS ports of ab12345. ab56789 is the MIPS port of ab34567.
1272 args = ["-f", "-p", extra_patch, "--branch", "candidates", 1269 args = ["-f", "-p", extra_patch, "--branch", "candidates",
1273 "ab12345", "ab23456", "ab34567"] 1270 "ab12345", "ab23456", "ab34567"]
1274 1271
1275 # The first run of the script stops because of git being down. 1272 # The first run of the script stops because of git being down.
1276 self.assertRaises(GitFailedException, 1273 self.assertRaises(GitFailedException,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 return lambda: self.WriteFakeVersionFile(major=major, 1340 return lambda: self.WriteFakeVersionFile(major=major,
1344 minor=minor, 1341 minor=minor,
1345 build=build, 1342 build=build,
1346 patch=patch) 1343 patch=patch)
1347 1344
1348 def ResetDEPS(revision): 1345 def ResetDEPS(revision):
1349 return lambda: WriteDEPS(revision) 1346 return lambda: WriteDEPS(revision)
1350 1347
1351 self.Expect([ 1348 self.Expect([
1352 Cmd("git status -s -uno", ""), 1349 Cmd("git status -s -uno", ""),
1353 Cmd("git status -s -b -uno", "## some_branch\n"), 1350 Cmd("git checkout -f origin/master", ""),
1354 Cmd("git fetch", ""), 1351 Cmd("git fetch", ""),
1355 Cmd("git branch", " branch1\n* branch2\n"), 1352 Cmd("git branch", " branch1\n* branch2\n"),
1356 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""), 1353 Cmd("git new-branch %s" % TEST_CONFIG["BRANCHNAME"], ""),
1357 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), 1354 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1358 Cmd("git rev-list --max-age=395200 --tags", 1355 Cmd("git rev-list --max-age=395200 --tags",
1359 "bad_tag\nhash_234\nhash_123\nhash_345\nhash_456\n"), 1356 "bad_tag\nhash_234\nhash_123\nhash_345\nhash_456\n"),
1360 Cmd("git describe --tags bad_tag", "3.23.42-1-deadbeef"), 1357 Cmd("git describe --tags bad_tag", "3.23.42-1-deadbeef"),
1361 Cmd("git describe --tags hash_234", "3.3.1.1"), 1358 Cmd("git describe --tags hash_234", "3.3.1.1"),
1362 Cmd("git describe --tags hash_123", "3.21.2"), 1359 Cmd("git describe --tags hash_123", "3.21.2"),
1363 Cmd("git describe --tags hash_345", "3.22.3"), 1360 Cmd("git describe --tags hash_345", "3.22.3"),
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS("hash_567"), 1433 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS("hash_567"),
1437 cwd=chrome_dir), 1434 cwd=chrome_dir),
1438 Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir), 1435 Cmd("git branch -r", " weird/123\n branch-heads/7\n", cwd=chrome_dir),
1439 Cmd("git checkout -f branch-heads/7 -- DEPS", "", 1436 Cmd("git checkout -f branch-heads/7 -- DEPS", "",
1440 cb=ResetDEPS("hash_345"), 1437 cb=ResetDEPS("hash_345"),
1441 cwd=chrome_dir), 1438 cwd=chrome_dir),
1442 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS("hash_567"), 1439 Cmd("git checkout -f HEAD -- DEPS", "", cb=ResetDEPS("hash_567"),
1443 cwd=chrome_dir), 1440 cwd=chrome_dir),
1444 Cmd("git checkout -f master", "", cwd=chrome_dir), 1441 Cmd("git checkout -f master", "", cwd=chrome_dir),
1445 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "", cwd=chrome_dir), 1442 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], "", cwd=chrome_dir),
1446 Cmd("git checkout -f some_branch", ""), 1443 Cmd("git checkout -f origin/master", ""),
1447 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), 1444 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
1448 ]) 1445 ])
1449 1446
1450 args = ["-c", TEST_CONFIG["CHROMIUM"], 1447 args = ["-c", TEST_CONFIG["CHROMIUM"],
1451 "--json", json_output, 1448 "--json", json_output,
1452 "--csv", csv_output, 1449 "--csv", csv_output,
1453 "--max-releases", "1"] 1450 "--max-releases", "1"]
1454 Releases(TEST_CONFIG, self).Run(args) 1451 Releases(TEST_CONFIG, self).Run(args)
1455 1452
1456 # Check expected output. 1453 # Check expected output.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 1536
1540 Review URL: https://codereview.chromium.org/83173002 1537 Review URL: https://codereview.chromium.org/83173002
1541 1538
1542 ------------------------------------------------------------------------""") 1539 ------------------------------------------------------------------------""")
1543 self.assertEquals( 1540 self.assertEquals(
1544 """Prepare push to trunk. Now working on version 3.23.11. 1541 """Prepare push to trunk. Now working on version 3.23.11.
1545 1542
1546 R=danno@chromium.org 1543 R=danno@chromium.org
1547 1544
1548 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
« tools/release/common_includes.py ('K') | « tools/release/common_includes.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698