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

Side by Side Diff: tools/push-to-trunk/test_scripts.py

Issue 185263003: Refactoring: Make script dependencies more object-oriented in push and merge scripts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.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 14 matching lines...) Expand all
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 AutoRollOptions
36 from auto_roll import CheckLastPush 35 from auto_roll import CheckLastPush
37 from auto_roll import FetchLatestRevision 36 from auto_roll import FetchLatestRevision
38 from auto_roll import SETTINGS_LOCATION 37 from auto_roll import SETTINGS_LOCATION
39 import common_includes 38 import common_includes
40 from common_includes import * 39 from common_includes import *
41 import merge_to_branch 40 import merge_to_branch
42 from merge_to_branch import * 41 from merge_to_branch import *
43 import push_to_trunk 42 import push_to_trunk
44 from push_to_trunk import * 43 from push_to_trunk import *
45 44
(...skipping 19 matching lines...) Expand all
65 } 64 }
66 65
67 66
68 AUTO_ROLL_ARGS = [ 67 AUTO_ROLL_ARGS = [
69 "-a", "author@chromium.org", 68 "-a", "author@chromium.org",
70 "-c", TEST_CONFIG[CHROMIUM], 69 "-c", TEST_CONFIG[CHROMIUM],
71 "-r", "reviewer@chromium.org", 70 "-r", "reviewer@chromium.org",
72 ] 71 ]
73 72
74 73
75 def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None, a=None,
76 status_password=None, revert_bleeding_edge=None, p=None):
77 """Convenience wrapper."""
78 class Options(object):
79 pass
80 options = Options()
81 options.step = s
82 options.last_push = l
83 options.force = f
84 options.manual = m
85 options.reviewer = r
86 options.chromium = c
87 options.author = a
88 options.push = p
89 options.status_password = status_password
90 options.revert_bleeding_edge = revert_bleeding_edge
91 return options
92
93
94 class ToplevelTest(unittest.TestCase): 74 class ToplevelTest(unittest.TestCase):
95 def testMakeComment(self): 75 def testMakeComment(self):
96 self.assertEquals("# Line 1\n# Line 2\n#", 76 self.assertEquals("# Line 1\n# Line 2\n#",
97 MakeComment(" Line 1\n Line 2\n")) 77 MakeComment(" Line 1\n Line 2\n"))
98 self.assertEquals("#Line 1\n#Line 2", 78 self.assertEquals("#Line 1\n#Line 2",
99 MakeComment("Line 1\n Line 2")) 79 MakeComment("Line 1\n Line 2"))
100 80
101 def testStripComments(self): 81 def testStripComments(self):
102 self.assertEquals(" Line 1\n Line 3\n", 82 self.assertEquals(" Line 1\n Line 3\n",
103 StripComments(" Line 1\n# Line 2\n Line 3\n#\n")) 83 StripComments(" Line 1\n# Line 2\n Line 3\n#\n"))
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 f.write(" // Some line...\n") 275 f.write(" // Some line...\n")
296 f.write("\n") 276 f.write("\n")
297 f.write("#define MAJOR_VERSION 3\n") 277 f.write("#define MAJOR_VERSION 3\n")
298 f.write("#define MINOR_VERSION 22\n") 278 f.write("#define MINOR_VERSION 22\n")
299 f.write("#define BUILD_NUMBER 5\n") 279 f.write("#define BUILD_NUMBER 5\n")
300 f.write("#define PATCH_LEVEL 0\n") 280 f.write("#define PATCH_LEVEL 0\n")
301 f.write(" // Some line...\n") 281 f.write(" // Some line...\n")
302 f.write("#define IS_CANDIDATE_VERSION 0\n") 282 f.write("#define IS_CANDIDATE_VERSION 0\n")
303 return name 283 return name
304 284
305 def MakeStep(self, step_class=Step, state=None, options=None): 285 def MakeStep(self):
306 """Convenience wrapper.""" 286 """Convenience wrapper."""
307 options = options or CommonOptions(MakeOptions()) 287 options = ScriptsBase(TEST_CONFIG, self, self._state).MakeOptions([])
308 state = state if state is not None else self._state 288 return MakeStep(step_class=Step, state=self._state,
309 return MakeStep(step_class=step_class, number=0, state=state, 289 config=TEST_CONFIG, side_effect_handler=self,
310 config=TEST_CONFIG, options=options, 290 options=options)
311 side_effect_handler=self) 291
292 def RunStep(self, script=PushToTrunk, step_class=Step, args=None):
293 """Convenience wrapper."""
294 args = args or ["-m"]
295 return script(TEST_CONFIG, self, self._state).RunSteps([step_class], args)
312 296
313 def GitMock(self, cmd, args="", pipe=True): 297 def GitMock(self, cmd, args="", pipe=True):
314 print "%s %s" % (cmd, args) 298 print "%s %s" % (cmd, args)
315 return self._git_mock.Call(args) 299 return self._git_mock.Call(args)
316 300
317 def LogMock(self, cmd, args=""): 301 def LogMock(self, cmd, args=""):
318 print "Log: %s %s" % (cmd, args) 302 print "Log: %s %s" % (cmd, args)
319 303
320 MOCKS = { 304 MOCKS = {
321 "git": GitMock, 305 "git": GitMock,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 ["log -1 --format=%an rev4", "author4@chromium.org"], 467 ["log -1 --format=%an rev4", "author4@chromium.org"],
484 ]) 468 ])
485 469
486 # The cl for rev4 on rietveld has an updated LOG flag. 470 # The cl for rev4 on rietveld has an updated LOG flag.
487 self.ExpectReadURL([ 471 self.ExpectReadURL([
488 ["https://codereview.chromium.org/9876543210/description", 472 ["https://codereview.chromium.org/9876543210/description",
489 "Title\n\nBUG=456\nLOG=N\n\n"], 473 "Title\n\nBUG=456\nLOG=N\n\n"],
490 ]) 474 ])
491 475
492 self._state["last_push_bleeding_edge"] = "1234" 476 self._state["last_push_bleeding_edge"] = "1234"
493 self.MakeStep(PrepareChangeLog).Run() 477 self.RunStep(PushToTrunk, PrepareChangeLog)
494 478
495 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]) 479 actual_cl = FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE])
496 480
497 expected_cl = """1999-07-31: Version 3.22.5 481 expected_cl = """1999-07-31: Version 3.22.5
498 482
499 Title text 1. 483 Title text 1.
500 484
501 Title text 3 (Chromium issue 321). 485 Title text 3 (Chromium issue 321).
502 486
503 Performance and stability improvements on all platforms. 487 Performance and stability improvements on all platforms.
(...skipping 26 matching lines...) Expand all
530 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() 514 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
531 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() 515 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
532 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE]) 516 TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE])
533 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE]) 517 TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE])
534 os.environ["EDITOR"] = "vi" 518 os.environ["EDITOR"] = "vi"
535 519
536 self.ExpectReadline([ 520 self.ExpectReadline([
537 "", # Open editor. 521 "", # Open editor.
538 ]) 522 ])
539 523
540 self.MakeStep(EditChangeLog).Run() 524 self.RunStep(PushToTrunk, EditChangeLog)
541 525
542 self.assertEquals("New\n Lines\n\n\n Original CL", 526 self.assertEquals("New\n Lines\n\n\n Original CL",
543 FileToText(TEST_CONFIG[CHANGELOG_FILE])) 527 FileToText(TEST_CONFIG[CHANGELOG_FILE]))
544 528
545 def testIncrementVersion(self): 529 def testIncrementVersion(self):
546 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() 530 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile()
547 self._state["build"] = "5" 531 self._state["build"] = "5"
548 532
549 self.ExpectReadline([ 533 self.ExpectReadline([
550 "Y", # Increment build number. 534 "Y", # Increment build number.
551 ]) 535 ])
552 536
553 self.MakeStep(IncrementVersion).Run() 537 self.RunStep(PushToTrunk, IncrementVersion)
554 538
555 self.assertEquals("3", self._state["new_major"]) 539 self.assertEquals("3", self._state["new_major"])
556 self.assertEquals("22", self._state["new_minor"]) 540 self.assertEquals("22", self._state["new_minor"])
557 self.assertEquals("6", self._state["new_build"]) 541 self.assertEquals("6", self._state["new_build"])
558 self.assertEquals("0", self._state["new_patch"]) 542 self.assertEquals("0", self._state["new_patch"])
559 543
560 def testLastChangeLogEntries(self): 544 def testLastChangeLogEntries(self):
561 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile() 545 TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
562 l = """ 546 l = """
563 Fixed something. 547 Fixed something.
(...skipping 15 matching lines...) Expand all
579 f.write(change_log) 563 f.write(change_log)
580 564
581 self.ExpectGit([ 565 self.ExpectGit([
582 ["diff svn/trunk hash1", "patch content"], 566 ["diff svn/trunk hash1", "patch content"],
583 ["svn find-rev hash1", "123455\n"], 567 ["svn find-rev hash1", "123455\n"],
584 ]) 568 ])
585 569
586 self._state["prepare_commit_hash"] = "hash1" 570 self._state["prepare_commit_hash"] = "hash1"
587 self._state["date"] = "1999-11-11" 571 self._state["date"] = "1999-11-11"
588 572
589 self.MakeStep(SquashCommits).Run() 573 self.RunStep(PushToTrunk, SquashCommits)
590 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) 574 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg)
591 575
592 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) 576 patch = FileToText(TEST_CONFIG[ PATCH_FILE])
593 self.assertTrue(re.search(r"patch content", patch)) 577 self.assertTrue(re.search(r"patch content", patch))
594 578
595 def testSquashCommitsUnformatted(self): 579 def testSquashCommitsUnformatted(self):
596 change_log = """1999-11-11: Version 3.22.5 580 change_log = """1999-11-11: Version 3.22.5
597 581
598 Log text 1. 582 Log text 1.
599 Chromium issue 12345 583 Chromium issue 12345
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 ]) 728 ])
745 729
746 # No keyboard input in forced mode: 730 # No keyboard input in forced mode:
747 if force: 731 if force:
748 self.ExpectReadline([]) 732 self.ExpectReadline([])
749 733
750 args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM]] 734 args = ["-a", "author@chromium.org", "-c", TEST_CONFIG[CHROMIUM]]
751 if force: args.append("-f") 735 if force: args.append("-f")
752 if manual: args.append("-m") 736 if manual: args.append("-m")
753 else: args += ["-r", "reviewer@chromium.org"] 737 else: args += ["-r", "reviewer@chromium.org"]
754 options = push_to_trunk.BuildOptions().parse_args(args) 738 PushToTrunk(TEST_CONFIG, self).Run(args)
755 RunPushToTrunk(TEST_CONFIG, PushToTrunkOptions(options), self)
756 739
757 deps = FileToText(TEST_CONFIG[DEPS_FILE]) 740 deps = FileToText(TEST_CONFIG[DEPS_FILE])
758 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps)) 741 self.assertTrue(re.search("\"v8_revision\": \"123456\"", deps))
759 742
760 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE]) 743 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE])
761 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) 744 self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl))
762 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) 745 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl))
763 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) 746 self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl))
764 747
765 # Note: The version file is on build number 5 again in the end of this test 748 # Note: The version file is on build number 5 again in the end of this test
766 # since the git command that merges to the bleeding edge branch is mocked 749 # since the git command that merges to the bleeding edge branch is mocked
767 # out. 750 # out.
768 751
769 def testPushToTrunkManual(self): 752 def testPushToTrunkManual(self):
770 self._PushToTrunk(manual=True) 753 self._PushToTrunk(manual=True)
771 754
772 def testPushToTrunkSemiAutomatic(self): 755 def testPushToTrunkSemiAutomatic(self):
773 self._PushToTrunk() 756 self._PushToTrunk()
774 757
775 def testPushToTrunkForced(self): 758 def testPushToTrunkForced(self):
776 self._PushToTrunk(force=True) 759 self._PushToTrunk(force=True)
777 760
778 def testCheckLastPushRecently(self): 761 def testCheckLastPushRecently(self):
779 self.ExpectGit([ 762 self.ExpectGit([
780 ["svn log -1 --oneline", "r101 | Text"], 763 ["svn log -1 --oneline", "r101 | Text"],
781 ["svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."], 764 ["svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."],
782 ]) 765 ])
783 766
784 state = {} 767 self.RunStep(auto_roll.AutoRoll, FetchLatestRevision, AUTO_ROLL_ARGS)
785 self.MakeStep(FetchLatestRevision, state=state).Run() 768 self.assertRaises(Exception, lambda: self.RunStep(auto_roll.AutoRoll,
786 self.assertRaises(Exception, self.MakeStep(CheckLastPush, state=state).Run) 769 CheckLastPush,
770 AUTO_ROLL_ARGS))
787 771
788 def testAutoRoll(self): 772 def testAutoRoll(self):
789 password = self.MakeEmptyTempFile() 773 password = self.MakeEmptyTempFile()
790 TextToFile("PW", password) 774 TextToFile("PW", password)
791 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 775 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
792 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" 776 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
793 777
794 self.ExpectReadURL([ 778 self.ExpectReadURL([
795 ["https://v8-status.appspot.com/current?format=json", 779 ["https://v8-status.appspot.com/current?format=json",
796 "{\"message\": \"Tree is throttled\"}"], 780 "{\"message\": \"Tree is throttled\"}"],
(...skipping 12 matching lines...) Expand all
809 ["status -s -uno", ""], 793 ["status -s -uno", ""],
810 ["status -s -b -uno", "## some_branch\n"], 794 ["status -s -b -uno", "## some_branch\n"],
811 ["svn fetch", ""], 795 ["svn fetch", ""],
812 ["svn log -1 --oneline", "r100 | Text"], 796 ["svn log -1 --oneline", "r100 | Text"],
813 [("log -1 --format=%H --grep=\"" 797 [("log -1 --format=%H --grep=\""
814 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\"" 798 "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\""
815 " svn/trunk"), "push_hash\n"], 799 " svn/trunk"), "push_hash\n"],
816 ["svn find-rev push_hash", "65"], 800 ["svn find-rev push_hash", "65"],
817 ]) 801 ])
818 802
819 options = auto_roll.BuildOptions().parse_args( 803 auto_roll.AutoRoll(TEST_CONFIG, self).Run(
820 AUTO_ROLL_ARGS + ["--status-password", password]) 804 AUTO_ROLL_ARGS + ["--status-password", password])
821 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(options), self)
822 805
823 state = json.loads(FileToText("%s-state.json" 806 state = json.loads(FileToText("%s-state.json"
824 % TEST_CONFIG[PERSISTFILE_BASENAME])) 807 % TEST_CONFIG[PERSISTFILE_BASENAME]))
825 808
826 self.assertEquals("100", state["lkgr"]) 809 self.assertEquals("100", state["lkgr"])
827 self.assertEquals("100", state["latest"]) 810 self.assertEquals("100", state["latest"])
828 811
829 def testAutoRollStoppedBySettings(self): 812 def testAutoRollStoppedBySettings(self):
830 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 813 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
831 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile() 814 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile()
832 TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION]) 815 TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION])
833 816
834 self.ExpectReadURL([]) 817 self.ExpectReadURL([])
835 818
836 self.ExpectGit([ 819 self.ExpectGit([
837 ["status -s -uno", ""], 820 ["status -s -uno", ""],
838 ["status -s -b -uno", "## some_branch\n"], 821 ["status -s -b -uno", "## some_branch\n"],
839 ["svn fetch", ""], 822 ["svn fetch", ""],
840 ]) 823 ])
841 824
842 options = auto_roll.BuildOptions().parse_args(AUTO_ROLL_ARGS)
843 def RunAutoRoll(): 825 def RunAutoRoll():
844 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(options), self) 826 auto_roll.AutoRoll(TEST_CONFIG, self).Run(AUTO_ROLL_ARGS)
845 self.assertRaises(Exception, RunAutoRoll) 827 self.assertRaises(Exception, RunAutoRoll)
846 828
847 def testAutoRollStoppedByTreeStatus(self): 829 def testAutoRollStoppedByTreeStatus(self):
848 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 830 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
849 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist" 831 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
850 832
851 self.ExpectReadURL([ 833 self.ExpectReadURL([
852 ["https://v8-status.appspot.com/current?format=json", 834 ["https://v8-status.appspot.com/current?format=json",
853 "{\"message\": \"Tree is throttled (no push)\"}"], 835 "{\"message\": \"Tree is throttled (no push)\"}"],
854 ]) 836 ])
855 837
856 self.ExpectGit([ 838 self.ExpectGit([
857 ["status -s -uno", ""], 839 ["status -s -uno", ""],
858 ["status -s -b -uno", "## some_branch\n"], 840 ["status -s -b -uno", "## some_branch\n"],
859 ["svn fetch", ""], 841 ["svn fetch", ""],
860 ]) 842 ])
861 843
862 options = auto_roll.BuildOptions().parse_args(AUTO_ROLL_ARGS)
863 def RunAutoRoll(): 844 def RunAutoRoll():
864 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(options), self) 845 auto_roll.AutoRoll(TEST_CONFIG, self).Run(AUTO_ROLL_ARGS)
865 self.assertRaises(Exception, RunAutoRoll) 846 self.assertRaises(Exception, RunAutoRoll)
866 847
867 def testMergeToBranch(self): 848 def testMergeToBranch(self):
868 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile() 849 TEST_CONFIG[ALREADY_MERGING_SENTINEL_FILE] = self.MakeEmptyTempFile()
869 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 850 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
870 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile() 851 TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile()
871 os.environ["EDITOR"] = "vi" 852 os.environ["EDITOR"] = "vi"
872 extra_patch = self.MakeEmptyTempFile() 853 extra_patch = self.MakeEmptyTempFile()
873 854
874 def VerifyPatch(patch): 855 def VerifyPatch(patch):
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 "Y", # Automatically add corresponding ports (34567, 56789)? 956 "Y", # Automatically add corresponding ports (34567, 56789)?
976 "Y", # Automatically increment patch level? 957 "Y", # Automatically increment patch level?
977 "reviewer@chromium.org", # V8 reviewer. 958 "reviewer@chromium.org", # V8 reviewer.
978 "LGTM", # Enter LGTM for V8 CL. 959 "LGTM", # Enter LGTM for V8 CL.
979 ]) 960 ])
980 961
981 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS 962 # r12345 and r34567 are patches. r23456 (included) and r45678 are the MIPS
982 # ports of r12345. r56789 is the MIPS port of r34567. 963 # ports of r12345. r56789 is the MIPS port of r34567.
983 args = ["-f", "-p", extra_patch, "--branch", "trunk", "12345", "23456", 964 args = ["-f", "-p", extra_patch, "--branch", "trunk", "12345", "23456",
984 "34567"] 965 "34567"]
985 options = merge_to_branch.BuildOptions().parse_args(args)
986 self.assertTrue(merge_to_branch.ProcessOptions(options))
987 966
988 # The first run of the script stops because of the svn being down. 967 # The first run of the script stops because of the svn being down.
989 self.assertRaises(GitFailedException, 968 self.assertRaises(GitFailedException,
990 lambda: RunMergeToBranch(TEST_CONFIG, 969 lambda: MergeToBranch(TEST_CONFIG, self).Run(args))
991 MergeToBranchOptions(options),
992 self))
993 970
994 # Test that state recovery after restarting the script works. 971 # Test that state recovery after restarting the script works.
995 options.step = 3 972 args += ["-s", "3"]
996 RunMergeToBranch(TEST_CONFIG, MergeToBranchOptions(options), self) 973 MergeToBranch(TEST_CONFIG, self).Run(args)
997 974
998 975
999 class SystemTest(unittest.TestCase): 976 class SystemTest(unittest.TestCase):
1000 def testReload(self): 977 def testReload(self):
1001 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, 978 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={},
1002 options=CommonOptions(MakeOptions()),
1003 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) 979 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER)
1004 body = step.Reload( 980 body = step.Reload(
1005 """------------------------------------------------------------------------ 981 """------------------------------------------------------------------------
1006 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines 982 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines
1007 983
1008 Prepare push to trunk. Now working on version 3.23.11. 984 Prepare push to trunk. Now working on version 3.23.11.
1009 985
1010 R=danno@chromium.org 986 R=danno@chromium.org
1011 987
1012 Review URL: https://codereview.chromium.org/83173002 988 Review URL: https://codereview.chromium.org/83173002
1013 989
1014 ------------------------------------------------------------------------""") 990 ------------------------------------------------------------------------""")
1015 self.assertEquals( 991 self.assertEquals(
1016 """Prepare push to trunk. Now working on version 3.23.11. 992 """Prepare push to trunk. Now working on version 3.23.11.
1017 993
1018 R=danno@chromium.org 994 R=danno@chromium.org
1019 995
1020 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 996 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/push_to_trunk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698