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

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

Issue 2869873002: supersize: Sort diffs by default (Closed)
Patch Set: Created 3 years, 7 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
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 contextlib 6 import contextlib
7 import copy 7 import copy
8 import difflib 8 import difflib
9 import glob 9 import glob
10 import itertools 10 import itertools
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 @_CompareWithGolden() 175 @_CompareWithGolden()
176 def test_Diff_Basic(self): 176 def test_Diff_Basic(self):
177 size_info1 = self._CloneSizeInfo(use_elf=False) 177 size_info1 = self._CloneSizeInfo(use_elf=False)
178 size_info2 = self._CloneSizeInfo(use_elf=False) 178 size_info2 = self._CloneSizeInfo(use_elf=False)
179 size_info1.metadata = {"foo": 1, "bar": [1,2,3], "baz": "yes"} 179 size_info1.metadata = {"foo": 1, "bar": [1,2,3], "baz": "yes"}
180 size_info2.metadata = {"foo": 1, "bar": [1,3], "baz": "yes"} 180 size_info2.metadata = {"foo": 1, "bar": [1,3], "baz": "yes"}
181 size_info1.symbols -= size_info1.symbols[:2] 181 size_info1.symbols -= size_info1.symbols[:2]
182 size_info2.symbols -= size_info2.symbols[-3:] 182 size_info2.symbols -= size_info2.symbols[-3:]
183 size_info1.symbols[1].size -= 10 183 size_info1.symbols[1].size -= 10
184 d = diff.Diff(size_info1, size_info2) 184 d = diff.Diff(size_info1, size_info2)
185 d.symbols = d.symbols.Cluster().Sorted()
185 return describe.GenerateLines(d, verbose=True) 186 return describe.GenerateLines(d, verbose=True)
186 187
187 def test_Diff_Aliases1(self): 188 def test_Diff_Aliases1(self):
188 size_info1 = self._CloneSizeInfo() 189 size_info1 = self._CloneSizeInfo()
189 size_info2 = self._CloneSizeInfo() 190 size_info2 = self._CloneSizeInfo()
190 191
191 # Removing 1 alias should not change the size. 192 # Removing 1 alias should not change the size.
192 a1, _, _ = ( 193 a1, _, _ = (
193 size_info2.symbols.Filter(lambda s: s.num_aliases == 3)[0].aliases) 194 size_info2.symbols.Filter(lambda s: s.num_aliases == 3)[0].aliases)
194 size_info2.symbols -= [a1] 195 size_info2.symbols -= [a1]
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 models.Symbol(S, 55, name='.L__bar_1195', object_path='b'), # 5 251 models.Symbol(S, 55, name='.L__bar_1195', object_path='b'), # 5
251 ] 252 ]
252 size_info2.symbols += [ 253 size_info2.symbols += [
253 models.Symbol(S, 33, name='.L__unnamed_2195', object_path='b'), # 3 254 models.Symbol(S, 33, name='.L__unnamed_2195', object_path='b'), # 3
254 models.Symbol(S, 11, name='.L__unnamed_2194', object_path='a'), # 1 255 models.Symbol(S, 11, name='.L__unnamed_2194', object_path='a'), # 1
255 models.Symbol(S, 22, name='.L__unnamed_2193', object_path='a'), # 2 256 models.Symbol(S, 22, name='.L__unnamed_2193', object_path='a'), # 2
256 models.Symbol(S, 44, name='.L__bar_2195', object_path='b'), # 4 257 models.Symbol(S, 44, name='.L__bar_2195', object_path='b'), # 4
257 models.Symbol(S, 55, name='.L__bar_295', object_path='b'), # 5 258 models.Symbol(S, 55, name='.L__bar_295', object_path='b'), # 5
258 ] 259 ]
259 d = diff.Diff(size_info1, size_info2) 260 d = diff.Diff(size_info1, size_info2)
261 d.symbols = d.symbols.Cluster().Sorted()
260 self.assertEquals(d.symbols.added_count, 0) 262 self.assertEquals(d.symbols.added_count, 0)
261 self.assertEquals(d.symbols.size, 0) 263 self.assertEquals(d.symbols.size, 0)
262 264
263 265
264 @_CompareWithGolden() 266 @_CompareWithGolden()
265 def test_FullDescription(self): 267 def test_FullDescription(self):
266 return describe.GenerateLines(self._CloneSizeInfo().Cluster(), 268 return describe.GenerateLines(self._CloneSizeInfo().Cluster(),
267 recursive=True, verbose=True) 269 recursive=True, verbose=True)
268 270
269 @_CompareWithGolden() 271 @_CompareWithGolden()
(...skipping 27 matching lines...) Expand all
297 global update_goldens 299 global update_goldens
298 update_goldens = True 300 update_goldens = True
299 for f in glob.glob(os.path.join(_TEST_DATA_DIR, '*.golden')): 301 for f in glob.glob(os.path.join(_TEST_DATA_DIR, '*.golden')):
300 os.unlink(f) 302 os.unlink(f)
301 303
302 unittest.main(argv=argv, verbosity=2) 304 unittest.main(argv=argv, verbosity=2)
303 305
304 306
305 if __name__ == '__main__': 307 if __name__ == '__main__':
306 main() 308 main()
OLDNEW
« no previous file with comments | « tools/binary_size/libsupersize/diff.py ('k') | tools/binary_size/libsupersize/testdata/Diff_Basic.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698