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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 import os | 29 import os |
30 import tempfile | 30 import tempfile |
31 import traceback | 31 import traceback |
32 import unittest | 32 import unittest |
33 | 33 |
34 import auto_push | 34 import auto_push |
35 from auto_push import CheckLastPush | 35 from auto_push import CheckLastPush |
36 from auto_push import SETTINGS_LOCATION | 36 from auto_push import SETTINGS_LOCATION |
37 import auto_roll | 37 import auto_roll |
| 38 from auto_roll import CLUSTERFUZZ_API_KEY_FILE |
38 import common_includes | 39 import common_includes |
39 from common_includes import * | 40 from common_includes import * |
40 import merge_to_branch | 41 import merge_to_branch |
41 from merge_to_branch import * | 42 from merge_to_branch import * |
42 import push_to_trunk | 43 import push_to_trunk |
43 from push_to_trunk import * | 44 from push_to_trunk import * |
44 import chromium_roll | 45 import chromium_roll |
45 from chromium_roll import CHROMIUM | 46 from chromium_roll import CHROMIUM |
46 from chromium_roll import DEPS_FILE | 47 from chromium_roll import DEPS_FILE |
47 from chromium_roll import ChromiumRoll | 48 from chromium_roll import ChromiumRoll |
(...skipping 11 matching lines...) Expand all Loading... |
59 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", | 60 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", |
60 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", | 61 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", |
61 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", | 62 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", |
62 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", | 63 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", |
63 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", | 64 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", |
64 SETTINGS_LOCATION: None, | 65 SETTINGS_LOCATION: None, |
65 ALREADY_MERGING_SENTINEL_FILE: | 66 ALREADY_MERGING_SENTINEL_FILE: |
66 "/tmp/test-merge-to-branch-tempfile-already-merging", | 67 "/tmp/test-merge-to-branch-tempfile-already-merging", |
67 COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES", | 68 COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES", |
68 TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch", | 69 TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch", |
| 70 CLUSTERFUZZ_API_KEY_FILE: "/tmp/test-fake-cf-api-key", |
69 } | 71 } |
70 | 72 |
71 | 73 |
72 AUTO_PUSH_ARGS = [ | 74 AUTO_PUSH_ARGS = [ |
73 "-a", "author@chromium.org", | 75 "-a", "author@chromium.org", |
74 "-r", "reviewer@chromium.org", | 76 "-r", "reviewer@chromium.org", |
75 ] | 77 ] |
76 | 78 |
77 | 79 |
78 class ToplevelTest(unittest.TestCase): | 80 class ToplevelTest(unittest.TestCase): |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 379 |
378 def ReadLine(self): | 380 def ReadLine(self): |
379 return self._rl_mock.Call("readline") | 381 return self._rl_mock.Call("readline") |
380 | 382 |
381 def ReadURL(self, url, params): | 383 def ReadURL(self, url, params): |
382 if params is not None: | 384 if params is not None: |
383 return self._url_mock.Call("readurl", url, params) | 385 return self._url_mock.Call("readurl", url, params) |
384 else: | 386 else: |
385 return self._url_mock.Call("readurl", url) | 387 return self._url_mock.Call("readurl", url) |
386 | 388 |
| 389 def ReadClusterFuzzAPI(self, api_key, **params): |
| 390 # TODO(machenbach): Use a mock for this and add a test that stops rolling |
| 391 # due to clustefuzz results. |
| 392 return [] |
| 393 |
387 def Sleep(self, seconds): | 394 def Sleep(self, seconds): |
388 pass | 395 pass |
389 | 396 |
390 def GetDate(self): | 397 def GetDate(self): |
391 return "1999-07-31" | 398 return "1999-07-31" |
392 | 399 |
393 def ExpectGit(self, *args): | 400 def ExpectGit(self, *args): |
394 """Convenience wrapper.""" | 401 """Convenience wrapper.""" |
395 self._git_mock.Expect(*args) | 402 self._git_mock.Expect(*args) |
396 | 403 |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " | 996 "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" " |
990 "svn/trunk"), "push_hash\n"), | 997 "svn/trunk"), "push_hash\n"), |
991 Git("svn find-rev push_hash", "123455\n"), | 998 Git("svn find-rev push_hash", "123455\n"), |
992 ]) | 999 ]) |
993 | 1000 |
994 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 1001 result = auto_roll.AutoRoll(TEST_CONFIG, self).Run( |
995 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) | 1002 AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]]) |
996 self.assertEquals(1, result) | 1003 self.assertEquals(1, result) |
997 | 1004 |
998 def testAutoRoll(self): | 1005 def testAutoRoll(self): |
| 1006 TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile() |
| 1007 TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE]) |
999 self.ExpectReadURL([ | 1008 self.ExpectReadURL([ |
1000 URL("https://codereview.chromium.org/search", | 1009 URL("https://codereview.chromium.org/search", |
1001 "owner=author%40chromium.org&limit=30&closed=3&format=json", | 1010 "owner=author%40chromium.org&limit=30&closed=3&format=json", |
1002 ("{\"results\": [{\"subject\": \"different\"}]}")), | 1011 ("{\"results\": [{\"subject\": \"different\"}]}")), |
1003 URL("http://src.chromium.org/svn/trunk/src/DEPS", | 1012 URL("http://src.chromium.org/svn/trunk/src/DEPS", |
1004 self.FAKE_DEPS), | 1013 self.FAKE_DEPS), |
1005 ]) | 1014 ]) |
1006 | 1015 |
1007 self.ExpectGit([ | 1016 self.ExpectGit([ |
1008 Git(("log -1 --format=%H --grep=" | 1017 Git(("log -1 --format=%H --grep=" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 | 1280 |
1272 Review URL: https://codereview.chromium.org/83173002 | 1281 Review URL: https://codereview.chromium.org/83173002 |
1273 | 1282 |
1274 ------------------------------------------------------------------------""") | 1283 ------------------------------------------------------------------------""") |
1275 self.assertEquals( | 1284 self.assertEquals( |
1276 """Prepare push to trunk. Now working on version 3.23.11. | 1285 """Prepare push to trunk. Now working on version 3.23.11. |
1277 | 1286 |
1278 R=danno@chromium.org | 1287 R=danno@chromium.org |
1279 | 1288 |
1280 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1289 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
OLD | NEW |