| 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 15 matching lines...) Expand all  Loading... | 
| 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 tempfile | 30 import tempfile | 
| 31 import traceback | 31 import traceback | 
| 32 import unittest | 32 import unittest | 
| 33 | 33 | 
| 34 import auto_roll | 34 import auto_roll | 
| 35 from auto_roll import CheckLastPush | 35 from auto_roll import CheckLastPush | 
| 36 from auto_roll import FetchLatestRevision |  | 
| 37 from auto_roll import SETTINGS_LOCATION | 36 from auto_roll import SETTINGS_LOCATION | 
| 38 import common_includes | 37 import common_includes | 
| 39 from common_includes import * | 38 from common_includes import * | 
| 40 import merge_to_branch | 39 import merge_to_branch | 
| 41 from merge_to_branch import * | 40 from merge_to_branch import * | 
| 42 import push_to_trunk | 41 import push_to_trunk | 
| 43 from push_to_trunk import * | 42 from push_to_trunk import * | 
| 44 import chromium_roll | 43 import chromium_roll | 
| 45 from chromium_roll import CHROMIUM | 44 from chromium_roll import CHROMIUM | 
| 46 from chromium_roll import DEPS_FILE | 45 from chromium_roll import DEPS_FILE | 
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 825     self._ChromiumRoll(manual=True) | 824     self._ChromiumRoll(manual=True) | 
| 826 | 825 | 
| 827   def testChromiumRollSemiAutomatic(self): | 826   def testChromiumRollSemiAutomatic(self): | 
| 828     self._ChromiumRoll() | 827     self._ChromiumRoll() | 
| 829 | 828 | 
| 830   def testChromiumRollForced(self): | 829   def testChromiumRollForced(self): | 
| 831     self._ChromiumRoll(force=True) | 830     self._ChromiumRoll(force=True) | 
| 832 | 831 | 
| 833   def testCheckLastPushRecently(self): | 832   def testCheckLastPushRecently(self): | 
| 834     self.ExpectGit([ | 833     self.ExpectGit([ | 
| 835       Git("svn log -1 --oneline", "r101 | Text"), | 834       Git(("log -1 --format=%H --grep=" | 
| 836       Git("svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."), | 835            "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " | 
|  | 836            "svn/trunk"), "hash2\n"), | 
|  | 837       Git("log -1 --format=%s hash2", | 
|  | 838           "Version 3.4.5 (based on bleeding_edge revision r99)\n"), | 
| 837     ]) | 839     ]) | 
| 838 | 840 | 
| 839     self.RunStep(auto_roll.AutoRoll, FetchLatestRevision, AUTO_ROLL_ARGS) | 841     self._state["lkgr"] = "101" | 
|  | 842 | 
| 840     self.assertRaises(Exception, lambda: self.RunStep(auto_roll.AutoRoll, | 843     self.assertRaises(Exception, lambda: self.RunStep(auto_roll.AutoRoll, | 
| 841                                                       CheckLastPush, | 844                                                       CheckLastPush, | 
| 842                                                       AUTO_ROLL_ARGS)) | 845                                                       AUTO_ROLL_ARGS)) | 
| 843 | 846 | 
| 844   def testAutoRoll(self): | 847   def testAutoRoll(self): | 
| 845     password = self.MakeEmptyTempFile() | 848     password = self.MakeEmptyTempFile() | 
| 846     TextToFile("PW", password) | 849     TextToFile("PW", password) | 
| 847     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 850     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 
| 848     TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" | 851     TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" | 
| 849 | 852 | 
| 850     self.ExpectReadURL([ | 853     self.ExpectReadURL([ | 
| 851       URL("https://v8-status.appspot.com/current?format=json", | 854       URL("https://v8-status.appspot.com/current?format=json", | 
| 852           "{\"message\": \"Tree is throttled\"}"), | 855           "{\"message\": \"Tree is throttled\"}"), | 
| 853       URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), | 856       URL("https://v8-status.appspot.com/lkgr", Exception("Network problem")), | 
| 854       URL("https://v8-status.appspot.com/lkgr", "100"), | 857       URL("https://v8-status.appspot.com/lkgr", "100"), | 
| 855       URL("https://v8-status.appspot.com/status", | 858       URL("https://v8-status.appspot.com/status", | 
| 856           ("username=v8-auto-roll%40chromium.org&" | 859           ("username=v8-auto-roll%40chromium.org&" | 
| 857            "message=Tree+is+closed+%28preparing+to+push%29&password=PW"), ""), | 860            "message=Tree+is+closed+%28preparing+to+push%29&password=PW"), ""), | 
| 858       URL("https://v8-status.appspot.com/status", | 861       URL("https://v8-status.appspot.com/status", | 
| 859           ("username=v8-auto-roll%40chromium.org&" | 862           ("username=v8-auto-roll%40chromium.org&" | 
| 860            "message=Tree+is+throttled&password=PW"), ""), | 863            "message=Tree+is+throttled&password=PW"), ""), | 
| 861     ]) | 864     ]) | 
| 862 | 865 | 
| 863     self.ExpectGit([ | 866     self.ExpectGit([ | 
| 864       Git("status -s -uno", ""), | 867       Git("status -s -uno", ""), | 
| 865       Git("status -s -b -uno", "## some_branch\n"), | 868       Git("status -s -b -uno", "## some_branch\n"), | 
| 866       Git("svn fetch", ""), | 869       Git("svn fetch", ""), | 
| 867       Git("svn log -1 --oneline", "r100 | Text"), |  | 
| 868       Git(("log -1 --format=%H --grep=\"" | 870       Git(("log -1 --format=%H --grep=\"" | 
| 869            "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" | 871            "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" | 
| 870            " svn/trunk"), "push_hash\n"), | 872            " svn/trunk"), "push_hash\n"), | 
| 871       Git("svn find-rev push_hash", "65"), | 873       Git("log -1 --format=%s push_hash", | 
|  | 874           "Version 3.4.5 (based on bleeding_edge revision r79)\n"), | 
| 872     ]) | 875     ]) | 
| 873 | 876 | 
| 874     auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 877     auto_roll.AutoRoll(TEST_CONFIG, self).Run( | 
| 875         AUTO_ROLL_ARGS + ["--status-password", password, "--push"]) | 878         AUTO_ROLL_ARGS + ["--status-password", password, "--push"]) | 
| 876 | 879 | 
| 877     state = json.loads(FileToText("%s-state.json" | 880     state = json.loads(FileToText("%s-state.json" | 
| 878                                   % TEST_CONFIG[PERSISTFILE_BASENAME])) | 881                                   % TEST_CONFIG[PERSISTFILE_BASENAME])) | 
| 879 | 882 | 
| 880     self.assertEquals("100", state["lkgr"]) | 883     self.assertEquals("100", state["lkgr"]) | 
| 881     self.assertEquals("100", state["latest"]) |  | 
| 882 | 884 | 
| 883   def testAutoRollStoppedBySettings(self): | 885   def testAutoRollStoppedBySettings(self): | 
| 884     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 886     TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 
| 885     TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() | 887     TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() | 
| 886     TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION]) | 888     TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION]) | 
| 887 | 889 | 
| 888     self.ExpectReadURL([]) | 890     self.ExpectReadURL([]) | 
| 889 | 891 | 
| 890     self.ExpectGit([ | 892     self.ExpectGit([ | 
| 891       Git("status -s -uno", ""), | 893       Git("status -s -uno", ""), | 
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1059 | 1061 | 
| 1060 Review URL: https://codereview.chromium.org/83173002 | 1062 Review URL: https://codereview.chromium.org/83173002 | 
| 1061 | 1063 | 
| 1062 ------------------------------------------------------------------------""") | 1064 ------------------------------------------------------------------------""") | 
| 1063     self.assertEquals( | 1065     self.assertEquals( | 
| 1064 """Prepare push to trunk.  Now working on version 3.23.11. | 1066 """Prepare push to trunk.  Now working on version 3.23.11. | 
| 1065 | 1067 | 
| 1066 R=danno@chromium.org | 1068 R=danno@chromium.org | 
| 1067 | 1069 | 
| 1068 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 1070 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 
| OLD | NEW | 
|---|