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 10 matching lines...) Expand all Loading... |
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 Loading... |
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 Loading... |
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 (V8 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 (V8 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 Loading... |
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("""Version 3.22.5 (V8 revision r123455) |
640 self.assertTrue(re.search(r"Log text 1 \(issue 321\).", commit)) | 643 |
| 644 Log text 1 (issue 321). |
| 645 |
| 646 Performance and stability improvements on all platforms.""", commit) |
641 version = FileToText(TEST_CONFIG[VERSION_FILE]) | 647 version = FileToText(TEST_CONFIG[VERSION_FILE]) |
642 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) | 648 self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
643 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) | 649 self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
644 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) | 650 self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) |
645 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) | 651 self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version)) |
646 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) | 652 self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version)) |
647 | 653 |
648 force_flag = " -f" if not manual else "" | 654 force_flag = " -f" if not manual else "" |
649 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" | 655 review_suffix = "\n\nTBR=reviewer@chromium.org" if not manual else "" |
650 self.ExpectGit([ | 656 self.ExpectGit([ |
(...skipping 18 matching lines...) Expand all Loading... |
669 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag, | 675 ["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag, |
670 "done\n"], | 676 "done\n"], |
671 ["cl presubmit", "Presubmit successfull\n"], | 677 ["cl presubmit", "Presubmit successfull\n"], |
672 ["cl dcommit -f --bypass-hooks", "Closing issue\n"], | 678 ["cl dcommit -f --bypass-hooks", "Closing issue\n"], |
673 ["svn fetch", "fetch result\n"], | 679 ["svn fetch", "fetch result\n"], |
674 ["checkout svn/bleeding_edge", ""], | 680 ["checkout svn/bleeding_edge", ""], |
675 [("log -1 --format=%H --grep=\"Prepare push to trunk. " | 681 [("log -1 --format=%H --grep=\"Prepare push to trunk. " |
676 "Now working on version 3.22.6.\""), | 682 "Now working on version 3.22.6.\""), |
677 "hash1\n"], | 683 "hash1\n"], |
678 ["diff svn/trunk hash1", "patch content\n"], | 684 ["diff svn/trunk hash1", "patch content\n"], |
| 685 ["svn find-rev hash1", "123455\n"], |
679 ["checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""], | 686 ["checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""], |
680 ["apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""], | 687 ["apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""], |
681 ["add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""], | 688 ["add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""], |
682 ["commit -F \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", CheckSVNCommit], | 689 ["commit -F \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "", CheckSVNCommit], |
683 ["svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"], | 690 ["svn dcommit 2>&1", "Some output\nCommitted r123456\nSome output\n"], |
684 ["svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""], | 691 ["svn tag 3.22.5 -m \"Tagging version 3.22.5\"", ""], |
685 ["status -s -uno", ""], | 692 ["status -s -uno", ""], |
686 ["checkout master", ""], | 693 ["checkout master", ""], |
687 ["pull", ""], | 694 ["pull", ""], |
688 ["checkout -b v8-roll-123456", ""], | 695 ["checkout -b v8-roll-123456", ""], |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 847 |
841 Review URL: https://codereview.chromium.org/83173002 | 848 Review URL: https://codereview.chromium.org/83173002 |
842 | 849 |
843 ------------------------------------------------------------------------""") | 850 ------------------------------------------------------------------------""") |
844 self.assertEquals( | 851 self.assertEquals( |
845 """Prepare push to trunk. Now working on version 3.23.11. | 852 """Prepare push to trunk. Now working on version 3.23.11. |
846 | 853 |
847 R=danno@chromium.org | 854 R=danno@chromium.org |
848 | 855 |
849 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) | 856 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) |
OLD | NEW |