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

Unified Diff: third_party/WebKit/Tools/Scripts/run-bindings-tests

Issue 2568693002: Add first bindings unit test and enable testing. (Closed)
Patch Set: Add harness code after typ roll. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/run-bindings-tests
diff --git a/third_party/WebKit/Tools/Scripts/run-bindings-tests b/third_party/WebKit/Tools/Scripts/run-bindings-tests
index 6f4ab449292688ebd6f65b5811cec58206fa40e3..ea6a6adc5c1b17d87092f57de647cab4a9b1b003 100755
--- a/third_party/WebKit/Tools/Scripts/run-bindings-tests
+++ b/third_party/WebKit/Tools/Scripts/run-bindings-tests
@@ -26,7 +26,10 @@
import sys
from webkitpy.bindings.bindings_tests import run_bindings_tests
+from webkitpy.common import webkit_finder
+webkit_finder.add_typ_dir_to_sys_path()
+import typ
def main(argv):
"""Runs Blink bindings IDL compiler on test IDL files and compares the
@@ -36,15 +39,38 @@ def main(argv):
(this is automatically done as a presubmit script),
and submit changes to the test results in the same patch.
This makes it easier to track and review changes in generated code.
-
- Options:
- --reset-results: Overwrites reference files with the generated results.
- --verbose: Show output on success and logging messages (not just failure)
"""
- reset_results = '--reset-results' in argv
- verbose = '--verbose' in argv
+ argument_parser = typ.ArgumentParser()
peria 2016/12/12 04:43:10 optional: I prefer to put a routine to parse optio
dglazkov 2016/12/12 05:08:22 SG, I'll think of a way to break it up better.
+ argument_parser.add_argument('--reset-results',
+ default=False,
+ action='store_true',
+ help='Overwrites reference files with the generated results.')
+ argument_parser.add_argument('--skip-unit-tests',
+ default=False,
+ action='store_true',
+ help='Skip running unit tests (only run reference tests).')
+ argument_parser.add_argument('--skip-reference-tests',
+ default=False,
+ action='store_true',
+ help='Skip running reference tests (only run unit tests).')
+
+ # First, run bindings unit tests.
peria 2016/12/12 04:43:10 Why don't you use typ.main() as you did in https:/
dglazkov 2016/12/12 05:08:22 Ah, turns out, I can't. I need to effectively brea
+ runner = typ.Runner()
+ runner.parse_args(argument_parser, argv[1:])
+ args = runner.args
+ if argument_parser.exit_status is not None:
+ return argument_parser.exit_status
+ runner.args.top_level_dir = webkit_finder.get_bindings_scripts_dir()
+ if not args.skip_unit_tests:
+ return_code, _, _ = runner.run()
+ if return_code != 0:
+ return return_code
+
+ if args.skip_reference_tests:
+ return 0
- return run_bindings_tests(reset_results, verbose)
+ # Now run the bindings end-to-end tests.
+ return run_bindings_tests(args.reset_results, args.verbose)
if __name__ == '__main__':

Powered by Google App Engine
This is Rietveld 408576698