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

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

Issue 540513002: Make auto_roll run with a pure git checkout. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 793
794 def testPushToTrunkManual(self): 794 def testPushToTrunkManual(self):
795 self._PushToTrunk(manual=True) 795 self._PushToTrunk(manual=True)
796 796
797 def testPushToTrunkSemiAutomatic(self): 797 def testPushToTrunkSemiAutomatic(self):
798 self._PushToTrunk() 798 self._PushToTrunk()
799 799
800 def testPushToTrunkForced(self): 800 def testPushToTrunkForced(self):
801 self._PushToTrunk(force=True) 801 self._PushToTrunk(force=True)
802 802
803 C_V8_22624_LOG = """V8 CL.
804
805 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123
806
807 """
808
809 C_V8_123456_LOG = """V8 CL.
810
811 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123
812
813 """
814
803 def testChromiumRoll(self): 815 def testChromiumRoll(self):
804 googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME] 816 googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME]
805 with open(googlers_mapping_py, "w") as f: 817 with open(googlers_mapping_py, "w") as f:
806 f.write(""" 818 f.write("""
807 def list_to_dict(entries): 819 def list_to_dict(entries):
808 return {"g_name@google.com": "c_name@chromium.org"} 820 return {"g_name@google.com": "c_name@chromium.org"}
809 def get_list(): 821 def get_list():
810 pass""") 822 pass""")
811 823
812 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 824 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
813 if not os.path.exists(TEST_CONFIG[CHROMIUM]): 825 if not os.path.exists(TEST_CONFIG[CHROMIUM]):
814 os.makedirs(TEST_CONFIG[CHROMIUM]) 826 os.makedirs(TEST_CONFIG[CHROMIUM])
815 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")): 827 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")):
816 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8")) 828 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8"))
817 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", 829 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line",
818 TEST_CONFIG[DEPS_FILE]) 830 TEST_CONFIG[DEPS_FILE])
819 def WriteDeps(): 831 def WriteDeps():
820 TextToFile("Some line\n \"v8_revision\": \"123455\",\n some line", 832 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line",
821 TEST_CONFIG[DEPS_FILE]) 833 TEST_CONFIG[DEPS_FILE])
822 834
823 expectations = [ 835 expectations = [
824 Cmd("git status -s -uno", ""), 836 Cmd("git fetch origin", ""),
825 Cmd("git status -s -b -uno", "## some_branch\n"),
826 Cmd("git svn fetch", ""),
827 Cmd(("git log -1 --format=%H --grep=" 837 Cmd(("git log -1 --format=%H --grep="
828 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 838 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
829 "svn/trunk"), "push_hash\n"), 839 "origin/master"), "push_hash\n"),
830 Cmd("git svn find-rev push_hash", "123455\n"), 840 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
831 Cmd("git log -1 --format=%s push_hash", 841 Cmd("git log -1 --format=%s push_hash",
832 "Version 3.22.5 (based on bleeding_edge revision r123454)\n"), 842 "Version 3.22.5 (based on bleeding_edge revision r22622)\n"),
833 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", 843 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js",
834 "document.write('g_name')"), 844 "document.write('g_name')"),
835 Cmd("git status -s -uno", ""), 845 Cmd("git status -s -uno", ""),
836 Cmd("git checkout -f master", ""), 846 Cmd("git checkout -f master", ""),
837 Cmd("gclient sync --nohooks", "syncing..."), 847 Cmd("gclient sync --nohooks", "syncing..."),
838 Cmd("git pull", ""), 848 Cmd("git pull", ""),
839 Cmd("git fetch origin", ""), 849 Cmd("git fetch origin", ""),
840 Cmd("git checkout -b v8-roll-123455", ""), 850 Cmd("git checkout -b v8-roll-22624", ""),
841 Cmd("roll-dep v8 123455", "rolled", cb=WriteDeps), 851 Cmd("roll-dep v8 22624", "rolled", cb=WriteDeps),
842 Cmd(("git commit -am \"Update V8 to version 3.22.5 " 852 Cmd(("git commit -am \"Update V8 to version 3.22.5 "
843 "(based on bleeding_edge revision r123454).\n\n" 853 "(based on bleeding_edge revision r22622).\n\n"
844 "Please reply to the V8 sheriff c_name@chromium.org in " 854 "Please reply to the V8 sheriff c_name@chromium.org in "
845 "case of problems.\n\nTBR=c_name@chromium.org\" " 855 "case of problems.\n\nTBR=c_name@chromium.org\" "
846 "--author \"author@chromium.org <author@chromium.org>\""), 856 "--author \"author@chromium.org <author@chromium.org>\""),
847 ""), 857 ""),
848 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", ""), 858 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", ""),
849 ] 859 ]
850 self.Expect(expectations) 860 self.Expect(expectations)
851 861
852 args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM], 862 args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM],
853 "--sheriff", "--googlers-mapping", googlers_mapping_py, 863 "--sheriff", "--googlers-mapping", googlers_mapping_py,
854 "-r", "reviewer@chromium.org"] 864 "-r", "reviewer@chromium.org"]
855 ChromiumRoll(TEST_CONFIG, self).Run(args) 865 ChromiumRoll(TEST_CONFIG, self).Run(args)
856 866
857 deps = FileToText(TEST_CONFIG[DEPS_FILE]) 867 deps = FileToText(TEST_CONFIG[DEPS_FILE])
858 self.assertTrue(re.search("\"v8_revision\": \"123455\"", deps)) 868 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))
859 869
860 def testCheckLastPushRecently(self): 870 def testCheckLastPushRecently(self):
861 self.Expect([ 871 self.Expect([
862 Cmd(("git log -1 --format=%H --grep=" 872 Cmd(("git log -1 --format=%H --grep="
863 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " 873 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
864 "svn/trunk"), "hash2\n"), 874 "svn/trunk"), "hash2\n"),
865 Cmd("git log -1 --format=%s hash2", 875 Cmd("git log -1 --format=%s hash2",
866 "Version 3.4.5 (based on bleeding_edge revision r99)\n"), 876 "Version 3.4.5 (based on bleeding_edge revision r99)\n"),
867 ]) 877 ])
868 878
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 } 963 }
954 """ 964 """
955 965
956 def testAutoRollUpToDate(self): 966 def testAutoRollUpToDate(self):
957 self.Expect([ 967 self.Expect([
958 URL("https://codereview.chromium.org/search", 968 URL("https://codereview.chromium.org/search",
959 "owner=author%40chromium.org&limit=30&closed=3&format=json", 969 "owner=author%40chromium.org&limit=30&closed=3&format=json",
960 ("{\"results\": [{\"subject\": \"different\"}]}")), 970 ("{\"results\": [{\"subject\": \"different\"}]}")),
961 Cmd(("git log -1 --format=%H --grep=" 971 Cmd(("git log -1 --format=%H --grep="
962 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 972 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
963 "svn/trunk"), "push_hash\n"), 973 "origin/master"), "push_hash\n"),
964 Cmd("git svn find-rev push_hash", "123455\n"), 974 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
965 URL("http://src.chromium.org/svn/trunk/src/DEPS", 975 URL("http://src.chromium.org/svn/trunk/src/DEPS",
966 self.FAKE_DEPS), 976 self.FAKE_DEPS),
967 ]) 977 ])
968 978
969 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( 979 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
970 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) 980 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
971 self.assertEquals(1, result) 981 self.assertEquals(1, result)
972 982
973 def testAutoRoll(self): 983 def testAutoRoll(self):
974 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile() 984 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile()
975 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE]) 985 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE])
976 986
977 self.Expect([ 987 self.Expect([
978 URL("https://codereview.chromium.org/search", 988 URL("https://codereview.chromium.org/search",
979 "owner=author%40chromium.org&limit=30&closed=3&format=json", 989 "owner=author%40chromium.org&limit=30&closed=3&format=json",
980 ("{\"results\": [{\"subject\": \"different\"}]}")), 990 ("{\"results\": [{\"subject\": \"different\"}]}")),
981 Cmd(("git log -1 --format=%H --grep=" 991 Cmd(("git log -1 --format=%H --grep="
982 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 992 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
983 "svn/trunk"), "push_hash\n"), 993 "origin/master"), "push_hash\n"),
984 Cmd("git svn find-rev push_hash", "123456\n"), 994 Cmd("git log -1 --format=%B push_hash", self.C_V8_123456_LOG),
985 URL("http://src.chromium.org/svn/trunk/src/DEPS", 995 URL("http://src.chromium.org/svn/trunk/src/DEPS",
986 self.FAKE_DEPS), 996 self.FAKE_DEPS),
987 ]) 997 ])
988 998
989 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( 999 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
990 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"]) 1000 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"])
991 self.assertEquals(0, result) 1001 self.assertEquals(0, result)
992 1002
993 def testMergeToBranch(self): 1003 def testMergeToBranch(self):
994 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() 1004 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile()
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1173
1164 Cr-Commit-Position: refs/heads/master@{#4567} 1174 Cr-Commit-Position: refs/heads/master@{#4567}
1165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4567 0039-1c4b 1175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4567 0039-1c4b
1166 1176
1167 """ 1177 """
1168 c_hash3_commit_log = """Simple. 1178 c_hash3_commit_log = """Simple.
1169 1179
1170 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b 1180 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b
1171 1181
1172 """ 1182 """
1173 c_v8_22624_log = """V8 CL.
1174
1175 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123
1176
1177 """
1178 json_output = self.MakeEmptyTempFile() 1183 json_output = self.MakeEmptyTempFile()
1179 csv_output = self.MakeEmptyTempFile() 1184 csv_output = self.MakeEmptyTempFile()
1180 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile() 1185 TEST_CONFIG[VERSION_FILE] = self.MakeEmptyTempFile()
1181 self.WriteFakeVersionFile() 1186 self.WriteFakeVersionFile()
1182 1187
1183 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 1188 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
1184 if not os.path.exists(TEST_CONFIG[CHROMIUM]): 1189 if not os.path.exists(TEST_CONFIG[CHROMIUM]):
1185 os.makedirs(TEST_CONFIG[CHROMIUM]) 1190 os.makedirs(TEST_CONFIG[CHROMIUM])
1186 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")): 1191 if not os.path.exists(os.path.join(TEST_CONFIG[CHROMIUM], "v8")):
1187 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8")) 1192 os.makedirs(os.path.join(TEST_CONFIG[CHROMIUM], "v8"))
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 Cmd("git fetch origin", ""), 1261 Cmd("git fetch origin", ""),
1257 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n"), 1262 Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n"),
1258 Cmd("git diff --name-only c_hash1 c_hash1^", ""), 1263 Cmd("git diff --name-only c_hash1 c_hash1^", ""),
1259 Cmd("git diff --name-only c_hash2 c_hash2^", TEST_CONFIG[DEPS_FILE]), 1264 Cmd("git diff --name-only c_hash2 c_hash2^", TEST_CONFIG[DEPS_FILE]),
1260 Cmd("git checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "", 1265 Cmd("git checkout -f c_hash2 -- %s" % TEST_CONFIG[DEPS_FILE], "",
1261 cb=ResetDEPS("0123456789012345678901234567890123456789")), 1266 cb=ResetDEPS("0123456789012345678901234567890123456789")),
1262 Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log), 1267 Cmd("git log -1 --format=%B c_hash2", c_hash2_commit_log),
1263 Cmd("git rev-list -n 1 0123456789012345678901234567890123456789", 1268 Cmd("git rev-list -n 1 0123456789012345678901234567890123456789",
1264 "0123456789012345678901234567890123456789"), 1269 "0123456789012345678901234567890123456789"),
1265 Cmd("git log -1 --format=%B 0123456789012345678901234567890123456789", 1270 Cmd("git log -1 --format=%B 0123456789012345678901234567890123456789",
1266 c_v8_22624_log), 1271 self.C_V8_22624_LOG),
1267 Cmd("git diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]), 1272 Cmd("git diff --name-only c_hash3 c_hash3^", TEST_CONFIG[DEPS_FILE]),
1268 Cmd("git checkout -f c_hash3 -- %s" % TEST_CONFIG[DEPS_FILE], "", 1273 Cmd("git checkout -f c_hash3 -- %s" % TEST_CONFIG[DEPS_FILE], "",
1269 cb=ResetDEPS(345)), 1274 cb=ResetDEPS(345)),
1270 Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log), 1275 Cmd("git log -1 --format=%B c_hash3", c_hash3_commit_log),
1271 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", 1276 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "",
1272 cb=ResetDEPS(567)), 1277 cb=ResetDEPS(567)),
1273 Cmd("git branch -r", " weird/123\n branch-heads/7\n"), 1278 Cmd("git branch -r", " weird/123\n branch-heads/7\n"),
1274 Cmd("git checkout -f branch-heads/7 -- %s" % TEST_CONFIG[DEPS_FILE], "", 1279 Cmd("git checkout -f branch-heads/7 -- %s" % TEST_CONFIG[DEPS_FILE], "",
1275 cb=ResetDEPS(345)), 1280 cb=ResetDEPS(345)),
1276 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "", 1281 Cmd("git checkout -f HEAD -- %s" % TEST_CONFIG[DEPS_FILE], "",
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 1477
1473 Review URL: https://codereview.chromium.org/83173002 1478 Review URL: https://codereview.chromium.org/83173002
1474 1479
1475 ------------------------------------------------------------------------""") 1480 ------------------------------------------------------------------------""")
1476 self.assertEquals( 1481 self.assertEquals(
1477 """Prepare push to trunk. Now working on version 3.23.11. 1482 """Prepare push to trunk. Now working on version 3.23.11.
1478 1483
1479 R=danno@chromium.org 1484 R=danno@chromium.org
1480 1485
1481 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1486 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« tools/push-to-trunk/git_recipes.py ('K') | « tools/push-to-trunk/releases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698