| OLD | NEW |
| 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 |
| 11 import os | 11 import os |
| 12 import os.path | 12 import os.path |
| 13 import subprocess | 13 import subprocess |
| 14 import shutil | 14 import shutil |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 | 17 |
| 18 def _GenerateCompileCommands(files, include_paths): | 18 def _GenerateCompileCommands(files, include_paths): |
| 19 """Returns a JSON string containing a compilation database for the input.""" | 19 """Returns a JSON string containing a compilation database for the input.""" |
| 20 include_path_flags = ' '.join('-I %s' % include_path | 20 include_path_flags = ' '.join('-I %s' % include_path |
| 21 for include_path in include_paths) | 21 for include_path in include_paths) |
| 22 return json.dumps([{'directory': '.', | 22 return json.dumps([{'directory': '.', |
| 23 'command': 'clang++ -fsyntax-only %s -c %s' % ( | 23 'command': 'clang++ -std=c++11 -fsyntax-only %s -c %s' % ( |
| 24 include_path_flags, f), | 24 include_path_flags, f), |
| 25 'file': f} for f in files], indent=2) | 25 'file': f} for f in files], indent=2) |
| 26 | 26 |
| 27 | 27 |
| 28 def _NumberOfTestsToString(tests): | 28 def _NumberOfTestsToString(tests): |
| 29 """Returns an English describing the number of tests.""" | 29 """Returns an English describing the number of tests.""" |
| 30 return "%d test%s" % (tests, 's' if tests != 1 else '') | 30 return "%d test%s" % (tests, 's' if tests != 1 else '') |
| 31 | 31 |
| 32 | 32 |
| 33 def main(argv): | 33 def main(argv): |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 finally: | 117 finally: |
| 118 # No matter what, unstage the git changes we made earlier to avoid polluting | 118 # No matter what, unstage the git changes we made earlier to avoid polluting |
| 119 # the index. | 119 # the index. |
| 120 args = ['git', 'reset', '--quiet', 'HEAD'] | 120 args = ['git', 'reset', '--quiet', 'HEAD'] |
| 121 args.extend(actual_files) | 121 args.extend(actual_files) |
| 122 subprocess.call(args) | 122 subprocess.call(args) |
| 123 | 123 |
| 124 | 124 |
| 125 if __name__ == '__main__': | 125 if __name__ == '__main__': |
| 126 sys.exit(main(sys.argv[1:])) | 126 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |