OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 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 argparse | 6 import argparse |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
11 script_dir = os.path.dirname(os.path.realpath(__file__)) | 11 script_dir = os.path.dirname(os.path.realpath(__file__)) |
12 tool_dir = os.path.abspath(os.path.join(script_dir, '../../pylib')) | 12 tool_dir = os.path.abspath(os.path.join(script_dir, '../../pylib')) |
13 sys.path.insert(0, tool_dir) | 13 sys.path.insert(0, tool_dir) |
14 | 14 |
15 from clang import plugin_testing | 15 from clang import plugin_testing |
16 | 16 |
17 | 17 |
18 class ChromeStylePluginTest(plugin_testing.ClangPluginTest): | 18 class ChromeStylePluginTest(plugin_testing.ClangPluginTest): |
19 """Test harness for the Chrome style plugin.""" | 19 """Test harness for the Chrome style plugin.""" |
20 | 20 |
21 def AdjustClangArguments(self, clang_cmd): | 21 def AdjustClangArguments(self, clang_cmd): |
22 self.AddPluginArg(clang_cmd, 'with-ast-visitor') | 22 self.AddPluginArg(clang_cmd, 'check-implicit-copy-ctors') |
23 self.AddPluginArg(clang_cmd, 'follow-macro-expansion') | 23 self.AddPluginArg(clang_cmd, 'follow-macro-expansion') |
24 clang_cmd.extend([ | 24 clang_cmd.extend([ |
25 # Skip code generation | 25 # Skip code generation |
26 '-fsyntax-only', | 26 '-fsyntax-only', |
27 # Fake system directory for tests | 27 # Fake system directory for tests |
28 '-isystem', os.path.join(os.getcwd(), 'system'), | 28 '-isystem', os.path.join(os.getcwd(), 'system'), |
29 '-Wno-inconsistent-missing-override', | 29 '-Wno-inconsistent-missing-override', |
30 ]) | 30 ]) |
31 | 31 |
32 | 32 |
(...skipping 12 matching lines...) Expand all Loading... |
45 return ChromeStylePluginTest( | 45 return ChromeStylePluginTest( |
46 os.path.dirname(os.path.realpath(__file__)), | 46 os.path.dirname(os.path.realpath(__file__)), |
47 args.clang_path, | 47 args.clang_path, |
48 args.plugin_path, | 48 args.plugin_path, |
49 'find-bad-constructs', | 49 'find-bad-constructs', |
50 args.reset_results).Run() | 50 args.reset_results).Run() |
51 | 51 |
52 | 52 |
53 if __name__ == '__main__': | 53 if __name__ == '__main__': |
54 sys.exit(main()) | 54 sys.exit(main()) |
OLD | NEW |