Răsfoiți Sursa

CoreValidation: Added basic lint configuration for validation tests.
- lint.py to run lint for configured test projects.

Jonatan Antoni 8 ani în urmă
părinte
comite
2ea99c08ee

+ 3 - 2
CMSIS/CoreValidation/Tests/buildutils/rtecmd.py

@@ -8,16 +8,17 @@ import mmap
 
 class RteCmd(BuildCmd):
 
-  def __init__(self, project, config):
+  def __init__(self, project, config, subcmd = "build"):
     BuildCmd.__init__(self)
     self._project = project
     self._config = config
+    self._subcmd = subcmd
 
   def getCommand(self):
     return "python.exe"
     
   def getArguments(self):
-    return [ os.path.normpath(shutil.which("rtebuild.py")), "-c", self._config, os.path.abspath(self._project) ]
+    return [ os.path.normpath(shutil.which("rtebuild.py")), "-c", os.path.abspath(self._project), "-t", self._config, self._subcmd ]
 
   def needsShell(self):
     return True

+ 28 - 0
CMSIS/CoreValidation/Tests/lint.py

@@ -0,0 +1,28 @@
+import sys
+import os.path
+from argparse import ArgumentParser
+
+sys.path.append('buildutils') 
+
+from rtecmd import RteCmd 
+
+def main(argv):
+  parser = ArgumentParser()
+  parser.add_argument('-d', '--device', required=True, help = 'Device to be considered.')
+  parser.add_argument('-c', '--compiler', required=True, help = 'Compiler to be considered.')
+  parser.add_argument('-t', '--target', nargs='?', default="default", help = 'Target to be considered.')
+  args = parser.parse_args()
+  
+  rtebuild = os.path.join(args.device, args.compiler, "default.rtebuild")
+  
+  if not os.path.isfile(rtebuild):
+    raise IOError("rtebuild project not available:'"+rtebuild+"'")
+    
+  cmd = RteCmd(rtebuild, args.target, "lint")
+  cmd.run()
+  
+if __name__ == "__main__":
+  try:
+    main(sys.argv[1:])
+  except Exception as e:
+    print(e)

+ 3 - 0
CMSIS/CoreValidation/Tests/test.rtebuild

@@ -1,5 +1,8 @@
 import:
  - ${home}/.rtebuild/toolchain.rtebuild
+config:
+  FVP:
+    lintflags : [ "Config/MISRA_C_2012_Config.lnt", "-wlib(4)", "-wlib(1)", "+ffn", "-width(0)", "-hf1", "-\"format=%f(%l): %t %n: %m (%t <a href=\\q/userContent/LintMsgRef.html#%n\\q>%n</a>)\"" ]
 include: 
  - ../Include
 source: