OLD | NEW |
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 os | 9 import os |
10 import sys | 10 import sys |
(...skipping 23 matching lines...) Expand all Loading... |
34 builder.Run(DummyOpts(), ['-o', output_dir]) | 34 builder.Run(DummyOpts(), ['-o', output_dir]) |
35 | 35 |
36 def testGenerateDepFile(self): | 36 def testGenerateDepFile(self): |
37 output_dir = tempfile.mkdtemp() | 37 output_dir = tempfile.mkdtemp() |
38 builder = build.RcBuilder() | 38 builder = build.RcBuilder() |
39 class DummyOpts(object): | 39 class DummyOpts(object): |
40 def __init__(self): | 40 def __init__(self): |
41 self.input = util.PathFromRoot('grit/testdata/substitute.grd') | 41 self.input = util.PathFromRoot('grit/testdata/substitute.grd') |
42 self.verbose = False | 42 self.verbose = False |
43 self.extra_verbose = False | 43 self.extra_verbose = False |
44 builder.Run(DummyOpts(), ['-o', output_dir, '--dep-dir', output_dir]) | 44 expected_dep_file = os.path.join(output_dir, 'substitute.grd.d') |
| 45 builder.Run(DummyOpts(), ['-o', output_dir, |
| 46 '--depdir', output_dir, |
| 47 '--depfile', expected_dep_file]) |
45 | 48 |
46 expected_dep_file = os.path.join(output_dir, 'substitute.grd.d') | |
47 self.failUnless(os.path.isfile(expected_dep_file)) | 49 self.failUnless(os.path.isfile(expected_dep_file)) |
48 with open(expected_dep_file) as f: | 50 with open(expected_dep_file) as f: |
49 line = f.readline() | 51 line = f.readline() |
50 (dep_file_name, deps_string) = line.split(': ') | 52 (dep_file_name, deps_string) = line.split(': ') |
51 deps = deps_string.split(' ') | 53 deps = deps_string.split(' ') |
52 self.failUnlessEqual(os.path.abspath(expected_dep_file), | 54 self.failUnlessEqual(os.path.abspath(expected_dep_file), |
53 os.path.abspath(os.path.join(output_dir, dep_file_name)), | 55 os.path.abspath(os.path.join(output_dir, dep_file_name)), |
54 "depfile should refer to itself as the depended upon file") | 56 "depfile should refer to itself as the depended upon file") |
55 self.failUnlessEqual(1, len(deps)) | 57 self.failUnlessEqual(1, len(deps)) |
56 self.failUnlessEqual(deps[0], | 58 self.failUnlessEqual(deps[0], |
57 util.PathFromRoot('grit/testdata/substitute.xmb')) | 59 util.PathFromRoot('grit/testdata/substitute.xmb')) |
58 | 60 |
59 | 61 |
60 if __name__ == '__main__': | 62 if __name__ == '__main__': |
61 unittest.main() | 63 unittest.main() |
OLD | NEW |