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

Side by Side Diff: build/check_gn_headers_unittest.py

Issue 2846473002: (reland) Optimize check_gn_headers.py for speed (Closed)
Patch Set: use multiprocessing Created 3 years, 8 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
« no previous file with comments | « build/check_gn_headers.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 2017 The Chromium Authors. All rights reserved. 2 # Copyright 2017 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 import logging 6 import logging
7 import json 7 import json
8 import os 8 import os
9 import unittest 9 import unittest
10 import check_gn_headers 10 import check_gn_headers
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 a/b/c/white-end.c # comment 51 a/b/c/white-end.c # comment
52 dir/white-both.c #more comment 52 dir/white-both.c #more comment
53 53
54 # empty line above 54 # empty line above
55 a/b/c 55 a/b/c
56 ''' 56 '''
57 57
58 58
59 class CheckGnHeadersTest(unittest.TestCase): 59 class CheckGnHeadersTest(unittest.TestCase):
60 def testNinja(self): 60 def testNinja(self):
61 headers = check_gn_headers.ParseNinjaDepsOutput(ninja_input) 61 headers = check_gn_headers.ParseNinjaDepsOutput(ninja_input.split('\n'))
62 expected = set([ 62 expected = set([
63 'dir/path/b.h', 63 'dir/path/b.h',
64 'c.hh', 64 'c.hh',
65 'dir3/path/b.h', 65 'dir3/path/b.h',
66 'c3.hh', 66 'c3.hh',
67 ]) 67 ])
68 self.assertEquals(headers, expected) 68 self.assertEquals(headers, expected)
69 69
70 def testNinjaWin(self): 70 def testNinjaWin(self):
71 old_sep = os.sep 71 old_sep = os.sep
72 os.sep = '\\' 72 os.sep = '\\'
73 73
74 headers = check_gn_headers.ParseNinjaDepsOutput(ninja_input_win) 74 headers = check_gn_headers.ParseNinjaDepsOutput(
75 ninja_input_win.split('\n'))
75 expected = set([ 76 expected = set([
76 'dir\\path\\b.h', 77 'dir\\path\\b.h',
77 'c.hh', 78 'c.hh',
78 'dir3\\path\\b.h', 79 'dir3\\path\\b.h',
79 'c3.hh', 80 'c3.hh',
80 ]) 81 ])
81 self.assertEquals(headers, expected) 82 self.assertEquals(headers, expected)
82 83
83 os.sep = old_sep 84 os.sep = old_sep
84 85
(...skipping 12 matching lines...) Expand all
97 'a/b/c/white-end.c', 98 'a/b/c/white-end.c',
98 'dir/white-both.c', 99 'dir/white-both.c',
99 'a/b/c', 100 'a/b/c',
100 ]) 101 ])
101 self.assertEquals(output, expected) 102 self.assertEquals(output, expected)
102 103
103 104
104 if __name__ == '__main__': 105 if __name__ == '__main__':
105 logging.getLogger().setLevel(logging.DEBUG) 106 logging.getLogger().setLevel(logging.DEBUG)
106 unittest.main(verbosity=2) 107 unittest.main(verbosity=2)
OLDNEW
« no previous file with comments | « build/check_gn_headers.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698