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

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

Issue 878913002: Let release scripts determine version based on tags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unused method. Created 5 years, 10 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/release/push_to_candidates.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 15 matching lines...) Expand all
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 import os 29 import os
30 import shutil 30 import shutil
31 import tempfile 31 import tempfile
32 import traceback 32 import traceback
33 import unittest 33 import unittest
34 34
35 import auto_push 35 import auto_push
36 from auto_push import CheckLastPush 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 merge_to_branch 40 import merge_to_branch
41 from merge_to_branch import * 41 from merge_to_branch import *
42 import push_to_candidates 42 import push_to_candidates
43 from push_to_candidates import * 43 from push_to_candidates import *
44 import chromium_roll 44 import chromium_roll
45 from chromium_roll import ChromiumRoll 45 from chromium_roll import ChromiumRoll
46 import releases 46 import releases
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 expectations = [] 775 expectations = []
776 if not force: 776 if not force:
777 expectations.append(Cmd("which vi", "/usr/bin/vi")) 777 expectations.append(Cmd("which vi", "/usr/bin/vi"))
778 expectations += [ 778 expectations += [
779 Cmd("git status -s -uno", ""), 779 Cmd("git status -s -uno", ""),
780 Cmd("git status -s -b -uno", "## some_branch\n"), 780 Cmd("git status -s -b -uno", "## some_branch\n"),
781 Cmd("git fetch", ""), 781 Cmd("git fetch", ""),
782 Cmd("git branch", " branch1\n* branch2\n"), 782 Cmd("git branch", " branch1\n* branch2\n"),
783 Cmd("git branch", " branch1\n* branch2\n"), 783 Cmd("git branch", " branch1\n* branch2\n"),
784 Cmd(("git new-branch %s --upstream origin/master" % 784 Cmd(("git new-branch %s --upstream origin/master" %
785 TEST_CONFIG["BRANCHNAME"]), 785 TEST_CONFIG["BRANCHNAME"]), ""),
786 ""),
787 Cmd(("git log -1 --format=%H --grep="
788 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" "
789 "origin/candidates"), "hash2\n"),
790 Cmd("git log -1 hash2", "Log message\n"),
791 ]
792 if manual:
793 expectations.append(RL("Y")) # Confirm last push.
794 expectations += [
795 Cmd("git log -1 --format=%s hash2",
796 "Version 3.4.5 (based on abc3)\n"),
797 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), 786 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
798 Cmd("git tag", self.TAGS), 787 Cmd("git tag", self.TAGS),
799 Cmd("git checkout -f origin/master -- src/version.cc", 788 Cmd("git checkout -f origin/master -- src/version.cc",
800 "", cb=self.WriteFakeVersionFile), 789 "", cb=self.WriteFakeVersionFile),
790 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
791 Cmd("git log -1 --format=%s release_hash",
792 "Version 3.22.4 (based on abc3)\n"),
801 Cmd("git log --format=%H abc3..push_hash", "rev1\n"), 793 Cmd("git log --format=%H abc3..push_hash", "rev1\n"),
802 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), 794 Cmd("git log -1 --format=%s rev1", "Log text 1.\n"),
803 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), 795 Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"),
804 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), 796 Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"),
805 ] 797 ]
806 if manual: 798 if manual:
807 expectations.append(RL("")) # Open editor. 799 expectations.append(RL("")) # Open editor.
808 if not force: 800 if not force:
809 expectations.append( 801 expectations.append(
810 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], "")) 802 Cmd("vi %s" % TEST_CONFIG["CHANGELOG_ENTRY_FILE"], ""))
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 895
904 # Write fake deps file. 896 # Write fake deps file.
905 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", 897 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line",
906 os.path.join(chrome_dir, "DEPS")) 898 os.path.join(chrome_dir, "DEPS"))
907 def WriteDeps(): 899 def WriteDeps():
908 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", 900 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line",
909 os.path.join(chrome_dir, "DEPS")) 901 os.path.join(chrome_dir, "DEPS"))
910 902
911 expectations = [ 903 expectations = [
912 Cmd("git fetch origin", ""), 904 Cmd("git fetch origin", ""),
913 Cmd(("git log -1 --format=%H --grep=" 905 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
914 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 906 Cmd("git tag", self.TAGS),
915 "origin/candidates"), "push_hash\n"), 907 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"),
916 Cmd("git log -1 --format=%s push_hash", 908 Cmd("git log -1 --format=%s push_hash",
917 "Version 3.22.5 (based on abc)\n"), 909 "Version 3.22.5 (based on abc)\n"),
918 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", 910 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js",
919 "document.write('g_name')"), 911 "document.write('g_name')"),
920 Cmd("git status -s -uno", "", cwd=chrome_dir), 912 Cmd("git status -s -uno", "", cwd=chrome_dir),
921 Cmd("git checkout -f master", "", cwd=chrome_dir), 913 Cmd("git checkout -f master", "", cwd=chrome_dir),
922 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir), 914 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir),
923 Cmd("git pull", "", cwd=chrome_dir), 915 Cmd("git pull", "", cwd=chrome_dir),
924 Cmd("git fetch origin", ""), 916 Cmd("git fetch origin", ""),
925 Cmd("git new-branch v8-roll-push_hash", "", cwd=chrome_dir), 917 Cmd("git new-branch v8-roll-push_hash", "", cwd=chrome_dir),
(...skipping 12 matching lines...) Expand all
938 args = ["-a", "author@chromium.org", "-c", chrome_dir, 930 args = ["-a", "author@chromium.org", "-c", chrome_dir,
939 "--sheriff", "--googlers-mapping", googlers_mapping_py, 931 "--sheriff", "--googlers-mapping", googlers_mapping_py,
940 "-r", "reviewer@chromium.org"] 932 "-r", "reviewer@chromium.org"]
941 ChromiumRoll(TEST_CONFIG, self).Run(args) 933 ChromiumRoll(TEST_CONFIG, self).Run(args)
942 934
943 deps = FileToText(os.path.join(chrome_dir, "DEPS")) 935 deps = FileToText(os.path.join(chrome_dir, "DEPS"))
944 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) 936 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))
945 937
946 def testCheckLastPushRecently(self): 938 def testCheckLastPushRecently(self):
947 self.Expect([ 939 self.Expect([
948 Cmd(("git log -1 --format=%H --grep=" 940 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
949 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " 941 Cmd("git tag", self.TAGS),
950 "origin/candidates"), "hash2\n"), 942 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
951 Cmd("git log -1 --format=%s hash2", 943 Cmd("git log -1 --format=%s release_hash",
952 "Version 3.4.5 (based on abc123)\n"), 944 "Version 3.22.4 (based on abc3)\n"),
945 Cmd("git log --format=%H abc3..abc123", "\n"),
953 ]) 946 ])
954 947
955 self._state["candidate"] = "abc123" 948 self._state["candidate"] = "abc123"
956 self.assertEquals(0, self.RunStep( 949 self.assertEquals(0, self.RunStep(
957 auto_push.AutoPush, CheckLastPush, AUTO_PUSH_ARGS)) 950 auto_push.AutoPush, LastReleaseBailout, AUTO_PUSH_ARGS))
958 951
959 def testAutoPush(self): 952 def testAutoPush(self):
960 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 953 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
961 954
962 self.Expect([ 955 self.Expect([
963 Cmd("git status -s -uno", ""), 956 Cmd("git status -s -uno", ""),
964 Cmd("git status -s -b -uno", "## some_branch\n"), 957 Cmd("git status -s -b -uno", "## some_branch\n"),
965 Cmd("git fetch", ""), 958 Cmd("git fetch", ""),
966 Cmd("git fetch origin +refs/heads/candidate:refs/heads/candidate", ""), 959 Cmd("git fetch origin +refs/heads/roll:refs/heads/roll", ""),
967 Cmd("git show-ref -s refs/heads/candidate", "abc123\n"), 960 Cmd("git show-ref -s refs/heads/roll", "abc123\n"),
968 Cmd(("git log -1 --format=%H --grep=\"" 961 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
969 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" 962 Cmd("git tag", self.TAGS),
970 " origin/candidates"), "push_hash\n"), 963 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"),
971 Cmd("git log -1 --format=%s push_hash", 964 Cmd("git log -1 --format=%s release_hash",
972 "Version 3.4.5 (based on abc101)\n"), 965 "Version 3.22.4 (based on abc3)\n"),
966 Cmd("git log --format=%H abc3..abc123", "some_stuff\n"),
973 ]) 967 ])
974 968
975 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"]) 969 auto_push.AutoPush(TEST_CONFIG, self).Run(AUTO_PUSH_ARGS + ["--push"])
976 970
977 state = json.loads(FileToText("%s-state.json" 971 state = json.loads(FileToText("%s-state.json"
978 % TEST_CONFIG["PERSISTFILE_BASENAME"])) 972 % TEST_CONFIG["PERSISTFILE_BASENAME"]))
979 973
980 self.assertEquals("abc123", state["candidate"]) 974 self.assertEquals("abc123", state["candidate"])
981 975
982 def testAutoRollExistingRoll(self): 976 def testAutoRollExistingRoll(self):
(...skipping 20 matching lines...) Expand all
1003 } 997 }
1004 """ 998 """
1005 999
1006 def testAutoRollUpToDate(self): 1000 def testAutoRollUpToDate(self):
1007 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() 1001 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1008 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) 1002 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
1009 self.Expect([ 1003 self.Expect([
1010 URL("https://codereview.chromium.org/search", 1004 URL("https://codereview.chromium.org/search",
1011 "owner=author%40chromium.org&limit=30&closed=3&format=json", 1005 "owner=author%40chromium.org&limit=30&closed=3&format=json",
1012 ("{\"results\": [{\"subject\": \"different\"}]}")), 1006 ("{\"results\": [{\"subject\": \"different\"}]}")),
1013 Cmd("git fetch", ""), 1007 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1014 Cmd(("git log -1 --format=%H --grep=" 1008 Cmd("git tag", self.TAGS),
1015 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 1009 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"),
1016 "origin/candidates"), "push_hash\n"),
1017 Cmd("git log -1 --format=%B push_hash", self.C_V8_22624_LOG),
1018 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG),
1019 ]) 1010 ])
1020 1011
1021 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( 1012 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
1022 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) 1013 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]])
1023 self.assertEquals(0, result) 1014 self.assertEquals(0, result)
1024 1015
1025 def testAutoRoll(self): 1016 def testAutoRoll(self):
1026 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() 1017 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
1027 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) 1018 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
1028 TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"] = self.MakeEmptyTempFile() 1019 TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"] = self.MakeEmptyTempFile()
1029 TextToFile("fake key", TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"]) 1020 TextToFile("fake key", TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"])
1030 1021
1031 self.Expect([ 1022 self.Expect([
1032 URL("https://codereview.chromium.org/search", 1023 URL("https://codereview.chromium.org/search",
1033 "owner=author%40chromium.org&limit=30&closed=3&format=json", 1024 "owner=author%40chromium.org&limit=30&closed=3&format=json",
1034 ("{\"results\": [{\"subject\": \"different\"}]}")), 1025 ("{\"results\": [{\"subject\": \"different\"}]}")),
1035 Cmd("git fetch", ""), 1026 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
1036 Cmd(("git log -1 --format=%H --grep=" 1027 Cmd("git tag", self.TAGS),
1037 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " 1028 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"),
1038 "origin/candidates"), "push_hash\n"),
1039 Cmd("git log -1 --format=%B push_hash", self.C_V8_123456_LOG),
1040 Cmd("git log -1 --format=%B abcd123455", self.C_V8_123455_LOG),
1041 ]) 1029 ])
1042 1030
1043 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( 1031 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
1044 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"]) 1032 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"])
1045 self.assertEquals(0, result) 1033 self.assertEquals(0, result)
1046 1034
1047 def testMergeToBranch(self): 1035 def testMergeToBranch(self):
1048 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() 1036 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile()
1049 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) 1037 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git"))
1050 self.WriteFakeVersionFile(build=5) 1038 self.WriteFakeVersionFile(build=5)
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 1380
1393 Review URL: https://codereview.chromium.org/83173002 1381 Review URL: https://codereview.chromium.org/83173002
1394 1382
1395 ------------------------------------------------------------------------""") 1383 ------------------------------------------------------------------------""")
1396 self.assertEquals( 1384 self.assertEquals(
1397 """Prepare push to trunk. Now working on version 3.23.11. 1385 """Prepare push to trunk. Now working on version 3.23.11.
1398 1386
1399 R=danno@chromium.org 1387 R=danno@chromium.org
1400 1388
1401 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1389 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/release/push_to_candidates.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698