summaryrefslogtreecommitdiff
path: root/xen/scripts/xen_analysis
Commit message (Collapse)AuthorAgeFilesLines
* cppcheck: globally suppress unusedStructMemberLuca Fancellu2023-03-061-0/+3
| | | | | | | | | unusedStructMember warnings from cppcheck are not reliable and are causing a lot of false positives, suppress the checker globally for now. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
* cppcheck: add a way to exclude files from the scanLuca Fancellu2023-03-062-2/+88
| | | | | | | | | | | | | | | | | | | | | Add a way to exclude files from the scan, in this way we can skip some findings from the report on those files that Xen doesn't own. To do that, introduce the exclude-list.json file under docs/misra, this file will be populated with relative path to the files/folder to be excluded. Introduce a new module, exclusion_file_list.py, to deal with the exclusion list file and use the new module in cppcheck_analysis.py to take a list of excluded paths to update the suppression list of cppcheck. Modified --suppress flag for cppcheck tool to remove unmatchedSuppression findings for those external file that are listed but for example not built for the current architecture. Add documentation for the file. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
* xen/cppcheck: add parameter to skip given MISRA rulesLuca Fancellu2023-02-022-16/+27
| | | | | | | | | | | | | | | | | Add parameter to skip the passed MISRA rules during the cppcheck analysis, the rules are specified as a list of comma separated rules with the MISRA number notation (e.g. 1.1,1.3,...). Modify convert_misra_doc.py script to take an extra parameter giving a list of MISRA rule to be skipped, comma separated. While there, fix some typos in the help and print functions. Modify settings.py and cppcheck_analysis.py to have a new parameter (--cppcheck-skip-rules) used to specify a list of MISRA rule to be skipped during the cppcheck analysis. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
* xen/cppcheck: sort alphabetically cppcheck report entriesLuca Fancellu2023-02-021-0/+8
| | | | | | | | | | | | | | | Sort alphabetically cppcheck report entries when producing the text report, this will help comparing different reports and will group together findings from the same file. The sort operation is performed with two criteria, the first one is sorting by misra rule, the second one is sorting by file. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> [stefano: add black line for code style] Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
* xen/scripts: add cppcheck tool to the xen-analysis.py scriptLuca Fancellu2022-12-124-19/+481
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Cppcheck analysis to the xen-analysis.py script using the arguments --run-cppcheck. Now cppcheck analysis will build Xen while the analysis is performed on the source files, it will produce a text report and an additional html output when the script is called with --cppcheck-html. With this patch cppcheck will benefit of platform configuration files that will help it to understand the target of the compilation and improve the analysis. These are XML files placed in xen/tools/cppcheck-plat/, describing to cppcheck the length of basic types to help it in the analysis. To do so: - Update xen-analysis.py with the code to integrate cppcheck. - add platform configuration files for cppcheck.. - add cppcheck-cc.sh script that is a wrapper for cppcheck and it's used as Xen compiler, it will intercept all flags given from the make build system and it will execute cppcheck on the compiled file together with the file compilation. - guarded hypercall-defs.c with CPPCHECK define because cppcheck gets confused as the file does not contain c code. - add false-positive-cppcheck.json file - update documentation. - update .gitignore Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Tested-by: Stefano Stabellini <sstabellini@kernel.org>
* xen/scripts: add xen-analysis.py for coverity and eclair analysisLuca Fancellu2022-12-125-0/+363
Add new script for coverity/eclair analysis tool that will enable the procedure to suppress findings when these tool are used. The procedure is documented in docs/misra/documenting-violations.rst and the script is documented in docs/misra/xen-static-analysis.rst. Add in docs/misra/ the files safe.json and false-positive-{coverity,eclair}.json that are JSON files containing the data structures for the justifications, they are used by the analysis script to link the Xen tags to the proprietary tool comment. Add docs/misra/documenting-violations.rst to explain how to add justifications. Add docs/misra/xen-static-analysis.rst to explain how to use the script to analyse Xen. Add analysis artifacts files to .gitignore. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Tested-by: Stefano Stabellini <sstabellini@kernel.org>