Modified: trunk/Tools/ChangeLog (253944 => 253945)
--- trunk/Tools/ChangeLog 2019-12-30 14:45:41 UTC (rev 253944)
+++ trunk/Tools/ChangeLog 2019-12-30 17:01:16 UTC (rev 253945)
@@ -1,3 +1,20 @@
+2019-12-30 Carlos Alberto Lopez Perez <[email protected]>
+
+ [GTK][WPE] support output of results in json format in API test runner.
+ https://bugs.webkit.org/show_bug.cgi?id=205579
+
+ Reviewed by Carlos Garcia Campos.
+
+ Write the results of the tests in json format when the option --json-output
+ is passed to run-gtk-tests or run-wpe-tests. Use the same format than mac's
+ run-api-tests.
+
+ * glib/api_test_runner.py:
+ (TestRunner.run_tests):
+ (TestRunner.run_tests.generate_test_list_for_json_output):
+ (TestRunner):
+ (add_options):
+
2019-12-28 Commit Queue <[email protected]>
Unreviewed, rolling out r253804.
Modified: trunk/Tools/glib/api_test_runner.py (253944 => 253945)
--- trunk/Tools/glib/api_test_runner.py 2019-12-30 14:45:41 UTC (rev 253944)
+++ trunk/Tools/glib/api_test_runner.py 2019-12-30 17:01:16 UTC (rev 253945)
@@ -19,6 +19,7 @@
import os
import errno
+import json
import sys
import re
from signal import SIGKILL, SIGSEGV
@@ -322,6 +323,23 @@
report(timed_out_tests, "timeouts", self._test_programs_base_dir())
report(passed_tests, "passes", self._test_programs_base_dir())
+ def generate_test_list_for_json_output(base_dir, tests):
+ test_list = []
+ for test in tests:
+ base_name = test.replace(base_dir, '', 1)
+ for test_case in tests[test]:
+ test_name = "%s:%s" % (base_name, test_case)
+ # FIXME: get output from failed tests
+ test_list.append({"name": test_name, "output": None})
+ return test_list
+
+ if self._options.json_output:
+ result_dictionary = {}
+ result_dictionary['Failed'] = generate_test_list_for_json_output(self._test_programs_base_dir(), failed_tests)
+ result_dictionary['Crashed'] = generate_test_list_for_json_output(self._test_programs_base_dir(), crashed_tests)
+ result_dictionary['Timedout'] = generate_test_list_for_json_output(self._test_programs_base_dir(), timed_out_tests)
+ self._port.host.filesystem.write_text_file(self._options.json_output, json.dumps(result_dictionary, indent=4))
+
return len(failed_tests) + len(timed_out_tests)
@@ -339,3 +357,5 @@
option_parser.add_option('-t', '--timeout',
action='', type='int', dest='timeout', default=5,
help='Time in seconds until a test times out')
+ option_parser.add_option('--json-output', action='', default=None,
+ help='Save test results as JSON to file')