Commit f02cd7c1 authored by Dylan Baker's avatar Dylan Baker

summary: Add an aggregate function

This summarizer can be used to aggregate a set of individual tests
together into a single results file.
Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
parent 57426de1
......@@ -19,19 +19,25 @@
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from __future__ import print_function, absolute_import
import argparse
import shutil
import os
import os.path as path
import sys
import errno
import framework.summary as summary
import framework.status as status
import framework.core as core
import framework.results
__all__ = ['html',
__all__ = [
'aggregate',
'console',
'csv']
'csv',
'html',
]
def html(input_):
......@@ -163,3 +169,32 @@ def csv(input_):
write_results(output)
else:
write_results(sys.stdout)
def aggregate(input_):
"""Combine files in a tests/ directory into a single results file."""
parser = argparse.ArgumentParser()
parser.add_argument('results_folder',
type=path.realpath,
metavar="<results path>",
help="Path to a results folder")
parser.add_argument('-o', '--output',
default="results.json",
help="name of output file. Default: results.json")
args = parser.parse_args(input_)
assert os.path.isdir(args.results_folder)
outfile = os.path.join(args.results_folder, args.output)
results = framework.results.load_results(args.results_folder)
try:
results.write(outfile)
except IOError as e:
if e.errno == errno.EPERM:
print("Error: Unable to write aggregated file, permission denied.",
file=sys.stderr)
sys.exit(1)
raise
print("Aggregated file written to: {}".format(outfile))
......@@ -135,6 +135,10 @@ def main():
add_help=False,
help='generate csv from results')
csv.set_defaults(func=summary.csv)
aggregate = summary_parser.add_parser('aggregate',
add_help=False,
help="Aggregate incomplete piglit run.")
aggregate.set_defaults(func=summary.aggregate)
# 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