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