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

Side by Side Diff: grit/tool/build_unittest.py

Issue 997813004: Allow depfile to depend on a Stamp file instead of the default first input. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Add unittest + nit in comment Created 5 years, 9 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
« grit/tool/build.py ('K') | « grit/tool/build.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 (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Unit tests for the 'grit build' tool. 6 '''Unit tests for the 'grit build' tool.
7 ''' 7 '''
8 8
9 import codecs 9 import codecs
10 import os 10 import os
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 second_mtime = os.stat(header).st_mtime 294 second_mtime = os.stat(header).st_mtime
295 295
296 os.utime(header, (UNCHANGED, UNCHANGED)) 296 os.utime(header, (UNCHANGED, UNCHANGED))
297 builder.Run(DummyOpts(), ['-o', output_dir, '--write-only-new', '1']) 297 builder.Run(DummyOpts(), ['-o', output_dir, '--write-only-new', '1'])
298 self.failUnless(os.path.exists(header)) 298 self.failUnless(os.path.exists(header))
299 third_mtime = os.stat(header).st_mtime 299 third_mtime = os.stat(header).st_mtime
300 300
301 self.assertTrue(abs(second_mtime - UNCHANGED) > 5) 301 self.assertTrue(abs(second_mtime - UNCHANGED) > 5)
302 self.assertTrue(abs(third_mtime - UNCHANGED) < 5) 302 self.assertTrue(abs(third_mtime - UNCHANGED) < 5)
303 303
304 def testGenerateDepFileWithDependOnStamp(self):
305 output_dir = tempfile.mkdtemp()
306 builder = build.RcBuilder()
307 class DummyOpts(object):
308 def __init__(self):
309 self.input = util.PathFromRoot('grit/testdata/substitute.grd')
310 self.verbose = False
311 self.extra_verbose = False
312 expected_dep_file = os.path.join(output_dir, 'substitute.grd.stamp.d')
313 builder.Run(DummyOpts(), ['-o', output_dir,
314 '--depdir', output_dir,
315 '--depfile', expected_dep_file,
316 '--depend-on-stamp'])
317
318 self.failUnless(os.path.isfile(expected_dep_file))
319 with open(expected_dep_file) as f:
320 line = f.readline()
321 (dep_output_file, deps_string) = line.split(': ')
322 deps = deps_string.split(' ')
323
324 self.failUnlessEqual("substitute.grd.stamp.d", dep_output_file)
325 self.failUnlessEqual(1, len(deps))
326 self.failUnlessEqual(deps[0],
327 util.PathFromRoot('grit/testdata/substitute.xmb'))
328
304 329
305 if __name__ == '__main__': 330 if __name__ == '__main__':
306 unittest.main() 331 unittest.main()
OLDNEW
« grit/tool/build.py ('K') | « grit/tool/build.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698