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

Unified Diff: tools/mb/mb_unittest.py

Issue 1204793002: Fix errors in MB when run for the first time on a new builder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for review Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/mb/mb.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/mb/mb_unittest.py
diff --git a/tools/mb/mb_unittest.py b/tools/mb/mb_unittest.py
index d0326ca06d872bd24e1f8f82092eaa81d8801e37..2d6ae62e8e1a5a0e0c873969a33d5e3e4f2f66b1 100644
--- a/tools/mb/mb_unittest.py
+++ b/tools/mb/mb_unittest.py
@@ -16,6 +16,7 @@ class FakeMBW(mb.MetaBuildWrapper):
super(FakeMBW, self).__init__()
self.files = {}
self.calls = []
+ self.cmds = []
Dirk Pranke 2015/06/23 19:54:37 the stuff related to self.cmds and TempFile() are
self.out = ''
self.err = ''
self.platform = 'linux2'
@@ -28,6 +29,9 @@ class FakeMBW(mb.MetaBuildWrapper):
def Exists(self, path):
return self.files.get(path) is not None
+ def MaybeMakeDirectory(self, path):
+ pass
+
def ReadFile(self, path):
return self.files[path]
@@ -36,6 +40,8 @@ class FakeMBW(mb.MetaBuildWrapper):
def Call(self, cmd):
self.calls.append(cmd)
+ if self.cmds:
+ return self.cmds.pop(0)
return 0, '', ''
def Print(self, *args, **kwargs):
@@ -47,7 +53,7 @@ class FakeMBW(mb.MetaBuildWrapper):
else:
self.out += sep.join(args) + end
- def TempFile(self):
+ def TempFile(self, mode='w'):
return FakeFile(self.files)
def RemoveFile(self, path):
@@ -185,7 +191,6 @@ class UnitTest(unittest.TestCase):
(1, 'The input matches no targets, configs, or files\n', ''),
(1, 'The input matches no targets, configs, or files\n', ''),
]
- mbw.Call = lambda cmd: mbw.cmds.pop(0)
self.check(['analyze', '-c', 'gn_debug', '//out/Default',
'/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0)
« no previous file with comments | « tools/mb/mb.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698