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

Unified Diff: tools/binary_size/libsupersize/integration_test.py

Issue 2817813003: supersize: Add "diff" command (Closed)
Patch Set: review commetns 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/binary_size/libsupersize/describe.py ('k') | tools/binary_size/libsupersize/main.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/libsupersize/integration_test.py
diff --git a/tools/binary_size/libsupersize/integration_test.py b/tools/binary_size/libsupersize/integration_test.py
index 30fa4fd3ebef6dfce5f367d9c9741fb070907285..e9ad9254a8ce250353f30d5f69efff4dc323d461 100755
--- a/tools/binary_size/libsupersize/integration_test.py
+++ b/tools/binary_size/libsupersize/integration_test.py
@@ -5,6 +5,7 @@
import copy
import difflib
+import glob
import itertools
import logging
import os
@@ -94,11 +95,25 @@ class IntegrationTest(unittest.TestCase):
archive.LoadAndPostProcessSizeInfo(temp_file.name)
@_CompareWithGolden
- def test_ConsoleNullDiff(self):
+ def test_Console(self):
+ with tempfile.NamedTemporaryFile(suffix='.size') as size_file, \
+ tempfile.NamedTemporaryFile(suffix='.txt') as output_file:
+ file_format.SaveSizeInfo(self._CloneSizeInfo(), size_file.name)
+ query = [
+ 'ShowExamples()',
+ 'ExpandRegex("_foo_")',
+ 'Print(size_info, to_file=%r)' % output_file.name,
+ ]
+ ret = _RunApp('console', size_file.name, '--query', '; '.join(query))
+ with open(output_file.name) as f:
+ ret.extend(l.rstrip() for l in f)
+ return ret
+
+ @_CompareWithGolden
+ def test_Diff_NullDiff(self):
with tempfile.NamedTemporaryFile(suffix='.size') as temp_file:
file_format.SaveSizeInfo(self._CloneSizeInfo(), temp_file.name)
- return _RunApp('console', '--query', 'Diff(size_info1, size_info2)',
- temp_file.name, temp_file.name)
+ return _RunApp('diff', temp_file.name, temp_file.name)
@_CompareWithGolden
def test_ActualDiff(self):
@@ -146,6 +161,8 @@ def main():
argv.pop(0)
global update_goldens
update_goldens = True
+ for f in glob.glob(os.path.join(_TEST_DATA_DIR, '*.golden')):
+ os.unlink(f)
unittest.main(argv=argv, verbosity=2)
« no previous file with comments | « tools/binary_size/libsupersize/describe.py ('k') | tools/binary_size/libsupersize/main.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698