-
Notifications
You must be signed in to change notification settings - Fork 807
/
Copy pathtestplanner.py
executable file
·46 lines (38 loc) · 1.39 KB
/
testplanner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Command-line tool to parse and process testplan Hjson
"""
import argparse
import sys
import Testplan
def main():
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('testplan',
metavar='<hjson-file>',
help='input testplan file (testplan.hjson)')
parser.add_argument('-s',
'--sim_results',
metavar='<hjson-file>',
help='''input simulation results file
(sim_results.hjson)''')
parser.add_argument('--outfile',
'-o',
type=argparse.FileType('w'),
default=sys.stdout,
help='output markdown file')
args = parser.parse_args()
outfile = args.outfile
with outfile:
testplan = Testplan.Testplan(args.testplan)
if args.sim_results:
outfile.write(
testplan.get_sim_results(args.sim_results, fmt="html"))
else:
testplan.write_testplan_doc(outfile)
outfile.write('\n')
if __name__ == '__main__':
main()