| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 "PERSISTFILE_BASENAME": "/tmp/test-v8-push-to-candidates-tempfile", | 57 "PERSISTFILE_BASENAME": "/tmp/test-v8-push-to-candidates-tempfile", |
| 58 "CHANGELOG_ENTRY_FILE": | 58 "CHANGELOG_ENTRY_FILE": |
| 59 "/tmp/test-v8-push-to-candidates-tempfile-changelog-entry", | 59 "/tmp/test-v8-push-to-candidates-tempfile-changelog-entry", |
| 60 "PATCH_FILE": "/tmp/test-v8-push-to-candidates-tempfile-patch", | 60 "PATCH_FILE": "/tmp/test-v8-push-to-candidates-tempfile-patch", |
| 61 "COMMITMSG_FILE": "/tmp/test-v8-push-to-candidates-tempfile-commitmsg", | 61 "COMMITMSG_FILE": "/tmp/test-v8-push-to-candidates-tempfile-commitmsg", |
| 62 "CHROMIUM": "/tmp/test-v8-push-to-candidates-tempfile-chromium", | 62 "CHROMIUM": "/tmp/test-v8-push-to-candidates-tempfile-chromium", |
| 63 "SETTINGS_LOCATION": None, | 63 "SETTINGS_LOCATION": None, |
| 64 "ALREADY_MERGING_SENTINEL_FILE": | 64 "ALREADY_MERGING_SENTINEL_FILE": |
| 65 "/tmp/test-merge-to-branch-tempfile-already-merging", | 65 "/tmp/test-merge-to-branch-tempfile-already-merging", |
| 66 "TEMPORARY_PATCH_FILE": "/tmp/test-merge-to-branch-tempfile-temporary-patch", | 66 "TEMPORARY_PATCH_FILE": "/tmp/test-merge-to-branch-tempfile-temporary-patch", |
| 67 "CLUSTERFUZZ_API_KEY_FILE": "/tmp/test-fake-cf-api-key", | |
| 68 } | 67 } |
| 69 | 68 |
| 70 | 69 |
| 71 AUTO_PUSH_ARGS = [ | 70 AUTO_PUSH_ARGS = [ |
| 72 "-a", "author@chromium.org", | 71 "-a", "author@chromium.org", |
| 73 "-r", "reviewer@chromium.org", | 72 "-r", "reviewer@chromium.org", |
| 74 ] | 73 ] |
| 75 | 74 |
| 76 | 75 |
| 77 class ToplevelTest(unittest.TestCase): | 76 class ToplevelTest(unittest.TestCase): |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 389 |
| 391 def ReadLine(self): | 390 def ReadLine(self): |
| 392 return self._mock.Call("readline") | 391 return self._mock.Call("readline") |
| 393 | 392 |
| 394 def ReadURL(self, url, params): | 393 def ReadURL(self, url, params): |
| 395 if params is not None: | 394 if params is not None: |
| 396 return self._mock.Call("readurl", url, params) | 395 return self._mock.Call("readurl", url, params) |
| 397 else: | 396 else: |
| 398 return self._mock.Call("readurl", url) | 397 return self._mock.Call("readurl", url) |
| 399 | 398 |
| 400 def ReadClusterFuzzAPI(self, api_key, **params): | |
| 401 # TODO(machenbach): Use a mock for this and add a test that stops rolling | |
| 402 # due to clustefuzz results. | |
| 403 return [] | |
| 404 | |
| 405 def Sleep(self, seconds): | 399 def Sleep(self, seconds): |
| 406 pass | 400 pass |
| 407 | 401 |
| 408 def GetDate(self): | 402 def GetDate(self): |
| 409 return "1999-07-31" | 403 return "1999-07-31" |
| 410 | 404 |
| 411 def GetUTCStamp(self): | 405 def GetUTCStamp(self): |
| 412 return "1000000" | 406 return "1000000" |
| 413 | 407 |
| 414 def Expect(self, *args): | 408 def Expect(self, *args): |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 | 981 |
| 988 C_V8_123456_LOG = """V8 CL. | 982 C_V8_123456_LOG = """V8 CL. |
| 989 | 983 |
| 990 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123 | 984 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@123456 123 |
| 991 | 985 |
| 992 """ | 986 """ |
| 993 | 987 |
| 994 ROLL_COMMIT_MSG = """Update V8 to version 3.22.4 (based on abc). | 988 ROLL_COMMIT_MSG = """Update V8 to version 3.22.4 (based on abc). |
| 995 | 989 |
| 996 Summary of changes available at: | 990 Summary of changes available at: |
| 997 https://chromium.googlesource.com/v8/v8/+log/last_rol..abc | 991 https://chromium.googlesource.com/v8/v8/+log/last_rol..roll_hsh |
| 998 | 992 |
| 999 Please follow these instructions for assigning/CC'ing issues: | 993 Please follow these instructions for assigning/CC'ing issues: |
| 1000 https://code.google.com/p/v8-wiki/wiki/TriagingIssues | 994 https://code.google.com/p/v8-wiki/wiki/TriagingIssues |
| 1001 | 995 |
| 1002 TBR=g_name@chromium.org,reviewer@chromium.org""" | 996 TBR=g_name@chromium.org,reviewer@chromium.org""" |
| 1003 | 997 |
| 1004 def testChromiumRoll(self): | 998 def testChromiumRoll(self): |
| 1005 # Setup fake directory structures. | 999 # Setup fake directory structures. |
| 1006 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1000 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
| 1007 TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git")) | 1001 TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git")) |
| 1008 chrome_dir = TEST_CONFIG["CHROMIUM"] | 1002 chrome_dir = TEST_CONFIG["CHROMIUM"] |
| 1009 os.makedirs(os.path.join(chrome_dir, "v8")) | 1003 os.makedirs(os.path.join(chrome_dir, "v8")) |
| 1010 | 1004 |
| 1011 # Write fake deps file. | 1005 # Write fake deps file. |
| 1012 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", | 1006 TextToFile("Some line\n \"v8_revision\": \"123444\",\n some line", |
| 1013 os.path.join(chrome_dir, "DEPS")) | 1007 os.path.join(chrome_dir, "DEPS")) |
| 1014 def WriteDeps(): | 1008 def WriteDeps(): |
| 1015 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", | 1009 TextToFile("Some line\n \"v8_revision\": \"22624\",\n some line", |
| 1016 os.path.join(chrome_dir, "DEPS")) | 1010 os.path.join(chrome_dir, "DEPS")) |
| 1017 | 1011 |
| 1018 expectations = [ | 1012 expectations = [ |
| 1019 Cmd("git fetch origin", ""), | 1013 Cmd("git fetch origin", ""), |
| 1020 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1014 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1021 Cmd("git tag", self.TAGS), | 1015 Cmd("git log -1 --format=%s roll_hsh", |
| 1022 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"), | |
| 1023 Cmd("git log -1 --format=%s push_hash", | |
| 1024 "Version 3.22.4 (based on abc)\n"), | 1016 "Version 3.22.4 (based on abc)\n"), |
| 1025 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"), | 1017 Cmd("git describe --tags roll_hsh", "3.22.4"), |
| 1026 Cmd("git log -1 --format=%s push_hash", | |
| 1027 "Version 3.22.4 (based on abc)"), | |
| 1028 Cmd("git describe --tags last_roll_hsh", "3.22.2.1"), | 1018 Cmd("git describe --tags last_roll_hsh", "3.22.2.1"), |
| 1029 Cmd("git log -1 --format=%H 3.22.2", "last_roll_base_hash"), | |
| 1030 Cmd("git log -1 --format=%s last_roll_base_hash", "Version 3.22.2"), | |
| 1031 Cmd("git log -1 --format=%H last_roll_base_hash^", | |
| 1032 "last_roll_master_hash"), | |
| 1033 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", | 1019 URL("https://chromium-build.appspot.com/p/chromium/sheriff_v8.js", |
| 1034 "document.write('g_name')"), | 1020 "document.write('g_name')"), |
| 1035 Cmd("git status -s -uno", "", cwd=chrome_dir), | 1021 Cmd("git status -s -uno", "", cwd=chrome_dir), |
| 1036 Cmd("git checkout -f master", "", cwd=chrome_dir), | 1022 Cmd("git checkout -f master", "", cwd=chrome_dir), |
| 1037 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir), | 1023 Cmd("gclient sync --nohooks", "syncing...", cwd=chrome_dir), |
| 1038 Cmd("git pull", "", cwd=chrome_dir), | 1024 Cmd("git pull", "", cwd=chrome_dir), |
| 1039 Cmd("git fetch origin", ""), | 1025 Cmd("git fetch origin", ""), |
| 1040 Cmd("git new-branch v8-roll-push_hash", "", cwd=chrome_dir), | 1026 Cmd("git new-branch v8-roll-roll_hsh", "", cwd=chrome_dir), |
| 1041 Cmd("roll-dep v8 push_hash", "rolled", cb=WriteDeps, cwd=chrome_dir), | 1027 Cmd("roll-dep v8 roll_hsh", "rolled", cb=WriteDeps, cwd=chrome_dir), |
| 1042 Cmd(("git commit -am \"%s\" " | 1028 Cmd(("git commit -am \"%s\" " |
| 1043 "--author \"author@chromium.org <author@chromium.org>\"" % | 1029 "--author \"author@chromium.org <author@chromium.org>\"" % |
| 1044 self.ROLL_COMMIT_MSG), | 1030 self.ROLL_COMMIT_MSG), |
| 1045 "", cwd=chrome_dir), | 1031 "", cwd=chrome_dir), |
| 1046 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", "", | 1032 Cmd("git cl upload --send-mail --email \"author@chromium.org\" -f", "", |
| 1047 cwd=chrome_dir), | 1033 cwd=chrome_dir), |
| 1048 ] | 1034 ] |
| 1049 self.Expect(expectations) | 1035 self.Expect(expectations) |
| 1050 | 1036 |
| 1051 args = ["-a", "author@chromium.org", "-c", chrome_dir, | 1037 args = ["-a", "author@chromium.org", "-c", chrome_dir, |
| 1052 "--sheriff", | 1038 "--sheriff", |
| 1053 "-r", "reviewer@chromium.org", | 1039 "-r", "reviewer@chromium.org", |
| 1054 "--last-roll", "last_roll_hsh"] | 1040 "--last-roll", "last_roll_hsh", |
| 1041 "roll_hsh"] |
| 1055 ChromiumRoll(TEST_CONFIG, self).Run(args) | 1042 ChromiumRoll(TEST_CONFIG, self).Run(args) |
| 1056 | 1043 |
| 1057 deps = FileToText(os.path.join(chrome_dir, "DEPS")) | 1044 deps = FileToText(os.path.join(chrome_dir, "DEPS")) |
| 1058 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) | 1045 self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps)) |
| 1059 | 1046 |
| 1060 def testCheckLastPushRecently(self): | 1047 def testCheckLastPushRecently(self): |
| 1061 self.Expect([ | 1048 self.Expect([ |
| 1062 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1049 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1063 Cmd("git tag", self.TAGS), | 1050 Cmd("git tag", self.TAGS), |
| 1064 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), | 1051 Cmd("git log -1 --format=%H 3.22.4", "release_hash\n"), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 """ | 1103 """ |
| 1117 | 1104 |
| 1118 def testAutoRollUpToDate(self): | 1105 def testAutoRollUpToDate(self): |
| 1119 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1106 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
| 1120 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) | 1107 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) |
| 1121 self.Expect([ | 1108 self.Expect([ |
| 1122 URL("https://codereview.chromium.org/search", | 1109 URL("https://codereview.chromium.org/search", |
| 1123 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1110 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
| 1124 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1111 ("{\"results\": [{\"subject\": \"different\"}]}")), |
| 1125 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1112 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1126 Cmd("git tag", self.TAGS), | 1113 Cmd("git rev-list --max-age=740800 --tags", |
| 1127 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"), | 1114 "bad_tag\nhash_234\nhash_123"), |
| 1115 Cmd("git describe --tags bad_tag", ""), |
| 1116 Cmd("git describe --tags hash_234", "3.22.4"), |
| 1117 Cmd("git describe --tags hash_123", "3.22.3"), |
| 1118 Cmd("git log --format=%H abcd123455..hash_234", ""), |
| 1119 Cmd("git log --format=%H abcd123455..hash_123", ""), |
| 1128 ]) | 1120 ]) |
| 1129 | 1121 |
| 1130 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1122 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
| 1131 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) | 1123 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"]]) |
| 1132 self.assertEquals(0, result) | 1124 self.assertEquals(0, result) |
| 1133 | 1125 |
| 1134 def testAutoRoll(self): | 1126 def testAutoRoll(self): |
| 1135 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() | 1127 TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory() |
| 1136 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) | 1128 TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS")) |
| 1137 TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"] = self.MakeEmptyTempFile() | |
| 1138 TextToFile("fake key", TEST_CONFIG["CLUSTERFUZZ_API_KEY_FILE"]) | |
| 1139 | 1129 |
| 1140 self.Expect([ | 1130 self.Expect([ |
| 1141 URL("https://codereview.chromium.org/search", | 1131 URL("https://codereview.chromium.org/search", |
| 1142 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1132 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
| 1143 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1133 ("{\"results\": [{\"subject\": \"different\"}]}")), |
| 1144 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), | 1134 Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""), |
| 1145 Cmd("git tag", self.TAGS), | 1135 Cmd("git rev-list --max-age=740800 --tags", |
| 1146 Cmd("git log -1 --format=%H 3.22.4", "push_hash\n"), | 1136 "bad_tag\nhash_234\nhash_123"), |
| 1137 Cmd("git describe --tags bad_tag", ""), |
| 1138 Cmd("git describe --tags hash_234", "3.22.4"), |
| 1139 Cmd("git describe --tags hash_123", "3.22.3"), |
| 1140 Cmd("git log --format=%H abcd123455..hash_234", "hash1\nhash2\n"), |
| 1147 ]) | 1141 ]) |
| 1148 | 1142 |
| 1149 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1143 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
| 1150 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"]) | 1144 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG["CHROMIUM"], "--roll"]) |
| 1151 self.assertEquals(0, result) | 1145 self.assertEquals(0, result) |
| 1152 | 1146 |
| 1153 def testMergeToBranch(self): | 1147 def testMergeToBranch(self): |
| 1154 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() | 1148 TEST_CONFIG["ALREADY_MERGING_SENTINEL_FILE"] = self.MakeEmptyTempFile() |
| 1155 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) | 1149 TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
| 1156 self.WriteFakeVersionFile(build=5) | 1150 self.WriteFakeVersionFile(build=5) |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 | 1540 |
| 1547 Review URL: https://codereview.chromium.org/83173002 | 1541 Review URL: https://codereview.chromium.org/83173002 |
| 1548 | 1542 |
| 1549 ------------------------------------------------------------------------""") | 1543 ------------------------------------------------------------------------""") |
| 1550 self.assertEquals( | 1544 self.assertEquals( |
| 1551 """Prepare push to trunk. Now working on version 3.23.11. | 1545 """Prepare push to trunk. Now working on version 3.23.11. |
| 1552 | 1546 |
| 1553 R=danno@chromium.org | 1547 R=danno@chromium.org |
| 1554 | 1548 |
| 1555 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1549 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
| OLD | NEW |