blob: ecfc9feda6e52c69df37b157ab005d65a023f64a [file] [log] [blame]
Srikrishna Iyerd61724d2019-10-11 10:47:49 -07001#!/usr/bin/env python3
2# Copyright lowRISC contributors.
3# Licensed under the Apache License, Version 2.0, see LICENSE for details.
4# SPDX-License-Identifier: Apache-2.0
Philipp Wagner14a3fee2019-11-21 10:07:02 +00005r"""Command-line tool to parse and process testplan Hjson
Srikrishna Iyerd61724d2019-10-11 10:47:49 -07006
7"""
8import argparse
Srikrishna Iyerd61724d2019-10-11 10:47:49 -07009import sys
Srikrishna Iyerd61724d2019-10-11 10:47:49 -070010
Srikrishna Iyer86169d02021-05-10 09:35:52 -070011import Testplan
Srikrishna Iyerd61724d2019-10-11 10:47:49 -070012
13
14def main():
15 parser = argparse.ArgumentParser(
16 description=__doc__,
17 formatter_class=argparse.RawDescriptionHelpFormatter)
Srikrishna Iyer86169d02021-05-10 09:35:52 -070018 parser.add_argument('testplan',
19 metavar='<hjson-file>',
20 help='input testplan file (testplan.hjson)')
21 parser.add_argument('-s',
22 '--sim_results',
23 metavar='<hjson-file>',
24 help='''input simulation results file
25 (sim_results.hjson)''')
26 parser.add_argument('--outfile',
27 '-o',
28 type=argparse.FileType('w'),
29 default=sys.stdout,
30 help='output HTML file (without CSS)')
Srikrishna Iyerd61724d2019-10-11 10:47:49 -070031 args = parser.parse_args()
32 outfile = args.outfile
33
34 with outfile:
Srikrishna Iyer86169d02021-05-10 09:35:52 -070035 testplan = Testplan.Testplan(args.testplan)
36 if args.sim_results:
37 outfile.write(
38 testplan.get_sim_results(args.sim_results, fmt="html"))
39
40 else:
41 outfile.write(testplan.get_testplan_table("html"))
42
43 outfile.write('\n')
Srikrishna Iyerd61724d2019-10-11 10:47:49 -070044
45
46if __name__ == '__main__':
47 main()