OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This is used to test the findbugs plugin, it calls | 7 # This is used to test the findbugs plugin, it calls |
8 # build/android/pylib/findbugs.py to analyze the classes in | 8 # build/android/pylib/utils/findbugs.py to analyze the classes in |
9 # org.chromium.tools.findbugs.plugin package, and expects to get the same | 9 # org.chromium.tools.findbugs.plugin package, and expects to get the same |
10 # issue with those in expected_result.txt. | 10 # issue with those in expected_result.txt. |
11 # | 11 # |
12 # Useful command line: | 12 # Useful command line: |
13 # --rebaseline to generate the expected_result.txt, please make sure don't | 13 # --rebaseline to generate the expected_result.txt, please make sure don't |
14 # remove the expected result of exsting tests. | 14 # remove the expected result of exsting tests. |
15 | 15 |
16 | 16 |
17 import optparse | 17 import optparse |
18 import os | 18 import os |
19 import sys | 19 import sys |
20 | 20 |
21 lib_folder = os.path.join(os.getenv('CHROME_SRC'), 'build', 'android', 'pylib') | 21 lib_folder = os.path.join(os.getenv('CHROME_SRC'), 'build', 'android') |
frankf
2013/01/16 19:22:23
Nit: Use pylib constants here too.
Yaron
2013/01/16 20:30:53
I can't because we're using this to get the path t
| |
22 if lib_folder not in sys.path: | 22 if lib_folder not in sys.path: |
23 sys.path.append(lib_folder) | 23 sys.path.append(lib_folder) |
24 | 24 |
25 import findbugs | 25 from pylib.utils import findbugs |
26 | 26 |
27 | 27 |
28 def main(argv): | 28 def main(argv): |
29 if not findbugs.CheckEnvironment(): | |
30 return 1 | |
31 | |
32 parser = findbugs.GetCommonParser() | 29 parser = findbugs.GetCommonParser() |
33 | 30 |
34 options, _ = parser.parse_args() | 31 options, _ = parser.parse_args() |
35 | 32 |
36 chrome_src = os.getenv('CHROME_SRC') | 33 chrome_src = os.getenv('CHROME_SRC') |
37 | 34 |
38 if not options.known_bugs: | 35 if not options.known_bugs: |
39 options.known_bugs = os.path.join(chrome_src, 'tools', 'android', | 36 options.known_bugs = os.path.join(chrome_src, 'tools', 'android', |
40 'findbugs_plugin', 'test', | 37 'findbugs_plugin', 'test', |
41 'expected_result.txt') | 38 'expected_result.txt') |
42 if not options.only_analyze: | 39 if not options.only_analyze: |
43 options.only_analyze = 'org.chromium.tools.findbugs.plugin.*' | 40 options.only_analyze = 'org.chromium.tools.findbugs.plugin.*' |
44 | 41 |
45 return findbugs.Run(options) | 42 return findbugs.Run(options) |
46 | 43 |
47 if __name__ == '__main__': | 44 if __name__ == '__main__': |
48 sys.exit(main(sys.argv)) | 45 sys.exit(main(sys.argv)) |
OLD | NEW |