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

Side by Side Diff: bin/cbuildbot_unittest.py

Issue 3798003: Robustify and speed up cros_mark_all_as_stable. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Check no changes Created 10 years, 2 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 | « bin/cbuildbot.py ('k') | cros_mark_all_as_stable » ('j') | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Unittests for cbuildbot. Needs to be run inside of chroot for mox.""" 7 """Unittests for cbuildbot. Needs to be run inside of chroot for mox."""
8 8
9 import __builtin__ 9 import __builtin__
10 import mox 10 import mox
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 def testUprevPackages(self): 106 def testUprevPackages(self):
107 """Test if we get actual revisions in revisions.pfq.""" 107 """Test if we get actual revisions in revisions.pfq."""
108 self.mox.StubOutWithMock(__builtin__, 'open') 108 self.mox.StubOutWithMock(__builtin__, 'open')
109 109
110 # Mock out file interaction. 110 # Mock out file interaction.
111 m_file = self.mox.CreateMock(file) 111 m_file = self.mox.CreateMock(file)
112 __builtin__.open(self._revision_file).AndReturn(m_file) 112 __builtin__.open(self._revision_file).AndReturn(m_file)
113 m_file.read().AndReturn(self._test_string) 113 m_file.read().AndReturn(self._test_string)
114 m_file.close() 114 m_file.close()
115 115
116 cbuildbot.RunCommand(['./cros_mark_all_as_stable', 116 cbuildbot.RunCommand(['./cros_mark_as_stable', '--all',
117 '--tracking_branch="cros/master"'], 117 '--tracking_branch="cros/master"', 'commit'],
118 cwd='%s/src/scripts' % self._buildroot, 118 cwd='%s/src/scripts' % self._buildroot,
119 enter_chroot=True) 119 enter_chroot=True)
120 120
121 self.mox.ReplayAll() 121 self.mox.ReplayAll()
122 cbuildbot._UprevPackages(self._buildroot, self._revision_file, 122 cbuildbot._UprevPackages(self._buildroot, self._revision_file,
123 self._test_board) 123 self._test_board)
124 self.mox.VerifyAll() 124 self.mox.VerifyAll()
125 125
126 def testUprevAllPackages(self): 126 def testUprevAllPackages(self):
127 """Test if we get None in revisions.pfq indicating Full Builds.""" 127 """Test if we get None in revisions.pfq indicating Full Builds."""
128 self.mox.StubOutWithMock(__builtin__, 'open') 128 self.mox.StubOutWithMock(__builtin__, 'open')
129 129
130 # Mock out file interaction. 130 # Mock out file interaction.
131 m_file = self.mox.CreateMock(file) 131 m_file = self.mox.CreateMock(file)
132 __builtin__.open(self._revision_file).AndReturn(m_file) 132 __builtin__.open(self._revision_file).AndReturn(m_file)
133 m_file.read().AndReturn('None') 133 m_file.read().AndReturn('None')
134 m_file.close() 134 m_file.close()
135 135
136 cbuildbot.RunCommand(['./cros_mark_all_as_stable', 136 cbuildbot.RunCommand(['./cros_mark_as_stable', '--all',
137 '--tracking_branch="cros/master"'], 137 '--tracking_branch="cros/master"', 'commit'],
138 cwd='%s/src/scripts' % self._buildroot, 138 cwd='%s/src/scripts' % self._buildroot,
139 enter_chroot=True) 139 enter_chroot=True)
140 140
141 self.mox.ReplayAll() 141 self.mox.ReplayAll()
142 cbuildbot._UprevPackages(self._buildroot, self._revision_file, 142 cbuildbot._UprevPackages(self._buildroot, self._revision_file,
143 self._test_board) 143 self._test_board)
144 self.mox.VerifyAll() 144 self.mox.VerifyAll()
145 145
146 146
147 if __name__ == '__main__': 147 if __name__ == '__main__':
148 unittest.main() 148 unittest.main()
OLDNEW
« no previous file with comments | « bin/cbuildbot.py ('k') | cros_mark_all_as_stable » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698