Modified: trunk/Tools/ChangeLog (223629 => 223630)
--- trunk/Tools/ChangeLog 2017-10-18 21:37:33 UTC (rev 223629)
+++ trunk/Tools/ChangeLog 2017-10-18 21:52:09 UTC (rev 223630)
@@ -1,3 +1,14 @@
+2017-10-18 Aakash Jain <aakash_j...@apple.com>
+
+ webkitpy tests should have --json-output option
+ https://bugs.webkit.org/show_bug.cgi?id=178481
+
+ Reviewed by Alexey Proskuryakov.
+
+ * Scripts/webkitpy/test/main.py:
+ (Tester._parse_args): Added json-output argument.
+ (Tester._run_tests): Write output to json file.
+
2017-10-18 Wenson Hsieh <wenson_hs...@apple.com>
Unreviewed, rolling out r223291.
Modified: trunk/Tools/Scripts/webkitpy/test/main.py (223629 => 223630)
--- trunk/Tools/Scripts/webkitpy/test/main.py 2017-10-18 21:37:33 UTC (rev 223629)
+++ trunk/Tools/Scripts/webkitpy/test/main.py 2017-10-18 21:52:09 UTC (rev 223630)
@@ -117,8 +117,11 @@
help='display per-test execution time (implies --verbose)')
parser.add_option('-v', '--verbose', action='', default=0,
help='verbose output (specify once for individual test results, twice for debug messages)')
+ # FIXME: Remove '--json' argument.
parser.add_option('--json', action='', default=False,
help='write JSON formatted test results to stdout')
+ parser.add_option('--json-output', action='', type='string', dest='json_file_name',
+ help='Create a file at specified path, listing test results in JSON format.')
parser.epilog = ('[args...] is an optional list of modules, test_classes, or individual tests. '
'If no args are given, all the tests will be run.')
@@ -176,6 +179,11 @@
if self._options.json:
_print_results_as_json(sys.stdout, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors)
+ if self._options.json_file_name:
+ self._options.json_file_name = os.path.abspath(self._options.json_file_name)
+ with open(self._options.json_file_name, 'w') as json_file:
+ _print_results_as_json(json_file, itertools.chain(parallel_tests, serial_tests), test_runner.failures, test_runner.errors)
+
if self._options.coverage:
cov.stop()
cov.save()