| Index: tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py
|
| diff --git a/tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py b/tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py
|
| index a570cdb6045446a32e6836247dc231d27cb22d6b..8bfc92fbc6636e24c5c61ae8e105e7807fb2af95 100755
|
| --- a/tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py
|
| +++ b/tools/android/findbugs_plugin/test/run_findbugs_plugin_tests.py
|
| @@ -14,7 +14,7 @@
|
| # remove the expected result of exsting tests.
|
|
|
|
|
| -import optparse
|
| +import argparse
|
| import os
|
| import sys
|
|
|
| @@ -26,28 +26,63 @@ from pylib import constants
|
| from pylib.utils import findbugs
|
|
|
|
|
| +_EXPECTED_WARNINGS = set([
|
| + findbugs.FindBugsWarning(
|
| + bug_type='CHROMIUM_SYNCHRONIZED_THIS',
|
| + class_name='org.chromium.tools.findbugs.plugin.SimpleSynchronizedThis',
|
| + method_name='synchronizedThis',
|
| + start_line=15,
|
| + end_line=15,
|
| + message="Shouldn't use synchronized(this)"),
|
| + findbugs.FindBugsWarning(
|
| + bug_type='CHROMIUM_SYNCHRONIZED_METHOD',
|
| + class_name=
|
| + 'org.chromium.tools.findbugs.plugin.SimpleSynchronizedStaticMethod',
|
| + method_name='synchronizedStaticMethod',
|
| + start_line=14,
|
| + end_line=14,
|
| + message="Shouldn't use synchronized method"),
|
| + findbugs.FindBugsWarning(
|
| + bug_type='CHROMIUM_SYNCHRONIZED_METHOD',
|
| + class_name=
|
| + 'org.chromium.tools.findbugs.plugin.SimpleSynchronizedMethod',
|
| + method_name='synchronizedMethod',
|
| + start_line=15,
|
| + end_line=15,
|
| + message="Shouldn't use synchronized method"),
|
| +])
|
| +
|
| +
|
| def main(argv):
|
| - parser = findbugs.GetCommonParser()
|
|
|
| - options, _ = parser.parse_args()
|
| + parser = argparse.ArgumentParser()
|
| + parser.add_argument(
|
| + '-l', '--release-build', action='store_true', dest='release',
|
| + help='Run the release build of the findbugs plugin test.')
|
| + args = parser.parse_args()
|
| +
|
| + test_jar_path = os.path.join(
|
| + constants.GetOutDirectory(
|
| + 'Release' if args.release else 'Debug'),
|
| + 'lib.java', 'findbugs_plugin_test.jar')
|
|
|
| - if not options.known_bugs:
|
| - options.known_bugs = os.path.join(constants.DIR_SOURCE_ROOT, 'tools',
|
| - 'android', 'findbugs_plugin', 'test',
|
| - 'expected_result.txt')
|
| + findbugs_command, findbugs_warnings = findbugs.Run(
|
| + None, 'org.chromium.tools.findbugs.plugin.*', None, None, None,
|
| + [test_jar_path])
|
|
|
| - if not options.only_analyze:
|
| - options.only_analyze = 'org.chromium.tools.findbugs.plugin.*'
|
| + missing_warnings = _EXPECTED_WARNINGS.difference(findbugs_warnings)
|
| + if missing_warnings:
|
| + print 'Missing warnings:'
|
| + for w in missing_warnings:
|
| + print ' %s' % str(w)
|
|
|
| - # crbug.com/449101
|
| - # Temporary workaround to have the Android Clang Builder (dbg) bot
|
| - # pass the findbugs_tests step.
|
| - if not options.exclude:
|
| - options.exclude = os.path.join(constants.DIR_SOURCE_ROOT, 'build',
|
| - 'android', 'findbugs_filter',
|
| - 'findbugs_exclude.xml')
|
| + unexpected_warnings = findbugs_warnings.difference(_EXPECTED_WARNINGS)
|
| + if unexpected_warnings:
|
| + print 'Unexpected warnings:'
|
| + for w in unexpected_warnings:
|
| + print ' %s' % str(w)
|
|
|
| - return findbugs.Run(options)
|
| + return len(unexpected_warnings) + len(missing_warnings)
|
|
|
| if __name__ == '__main__':
|
| sys.exit(main(sys.argv))
|
|
|