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

Side by Side Diff: tools/clang/scripts/test_tool.py

Issue 446203003: scoped_refptr implicit conversion cleanup tool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tools/clang/scripts/run_tool.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 (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 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 """Test harness for chromium clang tools.""" 6 """Test harness for chromium clang tools."""
7 7
8 import difflib 8 import difflib
9 import glob 9 import glob
10 import json 10 import json
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 passed = 0 80 passed = 0
81 failed = 0 81 failed = 0
82 for expected, actual in zip(expected_files, actual_files): 82 for expected, actual in zip(expected_files, actual_files):
83 print '[ RUN ] %s' % os.path.relpath(actual) 83 print '[ RUN ] %s' % os.path.relpath(actual)
84 expected_output = actual_output = None 84 expected_output = actual_output = None
85 with open(expected, 'r') as f: 85 with open(expected, 'r') as f:
86 expected_output = f.readlines() 86 expected_output = f.readlines()
87 with open(actual, 'r') as f: 87 with open(actual, 'r') as f:
88 actual_output = f.readlines() 88 actual_output = f.readlines()
89 if actual_output != expected_output: 89 if actual_output != expected_output:
90 print '[ FAILED ] %s' % os.path.relpath(actual)
91 failed += 1 90 failed += 1
92 for line in difflib.unified_diff(expected_output, actual_output, 91 for line in difflib.unified_diff(expected_output, actual_output,
93 fromfile=os.path.relpath(expected), 92 fromfile=os.path.relpath(expected),
94 tofile=os.path.relpath(actual)): 93 tofile=os.path.relpath(actual)):
95 sys.stdout.write(line) 94 sys.stdout.write(line)
95 print '[ FAILED ] %s' % os.path.relpath(actual)
96 # Don't clean up the file on failure, so the results can be referenced 96 # Don't clean up the file on failure, so the results can be referenced
97 # more easily. 97 # more easily.
98 continue 98 continue
99 print '[ OK ] %s' % os.path.relpath(actual) 99 print '[ OK ] %s' % os.path.relpath(actual)
100 passed += 1 100 passed += 1
101 os.remove(actual) 101 os.remove(actual)
102 102
103 if failed == 0: 103 if failed == 0:
104 os.remove(compile_database) 104 os.remove(compile_database)
105 105
106 print '[==========] %s ran.' % _NumberOfTestsToString(len(source_files)) 106 print '[==========] %s ran.' % _NumberOfTestsToString(len(source_files))
107 if passed > 0: 107 if passed > 0:
108 print '[ PASSED ] %s.' % _NumberOfTestsToString(passed) 108 print '[ PASSED ] %s.' % _NumberOfTestsToString(passed)
109 if failed > 0: 109 if failed > 0:
110 print '[ FAILED ] %s.' % _NumberOfTestsToString(failed) 110 print '[ FAILED ] %s.' % _NumberOfTestsToString(failed)
111 finally: 111 finally:
112 # No matter what, unstage the git changes we made earlier to avoid polluting 112 # No matter what, unstage the git changes we made earlier to avoid polluting
113 # the index. 113 # the index.
114 args = ['git', 'reset', '--quiet', 'HEAD'] 114 args = ['git', 'reset', '--quiet', 'HEAD']
115 args.extend(actual_files) 115 args.extend(actual_files)
116 subprocess.call(args) 116 subprocess.call(args)
117 117
118 118
119 if __name__ == '__main__': 119 if __name__ == '__main__':
120 sys.exit(main(sys.argv[1:])) 120 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « tools/clang/scripts/run_tool.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698