Commit 73595a9c authored by Thomas Wood's avatar Thomas Wood

summary: add a csv output option

v2: small style fix (Dylan Baker)
Signed-off-by: default avatarThomas Wood <thomas.wood@intel.com>
Reviewed-by: Dylan Baker's avatarDylan Baker <baker.dylan.c@gmail.com>
parent 1a36e7fd
......@@ -22,6 +22,7 @@
import argparse
import shutil
import os.path as path
import sys
import framework.summary as summary
import framework.status as status
......@@ -31,7 +32,8 @@ import framework.junit
__all__ = ['html',
'junit',
'console']
'console',
'csv']
def html(input_):
......@@ -244,3 +246,31 @@ def console(input_):
# Generate the output
output = summary.Summary(args.results)
output.generate_text(args.diff, args.summary)
def csv(input_):
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output",
metavar="<Output File>",
action="store",
dest="output",
default="stdout",
help="Output filename")
parser.add_argument("testResults",
metavar="<Input Files>",
help="JSON results file to be converted")
args = parser.parse_args(input_)
testrun = framework.results.load_results(args.testResults)
def write_results(output):
for name, result in testrun.tests.iteritems():
output.write("{},{},{},{}\n".format(name, result['time'],
result['returncode'],
result['result']))
if args.output != "stdout":
with open(args.output, 'w') as output:
write_results(output)
else:
write_results(sys.stdout)
......@@ -135,6 +135,10 @@ def main():
add_help=False,
help='generate junit xml from results')
junit.set_defaults(func=summary.junit)
csv = summary_parser.add_parser('csv',
add_help=False,
help='generate csv from results')
csv.set_defaults(func=summary.csv)
# Parse the known arguments (piglit run or piglit summary html for
# example), and then pass the arguments that this parser doesn't know about
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment