<commit_before>import os
import os.path
import subprocess 
import colorama
from colorama import init,Fore, Back, Style
import argparse

init()

def msg(t):
    print(Fore.CYAN + t + Style.RESET_ALL)

def processTest(test):
    subprocess.call(["python","processTests.py","-e",test])

def build(build,fvp,test):
    result = "results_%s.txt" % test
    resultPath = os.path.join(build,result)

    current=os.getcwd()
    try:
       msg("Build %s" % test)
       os.chdir(build)
       subprocess.call(["make"])
       msg("Run %s" % test)
       with open(result,"w") as results:
          subprocess.call([fvp,"-a","Testing"],stdout=results)
    finally:
       os.chdir(current)

    msg("Parse result for %s" % test)
    subprocess.call(["python","processResult.py","-e","-r",resultPath])

def processAndRun(buildfolder,fvp,test):
    processTest(test)
    build(buildfolder,fvp,test)

parser = argparse.ArgumentParser(description='Parse test description')
parser.add_argument('-f', nargs='?',type = str, default="build_m7", help="Build folder")
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")

args = parser.parse_args()

if args.f is not None:
   BUILDFOLDER=args.f
else:
   BUILDFOLDER="build_m7"

if args.v is not None:
   FVP=args.v
else:
   FVP="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe"

msg("Process test description file")
subprocess.call(["python", "preprocess.py","-f","desc.txt"])

msg("Generate all missing C files")
subprocess.call(["python","processTests.py", "-e"])

msg("Statistics Tests")
processAndRun(BUILDFOLDER,FVP,"StatsTests")

msg("Support Tests")
processAndRun(BUILDFOLDER,FVP,"SupportTests")

msg("Support Bar Tests F32")
processAndRun(BUILDFOLDER,FVP,"SupportBarTestsF32")

msg("Basic Tests")
processAndRun(BUILDFOLDER,FVP,"BasicTests")

msg("Complex Tests")
processAndRun(BUILDFOLDER,FVP,"ComplexTests")

msg("Fast Maths Tests")
processAndRun(BUILDFOLDER,FVP,"FastMath")

msg("SVM Tests")
processAndRun(BUILDFOLDER,FVP,"SVMTests")

msg("Bayes Tests")
processAndRun(BUILDFOLDER,FVP,"BayesTests")

msg("Distance Tests")
processAndRun(BUILDFOLDER,FVP,"DistanceTests")

msg("Filtering Tests")
processAndRun(BUILDFOLDER,FVP,"FilteringTests")

msg("Matrix Tests")
processAndRun(BUILDFOLDER,FVP,"MatrixTests")

msg("Transform Tests")
processAndRun(BUILDFOLDER,FVP,"TransformTests")


<commit_msg>CMSIS-DSP: Improved the test script to take additional command line options.<commit_after>import os
import os.path
import subprocess 
import colorama
from colorama import init,Fore, Back, Style
import argparse

init()

def msg(t):
    print(Fore.CYAN + t + Style.RESET_ALL)

def processTest(test):
    subprocess.call(["python","processTests.py","-e",test])

def build(build,fvp,test,custom=None):
    result = "results_%s.txt" % test
    resultPath = os.path.join(build,result)

    current=os.getcwd()
    try:
       msg("Build %s" % test)
       os.chdir(build)
       subprocess.call(["make"])
       msg("Run %s" % test)
       with open(result,"w") as results:
          if custom:
            subprocess.call([fvp] + custom,stdout=results)
          else:
             subprocess.call([fvp,"-a","Testing"],stdout=results)
    finally:
       os.chdir(current)

    msg("Parse result for %s" % test)
    subprocess.call(["python","processResult.py","-e","-r",resultPath])

def processAndRun(buildfolder,fvp,test,custom=None):
    processTest(test)
    build(buildfolder,fvp,test,custom=custom)

parser = argparse.ArgumentParser(description='Parse test description')
parser.add_argument('-f', nargs='?',type = str, default="build_m7", help="Build folder")
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")
parser.add_argument('-c', nargs='?',type = str, help="Custom args")

args = parser.parse_args()

if args.f is not None:
   BUILDFOLDER=args.f
else:
   BUILDFOLDER="build_m7"

if args.v is not None:
   FVP=args.v
else:
   FVP="C:\\Program Files\\ARM\\Development Studio 2019.0\\sw\\models\\bin\\FVP_MPS2_Cortex-M7.exe"


if args.c:
    custom = args.c.split()
else:
    custom = None

msg("Process test description file")
subprocess.call(["python", "preprocess.py","-f","desc.txt"])

msg("Generate all missing C files")
subprocess.call(["python","processTests.py", "-e"])

msg("Statistics Tests")
processAndRun(BUILDFOLDER,FVP,"StatsTests",custom=custom)

msg("Support Tests")
processAndRun(BUILDFOLDER,FVP,"SupportTests",custom=custom)

msg("Support Bar Tests F32")
processAndRun(BUILDFOLDER,FVP,"SupportBarTestsF32",custom=custom)

msg("Basic Tests")
processAndRun(BUILDFOLDER,FVP,"BasicTests",custom=custom)

msg("Complex Tests")
processAndRun(BUILDFOLDER,FVP,"ComplexTests",custom=custom)

msg("Fast Maths Tests")
processAndRun(BUILDFOLDER,FVP,"FastMath",custom=custom)

msg("SVM Tests")
processAndRun(BUILDFOLDER,FVP,"SVMTests",custom=custom)

msg("Bayes Tests")
processAndRun(BUILDFOLDER,FVP,"BayesTests",custom=custom)

msg("Distance Tests")
processAndRun(BUILDFOLDER,FVP,"DistanceTests",custom=custom)

msg("Filtering Tests")
processAndRun(BUILDFOLDER,FVP,"FilteringTests",custom=custom)

msg("Matrix Tests")
processAndRun(BUILDFOLDER,FVP,"MatrixTests",custom=custom)

msg("Transform Tests")
processAndRun(BUILDFOLDER,FVP,"TransformTests",custom=custom)



{'fraction_non_alphanumeric': 0.16165482048478222, 'fraction_numerical': 0.007289958082741024, 'mean_word_length': 5.668286755771567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7297573', 'n_tokens_mistral': 1970, 'n_tokens_neox': 1922, 'n_words': 329}