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

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

Issue 868693002: Calculate new version based on latest tag when pushing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 self.Expect([ 609 self.Expect([
610 RL(""), # Open editor. 610 RL(""), # Open editor.
611 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], ""), 611 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], ""),
612 ]) 612 ])
613 613
614 self.RunStep(PushToTrunk, EditChangeLog) 614 self.RunStep(PushToTrunk, EditChangeLog)
615 615
616 self.assertEquals("New\n Lines", 616 self.assertEquals("New\n Lines",
617 FileToText(TEST_CONFIG["CHANGELOG_ENTRY_FILE"])) 617 FileToText(TEST_CONFIG["CHANGELOG_ENTRY_FILE"]))
618 618
619 # Version on trunk: 3.22.4.0. Version on master (bleeding_edge): 3.22.6. 619 TAGS = """
620 # Make sure that the increment is 3.22.7.0. 620 4425.0
621 def testIncrementVersion(self): 621 0.0.0.0
622 self.WriteFakeVersionFile() 622 3.9.6
623 self._state["last_push_trunk"] = "hash1" 623 3.22.4
624 self._state["latest_build"] = "6" 624 test_tag
625 self._state["latest_version"] = "3.22.6.0" 625 """
626 626
627 # Version as tag: 3.22.4.0. Version on master: 3.22.6.
628 # Make sure that the latest version is 3.22.6.0.
629 def testGetLatestVersion(self):
627 self.Expect([ 630 self.Expect([
628 Cmd("git checkout -f hash1 -- src/version.cc", ""), 631 Cmd("git tag", self.TAGS),
629 Cmd("git checkout -f origin/master -- src/version.cc", 632 Cmd("git checkout -f origin/master -- src/version.cc",
630 "", cb=lambda: self.WriteFakeVersionFile(22, 6)), 633 "", cb=lambda: self.WriteFakeVersionFile(22, 6)),
631 RL("Y"), # Increment build number.
632 ]) 634 ])
633 635
634 self.RunStep(PushToTrunk, IncrementVersion) 636 self.RunStep(PushToTrunk, GetLatestVersion)
635 637
636 self.assertEquals("3", self._state["new_major"]) 638 self.assertEquals("3", self._state["latest_major"])
637 self.assertEquals("22", self._state["new_minor"]) 639 self.assertEquals("22", self._state["latest_minor"])
638 self.assertEquals("7", self._state["new_build"]) 640 self.assertEquals("6", self._state["latest_build"])
639 self.assertEquals("0", self._state["new_patch"]) 641 self.assertEquals("0", self._state["latest_patch"])
640 642
641 def _TestSquashCommits(self, change_log, expected_msg): 643 def _TestSquashCommits(self, change_log, expected_msg):
642 TEST_CONFIG["CHANGELOG_ENTRY_FILE"] = self.MakeEmptyTempFile() 644 TEST_CONFIG["CHANGELOG_ENTRY_FILE"] = self.MakeEmptyTempFile()
643 with open(TEST_CONFIG["CHANGELOG_ENTRY_FILE"], "w") as f: 645 with open(TEST_CONFIG["CHANGELOG_ENTRY_FILE"], "w") as f:
644 f.write(change_log) 646 f.write(change_log)
645 647
646 self.Expect([ 648 self.Expect([
647 Cmd("git diff origin/candidates hash1", "patch content"), 649 Cmd("git diff origin/candidates hash1", "patch content"),
648 ]) 650 ])
649 651
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 change_log) 765 change_log)
764 766
765 force_flag = " -f" if not manual else "" 767 force_flag = " -f" if not manual else ""
766 expectations = [] 768 expectations = []
767 if not force: 769 if not force:
768 expectations.append(Cmd("which vi", "/usr/bin/vi")) 770 expectations.append(Cmd("which vi", "/usr/bin/vi"))
769 expectations += [ 771 expectations += [
770 Cmd("git status -s -uno", ""), 772 Cmd("git status -s -uno", ""),
771 Cmd("git status -s -b -uno", "## some_branch\n"), 773 Cmd("git status -s -b -uno", "## some_branch\n"),
772 Cmd("git fetch", ""), 774 Cmd("git fetch", ""),
775 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
773 Cmd("git branch", " branch1\n* branch2\n"), 776 Cmd("git branch", " branch1\n* branch2\n"),
774 Cmd("git branch", " branch1\n* branch2\n"), 777 Cmd("git branch", " branch1\n* branch2\n"),
775 Cmd(("git new-branch %s --upstream origin/master" % 778 Cmd(("git new-branch %s --upstream origin/master" %
776 TEST_CONFIG["BRANCHNAME"]), 779 TEST_CONFIG["BRANCHNAME"]),
777 ""), 780 ""),
778 Cmd(("git log -1 --format=%H --grep=" 781 Cmd(("git log -1 --format=%H --grep="
779 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " 782 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
780 "origin/candidates"), "hash2\n"), 783 "origin/candidates"), "hash2\n"),
781 Cmd("git log -1 hash2", "Log message\n"), 784 Cmd("git log -1 hash2", "Log message\n"),
782 ] 785 ]
783 if manual: 786 if manual:
784 expectations.append(RL("Y")) # Confirm last push. 787 expectations.append(RL("Y")) # Confirm last push.
785 expectations += [ 788 expectations += [
786 Cmd("git log -1 --format=%s hash2", 789 Cmd("git log -1 --format=%s hash2",
787 "Version 3.4.5 (based on abc3)\n"), 790 "Version 3.4.5 (based on abc3)\n"),
791 Cmd("git tag", self.TAGS),
788 Cmd("git checkout -f origin/master -- src/version.cc", 792 Cmd("git checkout -f origin/master -- src/version.cc",
789 "", cb=self.WriteFakeVersionFile), 793 "", cb=self.WriteFakeVersionFile),
790 Cmd("git checkout -f hash2 -- src/version.cc", "",
791 cb=self.WriteFakeVersionFile),
792 ]
793 if manual:
794 expectations.append(RL("")) # Increment build number.
795 expectations += [
796 Cmd("git log --format=%H abc3..push_hash", "rev1\n"), 794 Cmd("git log --format=%H abc3..push_hash", "rev1\n"),
797 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), 795 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
798 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), 796 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
799 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), 797 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"),
800 ] 798 ]
801 if manual: 799 if manual:
802 expectations.append(RL("")) # Open editor. 800 expectations.append(RL("")) # Open editor.
803 if not force: 801 if not force:
804 expectations.append( 802 expectations.append(
805 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], "")) 803 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], ""))
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 1503
1506 Review URL: https://codereview.chromium.org/83173002 1504 Review URL: https://codereview.chromium.org/83173002
1507 1505
1508 ------------------------------------------------------------------------""") 1506 ------------------------------------------------------------------------""")
1509 self.assertEquals( 1507 self.assertEquals(
1510 """Prepare push to trunk. Now working on version 3.23.11. 1508 """Prepare push to trunk. Now working on version 3.23.11.
1511 1509
1512 R=danno@chromium.org 1510 R=danno@chromium.org
1513 1511
1514 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1512 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698