| |
@@ -30,6 +30,7 @@
|
| |
import tempfile
|
| |
from collections import defaultdict, OrderedDict
|
| |
from operator import attrgetter
|
| |
+ import json
|
| |
|
| |
import relval.user_stats as uss
|
| |
import relval.testcase_stats as tcs
|
| |
@@ -433,6 +434,7 @@
|
| |
# identifying the compose from which it comes). Result rows for which
|
| |
# all three attributes match are grouped together - they're considered
|
| |
# to be results for the same test in different composes.
|
| |
+ jsondata = {'allcomposes': allcomposes, 'stats': dict()}
|
| |
for index, (testtype, pages) in enumerate(allpages.items()):
|
| |
print('Processing type [{0}/{1}]: {2}'.format(index + 1,
|
| |
len(allpages), testtype))
|
| |
@@ -456,8 +458,12 @@
|
| |
print("Post-processing results...")
|
| |
tests = tcs.post_process(tests, allcomposes)
|
| |
tcs.print_results_html(testtype, pages, allcomposes, tests, outdir)
|
| |
+ jsondata['stats'][testtype] = tcs.get_results_data(allcomposes, tests)
|
| |
|
| |
tcs.print_summary_html(outdir, allpages)
|
| |
+ with open(os.path.join(outdir, 'data.json'), 'w') as outfile:
|
| |
+ json.dump(jsondata, outfile, sort_keys=True, indent=4)
|
| |
+
|
| |
if args.out:
|
| |
try:
|
| |
shutil.rmtree(args.out)
|
| |
@@ -470,11 +476,14 @@
|
| |
print("All output moved to: {0}".format(args.out))
|
| |
print("Index page at: {0}".format(os.path.join(args.out,
|
| |
"index.html")))
|
| |
+ print("JSON data at: {0}".format(os.path.join(args.out,
|
| |
+ "data.json")))
|
| |
except (PermissionError, FileExistsError):
|
| |
print("Could not write to: {0}! "
|
| |
"Output is at: {1}".format(args.out, outdir))
|
| |
else:
|
| |
print("HTML Output: " + os.path.join(outdir, "index.html"))
|
| |
+ print("JSON Output: " + os.path.join(outdir, "data.json"))
|
| |
print(outdir)
|
| |
|
| |
def report_results(args, site):
|
| |
Adds JSON-formatted output of testcase-stats on top of the current HTML output. We want to be able to consume the testcase-stats data, and parsing the HTML sounds like a pointless exercise, when one could have the "machine-readable" data at hand.