1import argparse
2import TestScripts.NewParser as parse
3import TestScripts.CodeGen
4import TestScripts.Deprecate as d
5
6
7parser = argparse.ArgumentParser(description='Parse test description')
8parser.add_argument('-f', nargs='?',type = str, default="Output.pickle", help="Pickle path")
9
10parser.add_argument('-p', nargs='?',type = str, default="Patterns", help="Pattern dir path")
11parser.add_argument('-d', nargs='?',type = str, default="Parameters", help="Parameter dir path")
12parser.add_argument('-gen', nargs='?',type = str, default=".", help="Folder for generated C sources")
13
14# -e true when no semihosting
15# Input is include files
16# Output is only one stdout
17# So the .h for include files need to be generated.
18parser.add_argument('-e', action='store_true', help="Embedded test")
19
20parser.add_argument('-b', action='store_true', help="Benchmark mode to use different generated folders")
21
22parser.add_argument('others', nargs=argparse.REMAINDER)
23
24args = parser.parse_args()
25
26
27if args.f is not None:
28    # Create a treeelemt object
29    #p = parse.Parser()
30    # Create a codegen object
31    c = TestScripts.CodeGen.CodeGen(args.p,args.d, args.e)
32    # Parse the test description.
33    #root = p.parse(args.f)
34    root=parse.loadRoot(args.f)
35    d.deprecate(root,args.others)
36    #print(root)
37    # Generate code with the tree of tests
38    c.genCodeForTree(args.gen,root,args.b)
39else:
40    parser.print_help()