CMSIS-DSP: Improvement to the regression script for tests
diff --git a/CMSIS/DSP/Testing/runAllTests.py b/CMSIS/DSP/Testing/runAllTests.py
index e67531a..816f70b 100755
--- a/CMSIS/DSP/Testing/runAllTests.py
+++ b/CMSIS/DSP/Testing/runAllTests.py
@@ -39,7 +39,47 @@
if testStatusForThisBuild == CALLFAILURE:
return(testStatusForThisBuild)
-root = Path(os.getcwd()).parent.parent.parent
+# Analyze the configuration flags (like loopunroll etc ...)
+def analyzeFlags(flags):
+
+ onoffFlags = []
+ for f in flags:
+ if type(f) is dict:
+ for var in f:
+ if type(f[var]) is bool:
+ if f[var]:
+ onoffFlags.append(["-D%s=ON" % (var)])
+ else:
+ onoffFlags.append(["-D%s=OFF" % (var)])
+ else:
+ onoffFlags.append(["-D%s=%s" % (var,f[var])])
+ else:
+ onoffFlags.append(["-D" + f +"=ON","-D" + f +"=OFF"])
+
+ allConfigs=cartesian(*onoffFlags)
+ return(allConfigs)
+
+# Extract the cmake for a specific compiler
+# and the flag configuration to use for this compiler.
+# This flags configuration will override the global one
+def analyzeToolchain(toolchain, globalConfig):
+ config=globalConfig
+ cmake=""
+ sim=True
+ if type(toolchain) is str:
+ cmake=toolchain
+ else:
+ for t in toolchain:
+ if type(t) is dict:
+ if "FLAGS" in t:
+ hasConfig=True
+ config = analyzeFlags(t["FLAGS"])
+ if "SIM" in t:
+ sim = t["SIM"]
+ if type(t) is str:
+ cmake=t
+ return(cmake,config,sim)
+
def cartesian(*somelists):
@@ -48,6 +88,9 @@
r.append(list(element))
return(r)
+root = Path(os.getcwd()).parent.parent.parent
+
+
testFailed = 0
init()
@@ -55,11 +98,13 @@
parser = argparse.ArgumentParser(description='Parse test description')
parser.add_argument('-i', nargs='?',type = str, default="testrunConfig.yaml",help="Config file")
parser.add_argument('-r', nargs='?',type = str, default=root, help="Root folder")
-parser.add_argument('-n', nargs='?',type = int, default=0, help="ID value when launchign in parallel")
+parser.add_argument('-n', nargs='?',type = int, default=0, help="ID value when launching in parallel")
+parser.add_argument('-b', action='store_true', help="Benchmark mode")
+parser.add_argument('-f', nargs='?',type = str, default="desc.txt",help="Test description file")
+parser.add_argument('-p', nargs='?',type = str, default="FVP",help="Platform for running")
args = parser.parse_args()
-
with open(args.i,"r") as f:
config=yaml.safe_load(f)
@@ -67,16 +112,14 @@
#print(config["IMPLIEDFLAGS"])
-flags = config["FLAGS"]
-onoffFlags = []
-for f in flags:
- onoffFlags.append(["-D" + f +"=ON","-D" + f +"=OFF"])
-allConfigs=cartesian(*onoffFlags)
+
+
+flags = config["FLAGS"]
+allConfigs = analyzeFlags(flags)
if DEBUGMODE:
allConfigs=[allConfigs[0]]
-
failedBuild = {}
# Test all builds
@@ -97,31 +140,34 @@
status.write("%s : Subprocess failure\n" % build)
-def buildAndTest(compiler):
+def buildAndTest(compiler,theConfig,cmake,sim):
# Run all tests for AC6
try:
for core in config['CORES']:
configNb = 0
if compiler in config['CORES'][core]:
- for flagConfig in allConfigs:
+ msg("Testing Core %s\n" % core)
+ for flagConfig in theConfig:
folderCreated = False
configNb = configNb + 1
buildStr = "build_%s_%s_%d" % (compiler,core,configNb)
toUnset = None
toSet = None
- if compiler in config['UNSET']:
- if core in config['UNSET'][compiler]:
- toUnset = config['UNSET'][compiler][core]
+ if 'UNSET' in config:
+ if compiler in config['UNSET']:
+ if core in config['UNSET'][compiler]:
+ toUnset = config['UNSET'][compiler][core]
- if compiler in config['SET']:
- if core in config['SET'][compiler]:
- toSet = config['SET'][compiler][core]
+ if 'SET' in config:
+ if compiler in config['SET']:
+ if core in config['SET'][compiler]:
+ toSet = config['SET'][compiler][core]
build = BuildConfig(toUnset,toSet,args.r,
buildStr,
config['COMPILERS'][core][compiler],
- config['TOOLCHAINS'][compiler],
+ cmake,
config['CORES'][core][compiler],
config["CMAKE"]
)
@@ -140,16 +186,21 @@
try:
# This is saving the flag configuration
build.createArchive(flags)
-
- build.createCMake(flags)
+ msg("Config " + str(flagConfig) + "\n")
+
+ build.createCMake(flags,args.b,args.p)
for test in config["TESTS"]:
msg(test["testName"]+"\n")
testClass=test["testClass"]
test = build.getTest(testClass)
fvp = None
- if core in config['FVP']:
- fvp = config['FVP'][core]
- newTestStatus = test.runAndProcess(compiler,fvp)
+ if 'FVP' in config:
+ if core in config['FVP']:
+ fvp = config['FVP'][core]
+ if 'SIM' in config:
+ if core in config['SIM']:
+ fvp = config['SIM'][core]
+ newTestStatus = test.runAndProcess(compiler,fvp,sim)
testStatusForThisBuild = updateTestStatus(testStatusForThisBuild,newTestStatus)
if testStatusForThisBuild != NOTESTFAILED:
failedBuild[buildStr] = testStatusForThisBuild
@@ -175,12 +226,15 @@
############## Builds for all toolchains
if not DEBUGMODE:
- preprocess()
+ preprocess(args.f)
generateAllCCode()
for t in config["TOOLCHAINS"]:
- msg("Testing toolchain %s\n" % t)
- buildAndTest(t)
+ cmake,localConfig,sim = analyzeToolchain(config["TOOLCHAINS"][t],allConfigs)
+ msg("Testing toolchain %s\n" % cmake)
+ buildAndTest(t,localConfig,cmake,sim)
+
+exit(1)
logFailedBuild(args.r,failedBuild)
sys.exit(testFailed)