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

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

Issue 139993006: Show v8 bleeding edge revision in trunk and Chromium commit message. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Show revision also in Chromium commit message. Created 6 years, 11 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 10 matching lines...) Expand all
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 unittest 32 import unittest
32 33
33 import common_includes 34 import common_includes
34 from common_includes import * 35 from common_includes import *
35 import push_to_trunk 36 import push_to_trunk
36 from push_to_trunk import * 37 from push_to_trunk import *
37 import auto_roll 38 import auto_roll
38 from auto_roll import AutoRollOptions 39 from auto_roll import AutoRollOptions
39 from auto_roll import CheckLastPush 40 from auto_roll import CheckLastPush
40 from auto_roll import FetchLatestRevision 41 from auto_roll import FetchLatestRevision
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 241
241 # Compare expected and actual arguments. 242 # Compare expected and actual arguments.
242 for (expected_arg, actual_arg) in zip(expected_call, args): 243 for (expected_arg, actual_arg) in zip(expected_call, args):
243 if expected_arg != actual_arg: 244 if expected_arg != actual_arg:
244 raise NoRetryException("Expected: %s - Actual: %s" 245 raise NoRetryException("Expected: %s - Actual: %s"
245 % (expected_arg, actual_arg)) 246 % (expected_arg, actual_arg))
246 247
247 # The expectation list contains a mandatory return value and an optional 248 # The expectation list contains a mandatory return value and an optional
248 # callback for checking the context at the time of the call. 249 # callback for checking the context at the time of the call.
249 if len(expected_call) == len(args) + 2: 250 if len(expected_call) == len(args) + 2:
250 expected_call[len(args) + 1]() 251 try:
252 expected_call[len(args) + 1]()
253 except:
254 tb = traceback.format_exc()
255 raise NoRetryException("Caught exception from callback: %s" % tb)
251 return_value = expected_call[len(args)] 256 return_value = expected_call[len(args)]
252 257
253 # If the return value is an exception, raise it instead of returning. 258 # If the return value is an exception, raise it instead of returning.
254 if isinstance(return_value, Exception): 259 if isinstance(return_value, Exception):
255 raise return_value 260 raise return_value
256 return return_value 261 return return_value
257 262
258 def AssertFinished(self): 263 def AssertFinished(self):
259 if self._index < len(self._recipe) -1: 264 if self._index < len(self._recipe) -1:
260 raise NoRetryException("Called %s too seldom: %d vs. %d" 265 raise NoRetryException("Called %s too seldom: %d vs. %d"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE]) 561 cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE])
557 self.assertEquals(cl_chunk, cl) 562 self.assertEquals(cl_chunk, cl)
558 563
559 def _TestSquashCommits(self, change_log, expected_msg): 564 def _TestSquashCommits(self, change_log, expected_msg):
560 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile() 565 TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
561 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f: 566 with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f:
562 f.write(change_log) 567 f.write(change_log)
563 568
564 self.ExpectGit([ 569 self.ExpectGit([
565 ["diff svn/trunk hash1", "patch content"], 570 ["diff svn/trunk hash1", "patch content"],
571 ["svn find-rev hash1", "123455\n"],
566 ]) 572 ])
567 573
568 self.MakeStep().Persist("prepare_commit_hash", "hash1") 574 self.MakeStep().Persist("prepare_commit_hash", "hash1")
569 self.MakeStep().Persist("date", "1999-11-11") 575 self.MakeStep().Persist("date", "1999-11-11")
570 576
571 self.MakeStep(SquashCommits).Run() 577 self.MakeStep(SquashCommits).Run()
572 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg) 578 self.assertEquals(FileToText(TEST_CONFIG[COMMITMSG_FILE]), expected_msg)
573 579
574 patch = FileToText(TEST_CONFIG[ PATCH_FILE]) 580 patch = FileToText(TEST_CONFIG[ PATCH_FILE])
575 self.assertTrue(re.search(r"patch content", patch)) 581 self.assertTrue(re.search(r"patch content", patch))
576 582
577 def testSquashCommitsUnformatted(self): 583 def testSquashCommitsUnformatted(self):
578 change_log = """1999-11-11: Version 3.22.5 584 change_log = """1999-11-11: Version 3.22.5
579 585
580 Log text 1. 586 Log text 1.
581 Chromium issue 12345 587 Chromium issue 12345
582 588
583 Performance and stability improvements on all platforms.\n""" 589 Performance and stability improvements on all platforms.\n"""
584 commit_msg = """Version 3.22.5 590 commit_msg = """Version 3.22.5 (based on bleeding_edge revision r123455)
585 591
586 Log text 1. Chromium issue 12345 592 Log text 1. Chromium issue 12345
587 593
588 Performance and stability improvements on all platforms.""" 594 Performance and stability improvements on all platforms."""
589 self._TestSquashCommits(change_log, commit_msg) 595 self._TestSquashCommits(change_log, commit_msg)
590 596
591 def testSquashCommitsFormatted(self): 597 def testSquashCommitsFormatted(self):
592 change_log = """1999-11-11: Version 3.22.5 598 change_log = """1999-11-11: Version 3.22.5
593 599
594 Long commit message that fills more than 80 characters (Chromium issue 600 Long commit message that fills more than 80 characters (Chromium issue
595 12345). 601 12345).
596 602
597 Performance and stability improvements on all platforms.\n""" 603 Performance and stability improvements on all platforms.\n"""
598 commit_msg = """Version 3.22.5 604 commit_msg = """Version 3.22.5 (based on bleeding_edge revision r123455)
599 605
600 Long commit message that fills more than 80 characters (Chromium issue 12345). 606 Long commit message that fills more than 80 characters (Chromium issue 12345).
601 607
602 Performance and stability improvements on all platforms.""" 608 Performance and stability improvements on all platforms."""
603 self._TestSquashCommits(change_log, commit_msg) 609 self._TestSquashCommits(change_log, commit_msg)
604 610
605 def testSquashCommitsQuotationMarks(self): 611 def testSquashCommitsQuotationMarks(self):
606 change_log = """Line with "quotation marks".\n""" 612 change_log = """Line with "quotation marks".\n"""
607 commit_msg = """Line with "quotation marks".""" 613 commit_msg = """Line with "quotation marks"."""
608 self._TestSquashCommits(change_log, commit_msg) 614 self._TestSquashCommits(change_log, commit_msg)
(...skipping 15 matching lines...) Expand all
624 self.assertTrue(re.search(r"Version 3.22.5", cl)) 630 self.assertTrue(re.search(r"Version 3.22.5", cl))
625 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) 631 self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl))
626 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl)) 632 self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl))
627 633
628 # Make sure all comments got stripped. 634 # Make sure all comments got stripped.
629 self.assertFalse(re.search(r"^#", cl, flags=re.M)) 635 self.assertFalse(re.search(r"^#", cl, flags=re.M))
630 636
631 version = FileToText(TEST_CONFIG[VERSION_FILE]) 637 version = FileToText(TEST_CONFIG[VERSION_FILE])
632 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version)) 638 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version))
633 639
634 def CheckUpload():
635 cl = FileToText(TEST_CONFIG[CHANGELOG_FILE])
636
637 def CheckSVNCommit(): 640 def CheckSVNCommit():
638 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE]) 641 commit = FileToText(TEST_CONFIG[COMMITMSG_FILE])
639 self.assertTrue(re.search(r"Version 3.22.5", commit)) 642 self.assertEquals(
640 self.assertTrue(re.search(r"Log text 1 \(issue 321\).", commit)) 643 """Version 3.22.5 (based on bleeding_edge revision r123455)
644
645 Log text 1 (issue 321).
646
647 Performance and stability improvements on all platforms.""", commit)
641 version = FileToText(TEST_CONFIG[VERSION_FILE]) 648 version = FileToText(TEST_CONFIG[VERSION_FILE])
642 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) 649 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version))
643 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) 650 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version))
644 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) 651 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version))
645 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) 652 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version))
646 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) 653 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))
647 654
648 force_flag = " -f" if not manual else "" 655 force_flag = " -f" if not manual else ""
649 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" 656 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else ""
650 self.ExpectGit([ 657 self.ExpectGit([
(...skipping 18 matching lines...) Expand all
669 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag, 676 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag,
670 "done\n"], 677 "done\n"],
671 ["cl presubmit", "Presubmit successfull\n"], 678 ["cl presubmit", "Presubmit successfull\n"],
672 ["cl dcommit -f --bypass-hooks", "Closing issue\n"], 679 ["cl dcommit -f --bypass-hooks", "Closing issue\n"],
673 ["svn fetch", "fetch result\n"], 680 ["svn fetch", "fetch result\n"],
674 ["checkout svn/bleeding_edge", ""], 681 ["checkout svn/bleeding_edge", ""],
675 [("log -1 --format=%H --grep=\"Prepare push to trunk. " 682 [("log -1 --format=%H --grep=\"Prepare push to trunk. "
676 "Now working on version 3.22.6.\""), 683 "Now working on version 3.22.6.\""),
677 "hash1\n"], 684 "hash1\n"],
678 ["diff svn/trunk hash1", "patch content\n"], 685 ["diff svn/trunk hash1", "patch content\n"],
686 ["svn find-rev hash1", "123455\n"],
679 ["checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""], 687 ["checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""],
680 ["apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""], 688 ["apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""],
681 ["add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""], 689 ["add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""],
682 ["commit -F \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", CheckSVNCommit], 690 ["commit -F \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", CheckSVNCommit],
683 ["svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"], 691 ["svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"],
684 ["svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""], 692 ["svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""],
685 ["status -s -uno", ""], 693 ["status -s -uno", ""],
686 ["checkout master", ""], 694 ["checkout master", ""],
687 ["pull", ""], 695 ["pull", ""],
688 ["checkout -b v8-roll-123456", ""], 696 ["checkout -b v8-roll-123456", ""],
689 [("commit -am \"Update V8 to version 3.22.5.\n\n" 697 [("commit -am \"Update V8 to version 3.22.5 "
698 "(based on bleeding_edge revision r123455).\n\n"
690 "TBR=reviewer@chromium.org\""), 699 "TBR=reviewer@chromium.org\""),
691 ""], 700 ""],
692 ["cl upload --send-mail%s" % force_flag, ""], 701 ["cl upload --send-mail%s" % force_flag, ""],
693 ["checkout -f some_branch", ""], 702 ["checkout -f some_branch", ""],
694 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], 703 ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""],
695 ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""], 704 ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""],
696 ["branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""], 705 ["branch -D %s" % TEST_CONFIG[TRUNKBRANCH], ""],
697 ]) 706 ])
698 707
699 # Expected keyboard input in manual mode: 708 # Expected keyboard input in manual mode:
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 849
841 Review URL: https://codereview.chromium.org/83173002 850 Review URL: https://codereview.chromium.org/83173002
842 851
843 ------------------------------------------------------------------------""") 852 ------------------------------------------------------------------------""")
844 self.assertEquals( 853 self.assertEquals(
845 """Prepare push to trunk. Now working on version 3.23.11. 854 """Prepare push to trunk. Now working on version 3.23.11.
846 855
847 R=danno@chromium.org 856 R=danno@chromium.org
848 857
849 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 858 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