Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 1 | import argparse |
| 2 | import TestScripts.NewParser as parse |
| 3 | import TestScripts.CodeGen |
Christophe Favergeon | 37b8622 | 2019-07-17 11:49:00 +0200 | [diff] [blame] | 4 | import TestScripts.Deprecate as d |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 5 | |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 6 | |
| 7 | parser = argparse.ArgumentParser(description='Parse test description') |
Christophe Favergeon | 6f8eee9 | 2019-10-09 12:21:27 +0100 | [diff] [blame] | 8 | parser.add_argument('-f', nargs='?',type = str, default="Output.pickle", help="File path") |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 9 | |
| 10 | parser.add_argument('-p', nargs='?',type = str, default="Patterns", help="Pattern dir path") |
| 11 | parser.add_argument('-d', nargs='?',type = str, default="Parameters", help="Parameter dir path") |
| 12 | |
| 13 | # -e true when no semihosting |
| 14 | # Input is include files |
| 15 | # Output is only one stdout |
| 16 | # So the .h for include files need to be generated. |
| 17 | parser.add_argument('-e', action='store_true', help="Embedded test") |
| 18 | |
| 19 | parser.add_argument('others', nargs=argparse.REMAINDER) |
| 20 | |
| 21 | args = parser.parse_args() |
| 22 | |
| 23 | |
| 24 | if args.f is not None: |
| 25 | # Create a treeelemt object |
Christophe Favergeon | 6f8eee9 | 2019-10-09 12:21:27 +0100 | [diff] [blame] | 26 | #p = parse.Parser() |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 27 | # Create a codegen object |
| 28 | c = TestScripts.CodeGen.CodeGen(args.p,args.d, args.e) |
| 29 | # Parse the test description. |
Christophe Favergeon | 6f8eee9 | 2019-10-09 12:21:27 +0100 | [diff] [blame] | 30 | #root = p.parse(args.f) |
| 31 | root=parse.loadRoot(args.f) |
Christophe Favergeon | 37b8622 | 2019-07-17 11:49:00 +0200 | [diff] [blame] | 32 | d.deprecate(root,args.others) |
Christophe Favergeon | 74141a1 | 2019-08-07 13:25:32 +0200 | [diff] [blame] | 33 | #print(root) |
Christophe Favergeon | 3b2a0ee | 2019-06-12 13:29:14 +0200 | [diff] [blame] | 34 | # Generate code with the tree of tests |
| 35 | c.genCodeForTree(root) |
| 36 | else: |
| 37 | parser.print_help() |