| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 ["status -s -uno", ""], | 153 ["status -s -uno", ""], |
| 154 ["status -s -b -uno", "## some_branch"], | 154 ["status -s -b -uno", "## some_branch"], |
| 155 ["svn fetch", ""], | 155 ["svn fetch", ""], |
| 156 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], | 156 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], |
| 157 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 157 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
| 158 ["checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""], | 158 ["checkout -b %s" % TEST_CONFIG[TEMP_BRANCH], ""], |
| 159 ["branch", ""], | 159 ["branch", ""], |
| 160 ] | 160 ] |
| 161 self._rl_recipe = ["Y"] | 161 self._rl_recipe = ["Y"] |
| 162 self.MakeStep().CommonPrepare() | 162 self.MakeStep().CommonPrepare() |
| 163 self.MakeStep().PrepareBranch() |
| 163 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) | 164 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) |
| 164 | 165 |
| 165 def testCommonPrepareNoConfirm(self): | 166 def testCommonPrepareNoConfirm(self): |
| 166 self._git_recipe = [ | 167 self._git_recipe = [ |
| 167 ["status -s -uno", ""], | 168 ["status -s -uno", ""], |
| 168 ["status -s -b -uno", "## some_branch"], | 169 ["status -s -b -uno", "## some_branch"], |
| 169 ["svn fetch", ""], | 170 ["svn fetch", ""], |
| 170 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], | 171 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], |
| 171 ] | 172 ] |
| 172 self._rl_recipe = ["n"] | 173 self._rl_recipe = ["n"] |
| 173 self.assertRaises(Exception, self.MakeStep().CommonPrepare) | 174 self.MakeStep().CommonPrepare() |
| 175 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
| 174 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) | 176 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) |
| 175 | 177 |
| 176 def testCommonPrepareDeleteBranchFailure(self): | 178 def testCommonPrepareDeleteBranchFailure(self): |
| 177 self._git_recipe = [ | 179 self._git_recipe = [ |
| 178 ["status -s -uno", ""], | 180 ["status -s -uno", ""], |
| 179 ["status -s -b -uno", "## some_branch"], | 181 ["status -s -b -uno", "## some_branch"], |
| 180 ["svn fetch", ""], | 182 ["svn fetch", ""], |
| 181 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], | 183 ["branch", " branch1\n* %s" % TEST_CONFIG[TEMP_BRANCH]], |
| 182 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], None], | 184 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], None], |
| 183 ] | 185 ] |
| 184 self._rl_recipe = ["Y"] | 186 self._rl_recipe = ["Y"] |
| 185 self.assertRaises(Exception, self.MakeStep().CommonPrepare) | 187 self.MakeStep().CommonPrepare() |
| 188 self.assertRaises(Exception, self.MakeStep().PrepareBranch) |
| 186 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) | 189 self.assertEquals("some_branch", self.MakeStep().Restore("current_branch")) |
| 187 | 190 |
| 188 def testInitialEnvironmentChecks(self): | 191 def testInitialEnvironmentChecks(self): |
| 189 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() | 192 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() |
| 190 os.environ["EDITOR"] = "vi" | 193 os.environ["EDITOR"] = "vi" |
| 191 self.MakeStep().InitialEnvironmentChecks() | 194 self.MakeStep().InitialEnvironmentChecks() |
| 192 | 195 |
| 193 def testReadAndPersistVersion(self): | 196 def testReadAndPersistVersion(self): |
| 194 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() | 197 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() |
| 195 step = self.MakeStep() | 198 step = self.MakeStep() |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 "reviewer@chromium.org", # Chromium reviewer. | 424 "reviewer@chromium.org", # Chromium reviewer. |
| 422 ] | 425 ] |
| 423 | 426 |
| 424 class Options( object ): | 427 class Options( object ): |
| 425 pass | 428 pass |
| 426 | 429 |
| 427 options = Options() | 430 options = Options() |
| 428 options.s = 0 | 431 options.s = 0 |
| 429 options.l = None | 432 options.l = None |
| 430 options.c = TEST_CONFIG[CHROMIUM] | 433 options.c = TEST_CONFIG[CHROMIUM] |
| 431 RunScript(TEST_CONFIG, options, self) | 434 RunPushToTrunk(TEST_CONFIG, options, self) |
| 432 | 435 |
| 433 deps = FileToText(TEST_CONFIG[DEPS_FILE]) | 436 deps = FileToText(TEST_CONFIG[DEPS_FILE]) |
| 434 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) | 437 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) |
| 435 | 438 |
| 436 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) | 439 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) |
| 437 self.assertTrue(re.search(r"\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) | 440 self.assertTrue(re.search(r"\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
| 438 self.assertTrue(re.search(r" Log text 1", cl)) | 441 self.assertTrue(re.search(r" Log text 1", cl)) |
| 439 self.assertTrue(re.search(r" \(issue 321\)", cl)) | 442 self.assertTrue(re.search(r" \(issue 321\)", cl)) |
| 440 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) | 443 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) |
| 441 | 444 |
| 442 # Note: The version file is on build number 5 again in the end of this test | 445 # Note: The version file is on build number 5 again in the end of this test |
| 443 # since the git command that merges to the bleeding edge branch is mocked | 446 # since the git command that merges to the bleeding edge branch is mocked |
| 444 # out. | 447 # out. |
| OLD | NEW |