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

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

Issue 113973003: Add better remote control to push-to-trunk auto-roll script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/auto_roll.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 20 matching lines...) Expand all
31 import unittest 31 import unittest
32 32
33 import common_includes 33 import common_includes
34 from common_includes import * 34 from common_includes import *
35 import push_to_trunk 35 import push_to_trunk
36 from push_to_trunk import * 36 from push_to_trunk import *
37 import auto_roll 37 import auto_roll
38 from auto_roll import AutoRollOptions 38 from auto_roll import AutoRollOptions
39 from auto_roll import CheckLastPush 39 from auto_roll import CheckLastPush
40 from auto_roll import FetchLatestRevision 40 from auto_roll import FetchLatestRevision
41 from auto_roll import SETTINGS_LOCATION
41 42
42 43
43 TEST_CONFIG = { 44 TEST_CONFIG = {
44 BRANCHNAME: "test-prepare-push", 45 BRANCHNAME: "test-prepare-push",
45 TRUNKBRANCH: "test-trunk-push", 46 TRUNKBRANCH: "test-trunk-push",
46 PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile", 47 PERSISTFILE_BASENAME: "/tmp/test-v8-push-to-trunk-tempfile",
47 TEMP_BRANCH: "test-prepare-push-temporary-branch-created-by-script", 48 TEMP_BRANCH: "test-prepare-push-temporary-branch-created-by-script",
48 DOT_GIT_LOCATION: None, 49 DOT_GIT_LOCATION: None,
49 VERSION_FILE: None, 50 VERSION_FILE: None,
50 CHANGELOG_FILE: None, 51 CHANGELOG_FILE: None,
51 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", 52 CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry",
52 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", 53 PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch",
53 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", 54 COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg",
54 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", 55 CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium",
55 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS", 56 DEPS_FILE: "/tmp/test-v8-push-to-trunk-tempfile-chromium/DEPS",
57 SETTINGS_LOCATION: None,
56 } 58 }
57 59
58 60
59 def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None): 61 def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None):
60 """Convenience wrapper.""" 62 """Convenience wrapper."""
61 class Options(object): 63 class Options(object):
62 pass 64 pass
63 options = Options() 65 options = Options()
64 options.s = s 66 options.s = s
65 options.l = l 67 options.l = l
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 ["svn log -1 --oneline", "r101 | Text"], 741 ["svn log -1 --oneline", "r101 | Text"],
740 ["svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."], 742 ["svn log -1 --oneline ChangeLog", "r99 | Prepare push to trunk..."],
741 ]) 743 ])
742 744
743 state = {} 745 state = {}
744 self.MakeStep(FetchLatestRevision, state=state).Run() 746 self.MakeStep(FetchLatestRevision, state=state).Run()
745 self.assertRaises(Exception, self.MakeStep(CheckLastPush, state=state).Run) 747 self.assertRaises(Exception, self.MakeStep(CheckLastPush, state=state).Run)
746 748
747 def testAutoRoll(self): 749 def testAutoRoll(self):
748 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile() 750 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
751 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
749 752
750 self.ExpectReadURL([ 753 self.ExpectReadURL([
754 ["https://v8-status.appspot.com/current?format=json",
755 "{\"message\": \"Tree is throttled\"}"],
751 ["https://v8-status.appspot.com/lkgr", Exception("Network problem")], 756 ["https://v8-status.appspot.com/lkgr", Exception("Network problem")],
752 ["https://v8-status.appspot.com/lkgr", "100"], 757 ["https://v8-status.appspot.com/lkgr", "100"],
753 ]) 758 ])
754 759
755 self.ExpectGit([ 760 self.ExpectGit([
756 ["status -s -uno", ""], 761 ["status -s -uno", ""],
757 ["status -s -b -uno", "## some_branch\n"], 762 ["status -s -b -uno", "## some_branch\n"],
758 ["svn fetch", ""], 763 ["svn fetch", ""],
759 ["svn log -1 --oneline", "r101 | Text"], 764 ["svn log -1 --oneline", "r101 | Text"],
760 ["svn log -1 --oneline ChangeLog", "r65 | Prepare push to trunk..."], 765 ["svn log -1 --oneline ChangeLog", "r65 | Prepare push to trunk..."],
761 ]) 766 ])
762 767
763 auto_roll.RunAutoRoll(TEST_CONFIG, 768 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()), self)
764 AutoRollOptions(MakeOptions(m=False, f=True)),
765 self)
766 769
767 self.assertEquals("100", self.MakeStep().Restore("lkgr")) 770 self.assertEquals("100", self.MakeStep().Restore("lkgr"))
768 self.assertEquals("101", self.MakeStep().Restore("latest")) 771 self.assertEquals("101", self.MakeStep().Restore("latest"))
769 772
773 def testAutoRollStoppedBySettings(self):
774 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
775 TEST_CONFIG[SETTINGS_LOCATION] = self.MakeEmptyTempFile()
776 TextToFile("{\"enable_auto_roll\": false}", TEST_CONFIG[SETTINGS_LOCATION])
777
778 self.ExpectReadURL([])
779
780 self.ExpectGit([
781 ["status -s -uno", ""],
782 ["status -s -b -uno", "## some_branch\n"],
783 ["svn fetch", ""],
784 ])
785
786 def RunAutoRoll():
787 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()), self)
788 self.assertRaises(Exception, RunAutoRoll)
789
790 def testAutoRollStoppedByTreeStatus(self):
791 TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
792 TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"
793
794 self.ExpectReadURL([
795 ["https://v8-status.appspot.com/current?format=json",
796 "{\"message\": \"Tree is throttled (no push)\"}"],
797 ])
798
799 self.ExpectGit([
800 ["status -s -uno", ""],
801 ["status -s -b -uno", "## some_branch\n"],
802 ["svn fetch", ""],
803 ])
804
805 def RunAutoRoll():
806 auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()), self)
807 self.assertRaises(Exception, RunAutoRoll)
770 808
771 class SystemTest(unittest.TestCase): 809 class SystemTest(unittest.TestCase):
772 def testReload(self): 810 def testReload(self):
773 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={}, 811 step = MakeStep(step_class=PrepareChangeLog, number=0, state={}, config={},
774 options=CommonOptions(MakeOptions()), 812 options=CommonOptions(MakeOptions()),
775 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER) 813 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER)
776 body = step.Reload( 814 body = step.Reload(
777 """------------------------------------------------------------------------ 815 """------------------------------------------------------------------------
778 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines 816 r17997 | machenbach@chromium.org | 2013-11-22 11:04:04 +0100 (...) | 6 lines
779 817
780 Prepare push to trunk. Now working on version 3.23.11. 818 Prepare push to trunk. Now working on version 3.23.11.
781 819
782 R=danno@chromium.org 820 R=danno@chromium.org
783 821
784 Review URL: https://codereview.chromium.org/83173002 822 Review URL: https://codereview.chromium.org/83173002
785 823
786 ------------------------------------------------------------------------""") 824 ------------------------------------------------------------------------""")
787 self.assertEquals( 825 self.assertEquals(
788 """Prepare push to trunk. Now working on version 3.23.11. 826 """Prepare push to trunk. Now working on version 3.23.11.
789 827
790 R=danno@chromium.org 828 R=danno@chromium.org
791 829
792 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 830 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/auto_roll.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698