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

Side by Side Diff: tools/binary_size/integration_test.py

Issue 2795593005: //tools/binary_size: Various enhancements to console.py (Closed)
Patch Set: Review fixes 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 | « tools/binary_size/describe.py ('k') | tools/binary_size/map2size.py » ('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/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 copy 6 import copy
7 import difflib 7 import difflib
8 import itertools 8 import itertools
9 import logging 9 import logging
10 import os 10 import os
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 @_CompareWithGolden 77 @_CompareWithGolden
78 def test_ConsoleNullDiff(self): 78 def test_ConsoleNullDiff(self):
79 return _RunApp('console.py', '--output-directory', _TEST_DATA_DIR, 79 return _RunApp('console.py', '--output-directory', _TEST_DATA_DIR,
80 '--query', 'Diff(size_info1, size_info2)', 80 '--query', 'Diff(size_info1, size_info2)',
81 _TEST_MAP_PATH, _TEST_MAP_PATH) 81 _TEST_MAP_PATH, _TEST_MAP_PATH)
82 82
83 @_CompareWithGolden 83 @_CompareWithGolden
84 def test_ActualDiff(self): 84 def test_ActualDiff(self):
85 map1 = self._GetParsedMap() 85 map1 = self._GetParsedMap()
86 map2 = self._GetParsedMap() 86 map2 = self._GetParsedMap()
87 map1.symbols.symbols.pop(-1) 87 map1.symbols -= map1.symbols[0]
88 map2.symbols.symbols.pop(0) 88 map2.symbols -= map2.symbols[-1]
89 map1.symbols[1].size -= 10 89 map1.symbols[1].size -= 10
90 diff = models.Diff(map1, map2) 90 diff = models.Diff(map1, map2)
91 return describe.GenerateLines(diff) 91 return describe.GenerateLines(diff, verbose=True)
92 92
93 @_CompareWithGolden 93 @_CompareWithGolden
94 def test_SymbolGroupMethods(self): 94 def test_SymbolGroupMethods(self):
95 all_syms = self._GetParsedMap().symbols 95 all_syms = self._GetParsedMap().symbols
96 global_syms = all_syms.WhereNameMatches('GLOBAL') 96 global_syms = all_syms.WhereNameMatches('GLOBAL')
97 # Tests Filter(), Inverted(), and __sub__(). 97 # Tests Filter(), Inverted(), and __sub__().
98 non_global_syms = global_syms.Inverted() 98 non_global_syms = global_syms.Inverted()
99 self.assertEqual(non_global_syms.symbols, (all_syms - global_syms).symbols) 99 self.assertEqual(non_global_syms, (all_syms - global_syms))
100 # Tests Sorted() and __add__(). 100 # Tests Sorted() and __add__().
101 self.assertEqual(all_syms.Sorted().symbols, 101 self.assertEqual(all_syms.Sorted(),
102 (global_syms + non_global_syms).Sorted().symbols) 102 (global_syms + non_global_syms).Sorted())
103 # Tests GroupByNamespace() and __len__(). 103 # Tests GroupByNamespace() and __len__().
104 return itertools.chain( 104 return itertools.chain(
105 ['GroupByNamespace()'], 105 ['GroupByNamespace()'],
106 describe.GenerateLines(all_syms.GroupByNamespace()), 106 describe.GenerateLines(all_syms.GroupByNamespace()),
107 ['GroupByNamespace(depth=1)'], 107 ['GroupByNamespace(depth=1)'],
108 describe.GenerateLines(all_syms.GroupByNamespace(depth=1)), 108 describe.GenerateLines(all_syms.GroupByNamespace(depth=1)),
109 ['GroupByNamespace(depth=1, fallback=None)'], 109 ['GroupByNamespace(depth=1, fallback=None)'],
110 describe.GenerateLines(all_syms.GroupByNamespace(depth=1, 110 describe.GenerateLines(all_syms.GroupByNamespace(depth=1,
111 fallback=None)), 111 fallback=None)),
112 ['GroupByNamespace(depth=1, min_count=2)'], 112 ['GroupByNamespace(depth=1, min_count=2)'],
113 describe.GenerateLines(all_syms.GroupByNamespace(depth=1, min_count=2)), 113 describe.GenerateLines(all_syms.GroupByNamespace(depth=1, min_count=2)),
114 ) 114 )
115 115
116 116
117 def main(): 117 def main():
118 argv = sys.argv 118 argv = sys.argv
119 if len(argv) > 1 and argv[1] == '--update': 119 if len(argv) > 1 and argv[1] == '--update':
120 argv.pop(0) 120 argv.pop(0)
121 global update_goldens 121 global update_goldens
122 update_goldens = True 122 update_goldens = True
123 123
124 unittest.main(argv=argv, verbosity=2) 124 unittest.main(argv=argv, verbosity=2)
125 125
126 126
127 if __name__ == '__main__': 127 if __name__ == '__main__':
128 main() 128 main()
OLDNEW
« no previous file with comments | « tools/binary_size/describe.py ('k') | tools/binary_size/map2size.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698