runAllTests.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import os
  2. import os.path
  3. import subprocess
  4. import colorama
  5. from colorama import init,Fore, Back, Style
  6. import argparse
  7. init()
  8. def msg(t):
  9. print(Fore.CYAN + t + Style.RESET_ALL)
  10. def processTest(test):
  11. subprocess.call(["python","processTests.py","-e",test])
  12. def build(build,fvp,test,custom=None):
  13. result = "results_%s.txt" % test
  14. resultPath = os.path.join(build,result)
  15. current=os.getcwd()
  16. try:
  17. msg("Build %s" % test)
  18. os.chdir(build)
  19. subprocess.call(["make"])
  20. msg("Run %s" % test)
  21. with open(result,"w") as results:
  22. if custom:
  23. subprocess.call([fvp] + custom,stdout=results)
  24. else:
  25. subprocess.call([fvp,"-a","Testing"],stdout=results)
  26. finally:
  27. os.chdir(current)
  28. msg("Parse result for %s" % test)
  29. subprocess.call(["python","processResult.py","-e","-r",resultPath])
  30. def processAndRun(buildfolder,fvp,test,custom=None):
  31. processTest(test)
  32. build(buildfolder,fvp,test,custom=custom)
  33. parser = argparse.ArgumentParser(description='Parse test description')
  34. parser.add_argument('-f', nargs='?',type = str, default="build_m7", help="Build folder")
  35. parser.add_argument('-v', nargs='?',type = str, default="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe", help="Fast Model")
  36. parser.add_argument('-c', nargs='?',type = str, help="Custom args")
  37. args = parser.parse_args()
  38. if args.f is not None:
  39. BUILDFOLDER=args.f
  40. else:
  41. BUILDFOLDER="build_m7"
  42. if args.v is not None:
  43. FVP=args.v
  44. else:
  45. FVP="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe"
  46. if args.c:
  47. custom = args.c.split()
  48. else:
  49. custom = None
  50. msg("Process test description file")
  51. subprocess.call(["python", "preprocess.py","-f","desc.txt"])
  52. msg("Generate all missing C files")
  53. subprocess.call(["python","processTests.py", "-e"])
  54. msg("Statistics Tests")
  55. processAndRun(BUILDFOLDER,FVP,"StatsTests",custom=custom)
  56. msg("Support Tests")
  57. processAndRun(BUILDFOLDER,FVP,"SupportTests",custom=custom)
  58. msg("Support Bar Tests F32")
  59. processAndRun(BUILDFOLDER,FVP,"SupportBarTestsF32",custom=custom)
  60. msg("Basic Tests")
  61. processAndRun(BUILDFOLDER,FVP,"BasicTests",custom=custom)
  62. msg("Interpolation Tests")
  63. processAndRun(BUILDFOLDER,FVP,"InterpolationTests",custom=custom)
  64. msg("Complex Tests")
  65. processAndRun(BUILDFOLDER,FVP,"ComplexTests",custom=custom)
  66. msg("Fast Maths Tests")
  67. processAndRun(BUILDFOLDER,FVP,"FastMath",custom=custom)
  68. msg("SVM Tests")
  69. processAndRun(BUILDFOLDER,FVP,"SVMTests",custom=custom)
  70. msg("Bayes Tests")
  71. processAndRun(BUILDFOLDER,FVP,"BayesTests",custom=custom)
  72. msg("Distance Tests")
  73. processAndRun(BUILDFOLDER,FVP,"DistanceTests",custom=custom)
  74. msg("Filtering Tests")
  75. processAndRun(BUILDFOLDER,FVP,"FilteringTests",custom=custom)
  76. msg("Matrix Tests")
  77. processAndRun(BUILDFOLDER,FVP,"MatrixTests",custom=custom)
  78. msg("Transform Tests")
  79. processAndRun(BUILDFOLDER,FVP,"TransformTests",custom=custom)