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

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

Issue 641633002: Add test for tag pushing in push-to-trunk script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 def testPushToTrunkManual(self): 836 def testPushToTrunkManual(self):
837 self._PushToTrunk(manual=True) 837 self._PushToTrunk(manual=True)
838 838
839 def testPushToTrunkSemiAutomatic(self): 839 def testPushToTrunkSemiAutomatic(self):
840 self._PushToTrunk() 840 self._PushToTrunk()
841 841
842 def testPushToTrunkForced(self): 842 def testPushToTrunkForced(self):
843 self._PushToTrunk(force=True) 843 self._PushToTrunk(force=True)
844 844
845 def testPushToTrunkForcedNewGit(self):
Michael Achenbach 2014/10/08 13:07:40 This is a dirty c/p from the test above. The old v
846 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
847
848 # The version file on bleeding edge has build level 5, while the version
849 # file from trunk has build level 4.
850 self.WriteFakeVersionFile(build=5)
851
852 TEST_CONFIG["CHANGELOG_ENTRY_FILE"] = self.MakeEmptyTempFile()
853 TEST_CONFIG["CHANGELOG_FILE"] = self.MakeEmptyTempFile()
854 bleeding_edge_change_log = "2014-03-17: Sentinel\n"
855 TextToFile(bleeding_edge_change_log, TEST_CONFIG["CHANGELOG_FILE"])
856
857 def ResetChangeLog():
858 """On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog',
859 the ChangLog will be reset to its content on trunk."""
860 trunk_change_log = """1999-04-05: Version 3.22.4
861
862 Performance and stability improvements on all platforms.\n"""
863 TextToFile(trunk_change_log, TEST_CONFIG["CHANGELOG_FILE"])
864
865 def ResetToTrunk():
866 ResetChangeLog()
867 self.WriteFakeVersionFile()
868
869 def CheckSVNCommit():
870 commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"])
871 self.assertEquals(
872 """Version 3.22.5 (based on bleeding_edge revision r123455)
873
874 Log text 1 (issue 321).
875
876 Performance and stability improvements on all platforms.""", commit)
877 version = FileToText(
878 os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE))
879 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version))
880 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version))
881 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version))
882 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version))
883 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))
884
885 # Check that the change log on the trunk branch got correctly modified.
886 change_log = FileToText(TEST_CONFIG["CHANGELOG_FILE"])
887 self.assertEquals(
888 """1999-07-31: Version 3.22.5
889
890 Log text 1 (issue 321).
891
892 Performance and stability improvements on all platforms.
893
894
895 1999-04-05: Version 3.22.4
896
897 Performance and stability improvements on all platforms.\n""",
898 change_log)
899
900 expectations = [
901 Cmd("git status -s -uno", ""),
902 Cmd("git status -s -b -uno", "## some_branch\n"),
903 Cmd("git fetch", ""),
904 Cmd("git branch", " branch1\n* branch2\n"),
905 Cmd("git branch", " branch1\n* branch2\n"),
906 Cmd("git checkout -b %s origin/master" % TEST_CONFIG["BRANCHNAME"],
907 ""),
908 Cmd("git svn find-rev r123455", "push_hash\n"),
909 Cmd(("git log -1 --format=%H --grep="
910 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
911 "origin/candidates"), "hash2\n"),
912 Cmd("git log -1 hash2", "Log message\n"),
913 Cmd("git log -1 --format=%s hash2",
914 "Version 3.4.5 (based on bleeding_edge revision r1234)\n"),
915 Cmd("git svn find-rev r1234", "hash3\n"),
916 Cmd("git checkout -f origin/master -- src/version.cc",
917 "", cb=self.WriteFakeVersionFile),
918 Cmd("git checkout -f hash2 -- src/version.cc", "",
919 cb=self.WriteFakeVersionFile),
920 Cmd("git log --format=%H hash3..push_hash", "rev1\n"),
921 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
922 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
923 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"),
924 Cmd("git fetch", "fetch result\n"),
925 Cmd("git checkout -f origin/master", ""),
926 Cmd("git diff origin/candidates push_hash", "patch content\n"),
927 Cmd("git svn find-rev push_hash", "123455\n"),
928 Cmd("git checkout -b %s origin/candidates" % TEST_CONFIG["TRUNKBRANCH"],
929 "", cb=ResetToTrunk),
930 Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG["PATCH_FILE"], ""),
931 Cmd("git checkout -f origin/candidates -- %s" %
932 TEST_CONFIG["CHANGELOG_FILE"], "", cb=ResetChangeLog),
933 Cmd("git checkout -f origin/candidates -- src/version.cc", "",
934 cb=self.WriteFakeVersionFile),
935 Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "",
936 cb=CheckSVNCommit),
937 Cmd("git svn dcommit 2>&1", ""),
938 Cmd("git fetch", ""),
939 Cmd("git log -1 --format=%H --grep="
940 "\"Version 3.22.5 (based on bleeding_edge revision r123455)\""
941 " origin/candidates", "hsh_to_tag"),
942 Cmd("git tag 3.22.5 hsh_to_tag", ""),
943 Cmd("git push origin 3.22.5", ""),
944 Cmd("git checkout -f some_branch", ""),
945 Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""),
946 Cmd("git branch -D %s" % TEST_CONFIG["TRUNKBRANCH"], ""),
947 ]
948 self.Expect(expectations)
949
950 args = ["-a", "author@chromium.org", "--revision", "123455",
951 "--vc-interface", "git_read_svn_write", "-f",
Michael Achenbach 2014/10/08 13:07:40 The git tagging is still behind the flag --vc-inte
952 "-r", "reviewer@chromium.org"]
953 PushToTrunk(TEST_CONFIG, self).Run(args)
954
955 cl = FileToText(TEST_CONFIG["CHANGELOG_FILE"])
956 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl))
957 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl))
958 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl))
959
960 # Note: The version file is on build number 5 again in the end of this test
961 # since the git command that merges to the bleeding edge branch is mocked
962 # out.
963
845 C_V8_22624_LOG = """V8 CL. 964 C_V8_22624_LOG = """V8 CL.
846 965
847 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123 966 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123
848 967
849 """ 968 """
850 969
851 C_V8_123455_LOG = """V8 CL. 970 C_V8_123455_LOG = """V8 CL.
852 971
853 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123455 123 972 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123455 123
854 973
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 1819
1701 Review URL: https://codereview.chromium.org/83173002 1820 Review URL: https://codereview.chromium.org/83173002
1702 1821
1703 ------------------------------------------------------------------------""") 1822 ------------------------------------------------------------------------""")
1704 self.assertEquals( 1823 self.assertEquals(
1705 """Prepare push to trunk. Now working on version 3.23.11. 1824 """Prepare push to trunk. Now working on version 3.23.11.
1706 1825
1707 R=danno@chromium.org 1826 R=danno@chromium.org
1708 1827
1709 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1828 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698