processTests.py 1.1 KB

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