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