summaryrefslogtreecommitdiff
path: root/DSP/DSP_Lib_TestSuite/parseLog.py
diff options
context:
space:
mode:
authorAli Labbene <ali.labbene@st.com>2019-12-11 08:59:21 +0100
committerAli Labbene <ali.labbene@st.com>2019-12-16 16:35:24 +0100
commit9f95ff5b6ba01db09552b84a0ab79607060a2666 (patch)
tree8a6e0dda832555c692307869aed49d07ee7facfe /DSP/DSP_Lib_TestSuite/parseLog.py
parent76177aa280494bb36d7a0bcbda1078d4db717020 (diff)
downloadst-cmsis-core-lowfat-9f95ff5b6ba01db09552b84a0ab79607060a2666.tar.gz
st-cmsis-core-lowfat-9f95ff5b6ba01db09552b84a0ab79607060a2666.tar.bz2
st-cmsis-core-lowfat-9f95ff5b6ba01db09552b84a0ab79607060a2666.zip
Official ARM version: v5.4.0
Add CMSIS V5.4.0, please refer to index.html available under \docs folder. Note: content of \CMSIS\Core\Include has been copied under \Include to keep the same structure used in existing projects, and thus avoid projects mass update Note: the following components have been removed from ARM original delivery (as not used in ST packages) - CMSIS_EW2018.pdf - .gitattributes - .gitignore - \Device - \CMSIS - \CoreValidation - \DAP - \Documentation - \DoxyGen - \Driver - \Pack - \RTOS\CMSIS_RTOS_Tutorial.pdf - \RTOS\RTX - \RTOS\Template - \RTOS2\RTX - \Utilities - All ARM/GCC projects files are deleted from \DSP, \RTOS and \RTOS2 Change-Id: Ia026c3f0f0d016627a4fb5a9032852c33d24b4d3
Diffstat (limited to 'DSP/DSP_Lib_TestSuite/parseLog.py')
-rw-r--r--DSP/DSP_Lib_TestSuite/parseLog.py126
1 files changed, 126 insertions, 0 deletions
diff --git a/DSP/DSP_Lib_TestSuite/parseLog.py b/DSP/DSP_Lib_TestSuite/parseLog.py
new file mode 100644
index 0000000..0bbc357
--- /dev/null
+++ b/DSP/DSP_Lib_TestSuite/parseLog.py
@@ -0,0 +1,126 @@
+import sys
+
+toolchain_list = ["ARM", "GCC"]
+core_list = ["cortexM0l", "cortexM3l", "cortexM4l", "cortexM4lf", "cortexM7l", "cortexM7lfsp", "cortexM7lfdp",
+ "ARMv8MBLl", "ARMv8MMLl", "ARMv8MMLlfsp", "ARMv8MMLlfdp", "ARMv8MMLld", "ARMv8MMLldfsp", "ARMv8MMLldfdp" ]
+test_list = ["MPS2", "FVP", "Simulator"]
+error = 1
+
+
+def parseLog(toolchain, core, test):
+ if toolchain not in toolchain_list:
+ print "Error: Unkown toolchain '{0}'".format(toolchain)
+ return error
+
+ if core not in core_list:
+ print "Error: Unkown core '{0}'".format(core)
+ return error
+
+ if test not in test_list:
+ print "Error: Unkown test '{0}'".format(test)
+ return error
+
+ inFileName = ".\DspLibTest_{2}\{0}\Logs\DspLibTest_{2}_{1}.log".format(toolchain, core, test)
+ outFileName = ".\DspLibTest_{2}\{0}\Logs\DspLibTest_{2}_{1}_parsed.log".format(toolchain, core, test)
+
+ infile = open(inFileName).read()
+ infile = infile.split('\n')
+
+ outfile = open(outFileName, 'w')
+
+ count = 0
+ strName = ""
+ strNr = -1
+ strFUT = ""
+ coverageInfo = 0
+
+ for line in infile:
+ if line.find("==================================================") != -1:
+ continue
+ if line.find("--------------------------------------------------") != -1:
+ continue
+ if line.find("Start: Group") != -1:
+ outfile.write("\n")
+ continue
+ if line.find("End: Group") != -1:
+ outfile.write("\n")
+ continue
+ if line.find("Start: Test") != -1:
+ outfile.write("\n")
+ continue
+ if line.find("End: Test") != -1:
+ outfile.write("\n")
+ continue
+ if line.find("Start Dump: String") != -1:
+ continue
+ if line.find("End Dump: String") != -1:
+ strName = strName.rstrip("\n")
+ outfile.write(strName)
+ if strNr == 3:
+ strFUT = strName
+# else:
+# strFUT == ""
+ if strName == "Group Name:":
+ strNr = 1
+ outfile.write(" ")
+ elif strName == "Test Name:":
+ strNr = 2
+ outfile.write(" ")
+ elif strName == "Function Under Test:":
+ strNr = 3
+ outfile.write(" ")
+ else:
+ strNr = 4
+ if len(strName) < 128:
+ outfile.write("\n")
+ strName = ""
+ continue
+ if line.find("Start: Coverage Information") != -1:
+ coverageInfo = 1
+ outfile.write(line)
+ outfile.write("\n")
+ if line.find("End: Coverage Information") != -1:
+ strFUT == ""
+ coverageInfo = 0
+ if coverageInfo == 1:
+# if line.find(strFUT) == -1: #this line contains no relevant coverage info
+# continue
+ if line.find("- 0%") == -1 and line.find("src") == -1 and line.find("Functions") != -1:
+ outfile.write(line + "\n")
+ continue
+ if line.find("0x") == 0: #this is a line to translate
+ line = line[12:35] + line[37:61]
+ nums = line.split(' ')
+ for num in nums:
+ intNum = int(num, base=16)
+# if intNum == 10:
+# continue
+ if intNum == 0:
+ continue
+ strName += str(chr(intNum))
+ continue
+ outfile.write(line)
+ outfile.write("\n")
+
+def print_usage(sys_argv):
+ script_name = sys_argv[0]
+ usage_str = "Syntax: {0} toolchain core test\n".format(sys.argv[0])
+ argument_desc = "\n toolchain: {0}".format(" ".join(toolchain_list))
+ argument_desc += "\n core: {0}".format(" ".join(core_list))
+ argument_desc += "\n test: {0}".format(" ".join(test_list))
+ argument_desc += "\n\ne.g.: parseLog ARM cortexM3l FVP"
+
+ print usage_str + argument_desc
+
+def exit_on_error(sys_argv):
+ print_usage(sys_argv)
+ exit(1)
+
+if __name__ == '__main__':
+ arg_len = len(sys.argv)
+
+ if arg_len != 4:
+ exit_on_error(sys.argv)
+
+ if error == parseLog(sys.argv[1], sys.argv[2], sys.argv[3]):
+ exit_on_error(sys.argv)