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

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

Issue 375063002: Polishing binary_size tool output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@inline_measure_point_20140708
Patch Set: Created 6 years, 5 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/explain_binary_size_delta.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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Check that explain_binary_size_delta seems to work.""" 6 """Check that explain_binary_size_delta seems to work."""
7 7
8 import cStringIO 8 import cStringIO
9 import sys 9 import sys
10 import unittest 10 import unittest
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 output_collector = cStringIO.StringIO() 129 output_collector = cStringIO.StringIO()
130 sys.stdout = output_collector 130 sys.stdout = output_collector
131 try: 131 try:
132 explain_binary_size_delta.CrunchStats(added, removed, changed, 132 explain_binary_size_delta.CrunchStats(added, removed, changed,
133 unchanged, True, True) 133 unchanged, True, True)
134 finally: 134 finally:
135 sys.stdout = orig_stdout 135 sys.stdout = orig_stdout
136 result = output_collector.getvalue() 136 result = output_collector.getvalue()
137 137
138 expected_output = """\ 138 expected_output = """\
139 Symbol statistics: 139 Total change: +4000 bytes
140 4 added, totalling 4000 bytes across 4 sources 140 =========================
141 4 removed, totalling 4000 bytes removed across 4 sources 141 4 added, totalling +4000 bytes across 4 sources
142 4 changed, resulting in a net change of 4000 bytes \ 142 4 removed, totalling -4000 bytes across 4 sources
143 4 grown, for a net change of +4000 bytes \
143 (4000 bytes before, 8000 bytes after) across 4 sources 144 (4000 bytes before, 8000 bytes after) across 4 sources
144 8 unchanged, totalling 8000 bytes 145 8 unchanged, totalling 8000 bytes
145 Source stats: 146 Source stats:
146 11 sources encountered. 147 11 sources encountered.
147 1 completely new. 148 1 completely new.
148 1 removed completely. 149 1 removed completely.
149 8 partially changed. 150 8 partially changed.
150 1 completely unchanged. 151 1 completely unchanged.
151 Per-source Analysis: 152 Per-source Analysis:
152 Source: /file_all_changed 153
153 Change: 1000 bytes (gained 1000, lost 0) 154 --------------------------------------------------
154 Changed symbols: 155 +1000 - Source: /file_new - (gained 1000, lost 0)
155 changed type=t, delta=1000 bytes (was 1000 bytes, now 2000 bytes) 156 --------------------------------------------------
156 Source: /file_all_deleted 157 New symbols:
157 Change: -1000 bytes (gained 0, lost 1000) 158 +1000: added type=t, size=1000 bytes
158 Removed symbols: 159
159 removed type=t, size=1000 bytes 160 ---------------------------------------------------------------------
160 Source: /file_new 161 +1000 - Source: /file_pair_unchanged_changed - (gained 1000, lost 0)
161 Change: 1000 bytes (gained 1000, lost 0) 162 ---------------------------------------------------------------------
162 New symbols: 163 Grown symbols:
163 added type=t, size=1000 bytes 164 +1000: changed type=t, (was 1000 bytes, now 2000 bytes)
164 Source: /file_pair_unchanged_added 165
165 Change: 1000 bytes (gained 1000, lost 0) 166 ----------------------------------------------------------------------------
166 New symbols: 167 +1000 - Source: /file_pair_unchanged_diffbuck_added - (gained 1000, lost 0)
167 added type=t, size=1000 bytes 168 ----------------------------------------------------------------------------
168 Source: /file_pair_unchanged_changed 169 New symbols:
169 Change: 1000 bytes (gained 1000, lost 0) 170 +1000: added type=@, size=1000 bytes
170 Changed symbols: 171
171 changed type=t, delta=1000 bytes (was 1000 bytes, now 2000 bytes) 172 -------------------------------------------------------------------
172 Source: /file_pair_unchanged_diffbuck_added 173 +1000 - Source: /file_pair_unchanged_added - (gained 1000, lost 0)
173 Change: 1000 bytes (gained 1000, lost 0) 174 -------------------------------------------------------------------
174 New symbols: 175 New symbols:
175 added type=@, size=1000 bytes 176 +1000: added type=t, size=1000 bytes
176 Source: /file_pair_unchanged_diffbuck_changed 177
177 Change: 1000 bytes (gained 1000, lost 0) 178 ------------------------------------------------------------------------------
178 Changed symbols: 179 +1000 - Source: /file_pair_unchanged_diffbuck_changed - (gained 1000, lost 0)
179 changed type=@, delta=1000 bytes (was 1000 bytes, now 2000 bytes) 180 ------------------------------------------------------------------------------
180 Source: /file_pair_unchanged_diffbuck_removed 181 Grown symbols:
181 Change: -1000 bytes (gained 0, lost 1000) 182 +1000: changed type=@, (was 1000 bytes, now 2000 bytes)
182 Removed symbols: 183
183 removed type=@, size=1000 bytes 184 ----------------------------------------------------------
184 Source: /file_pair_unchanged_removed 185 +1000 - Source: /file_all_changed - (gained 1000, lost 0)
185 Change: -1000 bytes (gained 0, lost 1000) 186 ----------------------------------------------------------
186 Removed symbols: 187 Grown symbols:
187 removed type=t, size=1000 bytes 188 +1000: changed type=t, (was 1000 bytes, now 2000 bytes)
188 Source: /file_tetra 189
189 Change: 1000 bytes (gained 2000, lost 1000) 190 -------------------------------------------------------
190 New symbols: 191 +1000 - Source: /file_tetra - (gained 2000, lost 1000)
191 added type=t, size=1000 bytes 192 -------------------------------------------------------
192 Removed symbols: 193 New symbols:
193 removed type=t, size=1000 bytes 194 +1000: added type=t, size=1000 bytes
194 Changed symbols: 195 Removed symbols:
195 size_changed type=t, delta=1000 bytes (was 1000 bytes, now 2000 bytes) 196 -1000: removed type=t, size=1000 bytes
197 Grown symbols:
198 +1000: size_changed type=t, (was 1000 bytes, now 2000 bytes)
199
200 ------------------------------------------------------------------------------
201 -1000 - Source: /file_pair_unchanged_diffbuck_removed - (gained 0, lost 1000)
202 ------------------------------------------------------------------------------
203 Removed symbols:
204 -1000: removed type=@, size=1000 bytes
205
206 ----------------------------------------------------------
207 -1000 - Source: /file_all_deleted - (gained 0, lost 1000)
208 ----------------------------------------------------------
209 Removed symbols:
210 -1000: removed type=t, size=1000 bytes
211
212 ---------------------------------------------------------------------
213 -1000 - Source: /file_pair_unchanged_removed - (gained 0, lost 1000)
214 ---------------------------------------------------------------------
215 Removed symbols:
216 -1000: removed type=t, size=1000 bytes
196 """ 217 """
197 218
198 self.maxDiff = None 219 self.maxDiff = None
199 self.assertMultiLineEqual(expected_output, result) 220 self.assertMultiLineEqual(expected_output, result)
200 print "explain_binary_size_delta_unittest: All tests passed" 221 print "explain_binary_size_delta_unittest: All tests passed"
201 222
202 223
203 if __name__ == '__main__': 224 if __name__ == '__main__':
204 unittest.main() 225 unittest.main()
OLDNEW
« no previous file with comments | « tools/binary_size/explain_binary_size_delta.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698