blob: 40bed128bbab9f2a33b1d66e90f3d4db73f581a3 [file] [log] [blame]
Christophe Favergeon2942a332020-01-20 14:18:48 +01001import os
2import os.path
3import subprocess
4import colorama
5from colorama import init,Fore, Back, Style
6import argparse
7
8init()
9
10def msg(t):
11 print(Fore.CYAN + t + Style.RESET_ALL)
12
13def processTest(test):
14 subprocess.call(["python","processTests.py","-e",test])
15
Christophe Favergeon00e50db2020-01-21 07:10:26 +010016def build(build,fvp,test,custom=None):
Christophe Favergeon2942a332020-01-20 14:18:48 +010017 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 Favergeon00e50db2020-01-21 07:10:26 +010027 if custom:
28 subprocess.call([fvp] + custom,stdout=results)
29 else:
30 subprocess.call([fvp,"-a","Testing"],stdout=results)
Christophe Favergeon2942a332020-01-20 14:18:48 +010031 finally:
32 os.chdir(current)
33
34 msg("Parse result for %s" % test)
35 subprocess.call(["python","processResult.py","-e","-r",resultPath])
36
Christophe Favergeon00e50db2020-01-21 07:10:26 +010037def processAndRun(buildfolder,fvp,test,custom=None):
Christophe Favergeon2942a332020-01-20 14:18:48 +010038 processTest(test)
Christophe Favergeon00e50db2020-01-21 07:10:26 +010039 build(buildfolder,fvp,test,custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010040
41parser = argparse.ArgumentParser(description='Parse test description')
42parser.add_argument('-f', nargs='?',type = str, default="build_m7", help="Build folder")
43parser.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 Favergeon00e50db2020-01-21 07:10:26 +010044parser.add_argument('-c', nargs='?',type = str, help="Custom args")
Christophe Favergeon2942a332020-01-20 14:18:48 +010045
46args = parser.parse_args()
47
48if args.f is not None:
49 BUILDFOLDER=args.f
50else:
51 BUILDFOLDER="build_m7"
52
53if args.v is not None:
54 FVP=args.v
55else:
56 FVP="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe"
57
Christophe Favergeon00e50db2020-01-21 07:10:26 +010058
59if args.c:
60 custom = args.c.split()
61else:
62 custom = None
63
Christophe Favergeon2942a332020-01-20 14:18:48 +010064msg("Process test description file")
65subprocess.call(["python", "preprocess.py","-f","desc.txt"])
66
67msg("Generate all missing C files")
68subprocess.call(["python","processTests.py", "-e"])
69
70msg("Statistics Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010071processAndRun(BUILDFOLDER,FVP,"StatsTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010072
73msg("Support Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010074processAndRun(BUILDFOLDER,FVP,"SupportTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010075
76msg("Support Bar Tests F32")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010077processAndRun(BUILDFOLDER,FVP,"SupportBarTestsF32",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010078
79msg("Basic Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010080processAndRun(BUILDFOLDER,FVP,"BasicTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010081
82msg("Complex Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010083processAndRun(BUILDFOLDER,FVP,"ComplexTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010084
85msg("Fast Maths Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010086processAndRun(BUILDFOLDER,FVP,"FastMath",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010087
88msg("SVM Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010089processAndRun(BUILDFOLDER,FVP,"SVMTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010090
91msg("Bayes Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010092processAndRun(BUILDFOLDER,FVP,"BayesTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010093
94msg("Distance Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010095processAndRun(BUILDFOLDER,FVP,"DistanceTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010096
97msg("Filtering Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +010098processAndRun(BUILDFOLDER,FVP,"FilteringTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +010099
100msg("Matrix Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +0100101processAndRun(BUILDFOLDER,FVP,"MatrixTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +0100102
103msg("Transform Tests")
Christophe Favergeon00e50db2020-01-21 07:10:26 +0100104processAndRun(BUILDFOLDER,FVP,"TransformTests",custom=custom)
Christophe Favergeon2942a332020-01-20 14:18:48 +0100105
106