Fix and improvements to xen-analysis.py
cover Fix and improvements to xen-analysis.py
This serie includes a fix for a limitation of xen-analysis.py that when using cppcheck and make parallel build, it was spuriously failing.
The second patch is enabling the tool to accept cppcheck version above 2.7 (excluding 2.8 for the reasons described in the documentation).
The final one is a fix for the generated cppcheck text report to include the relative path from the repository, instead that the relative path from the /xen/xen directory.
Luca Fancellu (3):
xen/misra: xen-analysis.py: fix parallel analysis Cppcheck errors xen/misra: xen-analysis.py: allow cppcheck version above 2.7 xen/misra: xen-analysis.py: use the relative path from the ...
xen/scripts/xen_analysis/cppcheck_analysis.py | 36 ++++++++++++------- xen/tools/cppcheck-cc.sh | 19 +++++++++- 2 files changed, 41 insertions(+), 14 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 xen/misra: xen-analysis.py: fix parallel analysis Cppcheck errors
Currently Cppcheck has a limitation that prevents to use make with parallel build and have a parallel Cppcheck invocation on each translation unit (the .c files), because of spurious internal errors.
The issue comes from the fact that when using the build directory, Cppcheck saves temporary files as <filename>.c.<many-extensions>, but this doesn't work well when files with the same name are being analysed at the same time, leading to race conditions.
Fix the issue creating, under the build directory, the same directory structure of the file being analysed to avoid any clash.
--- xen/scripts/xen_analysis/cppcheck_analysis.py | 8 +++----- xen/tools/cppcheck-cc.sh | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-)
xen/scripts/xen_analysis/cppcheck_analysis.py +3 -5
@@ -139,7 +139,6 @@ def generate_cppcheck_deps(): # Compiler defines are in compiler-def.h which is included in config.h # cppcheck_flags=""" ---cppcheck-build-dir={}/{} --max-ctu-depth=10 --enable=style,information,missingInclude --template=\'{{file}}({{line}},{{column}}):{{id}}:{{severity}}:{{message}}\'
@@ -150,8 +149,7 @@ def generate_cppcheck_deps(): --suppress='unusedStructMember:*' --include={}/include/xen/config.h -DCPPCHECK -""".format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir, - settings.outdir, settings.xen_dir) +""".format(settings.xen_dir, settings.outdir, settings.xen_dir) invoke_cppcheck = utils.invoke_command( "{} --version".format(settings.cppcheck_binpath),
@@ -204,9 +202,9 @@ def generate_cppcheck_deps(): cppcheck_cc_flags = """--compiler={} --cppcheck-cmd={} {} --cppcheck-plat={}/cppcheck-plat --ignore-path=tools/ - --ignore-path=arch/x86/efi/check.c + --ignore-path=arch/x86/efi/check.c --build-dir={}/{} """.format(xen_cc, settings.cppcheck_binpath, cppcheck_flags, - settings.tools_dir) + settings.tools_dir, settings.outdir, CPPCHECK_BUILD_DIR) if settings.cppcheck_html: cppcheck_cc_flags = cppcheck_cc_flags + " --cppcheck-html"
xen/tools/cppcheck-cc.sh +18 -1
@@ -24,6 +24,7 @@ Options: EOF } +BUILD_DIR="" CC_FILE="" COMPILER="" CPPCHECK_HTML="n"
@@ -66,6 +67,10 @@ do help exit 0 ;; + --build-dir=*) + BUILD_DIR="${OPTION#*=}" + sm_tool_args="n" + ;; --compiler=*) COMPILER="${OPTION#*=}" sm_tool_args="n"
@@ -107,6 +112,12 @@ then exit 1 fi +if [ "${BUILD_DIR}" = "" ] +then + echo "--build-dir arg is mandatory." + exit 1 +fi + function create_jcd() { local line="${1}" local arg_num=0
@@ -199,13 +210,18 @@ then exit 1 fi + # Generate build directory for the analysed file + cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}" + mkdir -p "${cppcheck_build_dir}" + # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS, but # they can't be used here # shellcheck disable=SC2086 ${CPPCHECK_TOOL} ${CPPCHECK_TOOL_ARGS} \ --project="${JDB_FILE}" \ --output-file="${out_file}" \ - --platform="${platform}" + --platform="${platform}" \ + --cppcheck-build-dir=${cppcheck_build_dir} if [ "${CPPCHECK_HTML}" = "y" ] then
@@ -216,6 +232,7 @@ then --project="${JDB_FILE}" \ --output-file="${out_file%.txt}.xml" \ --platform="${platform}" \ + --cppcheck-build-dir=${cppcheck_build_dir} \ -q \ --xml fi
Signature · 1 line
2.34.1
Re: [PATCH 1/3] xen/misra: xen-analysis.py: fix parallel analysis Cppcheck errors
Quoted 9 lines · Luca Fancellu
Currently Cppcheck has a limitation that prevents to use make with parallel build and have a parallel Cppcheck invocation on each translation unit (the .c files), because of spurious internal errors.
The issue comes from the fact that when using the build directory, Cppcheck saves temporary files as <filename>.c.<many-extensions>, but this doesn't work well when files with the same name are being analysed at the same time, leading to race conditions.
Quoted 5 lines
Fix the issue creating, under the build directory, the same directory structure of the file being analysed to avoid any clash.
Fixes 02b26c02c7c4 ("xen/scripts: add cppcheck tool to the xen-analysis.py script")Signed-off-by Luca Fancellu <[email protected]>
Quoted 106 lines
--- xen/scripts/xen_analysis/cppcheck_analysis.py | 8 +++----- xen/tools/cppcheck-cc.sh | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-)xen/scripts/xen_analysis/cppcheck_analysis.py +3
-5@@ -139,7 +139,6 @@ def generate_cppcheck_deps(): # Compiler defines are in compiler-def.h which is included in config.h # cppcheck_flags=""" ---cppcheck-build-dir={}/{} --max-ctu-depth=10 --enable=style,information,missingInclude --template=\'{{file}}({{line}},{{column}}):{{id}}:{{severity}}:{{message}}\'@@ -150,8 +149,7 @@ def generate_cppcheck_deps(): --suppress='unusedStructMember:*' --include={}/include/xen/config.h -DCPPCHECK -""".format(settings.outdir, CPPCHECK_BUILD_DIR, settings.xen_dir, - settings.outdir, settings.xen_dir) +""".format(settings.xen_dir, settings.outdir, settings.xen_dir) invoke_cppcheck = utils.invoke_command( "{} --version".format(settings.cppcheck_binpath),@@ -204,9 +202,9 @@ def generate_cppcheck_deps(): cppcheck_cc_flags = """--compiler={} --cppcheck-cmd={} {} --cppcheck-plat={}/cppcheck-plat --ignore-path=tools/ - --ignore-path=arch/x86/efi/check.c + --ignore-path=arch/x86/efi/check.c --build-dir={}/{} """.format(xen_cc, settings.cppcheck_binpath, cppcheck_flags, - settings.tools_dir) + settings.tools_dir, settings.outdir, CPPCHECK_BUILD_DIR) if settings.cppcheck_html: cppcheck_cc_flags = cppcheck_cc_flags + " --cppcheck-html"xen/tools/cppcheck-cc.sh +18
-1@@ -24,6 +24,7 @@ Options: EOF } +BUILD_DIR="" CC_FILE="" COMPILER="" CPPCHECK_HTML="n"@@ -66,6 +67,10 @@ do help exit 0 ;; + --build-dir=*) + BUILD_DIR="${OPTION#*=}" + sm_tool_args="n" + ;; --compiler=*) COMPILER="${OPTION#*=}" sm_tool_args="n"@@ -107,6 +112,12 @@ then exit 1 fi +if [ "${BUILD_DIR}" = "" ] +then + echo "--build-dir arg is mandatory." + exit 1 +fi + function create_jcd() { local line="${1}" local arg_num=0@@ -199,13 +210,18 @@ then exit 1 fi + # Generate build directory for the analysed file + cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}" + mkdir -p "${cppcheck_build_dir}" + # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS, but # they can't be used here # shellcheck disable=SC2086 ${CPPCHECK_TOOL} ${CPPCHECK_TOOL_ARGS} \ --project="${JDB_FILE}" \ --output-file="${out_file}" \ - --platform="${platform}" + --platform="${platform}" \ + --cppcheck-build-dir=${cppcheck_build_dir} if [ "${CPPCHECK_HTML}" = "y" ] then@@ -216,6 +232,7 @@ then --project="${JDB_FILE}" \ --output-file="${out_file%.txt}.xml" \ --platform="${platform}" \ + --cppcheck-build-dir=${cppcheck_build_dir} \ -q \ --xml fiSignature · 1 line
2.34.1
PATCH 2/3 xen/misra: xen-analysis.py: allow cppcheck version above 2.7
In reply to Luca FancelluAllow the use of Cppcheck version above 2.7, exception for 2.8 which is known and documented do be broken.
--- xen/scripts/xen_analysis/cppcheck_analysis.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
xen/scripts/xen_analysis/cppcheck_analysis.py +16 -4
@@ -157,13 +157,25 @@ def generate_cppcheck_deps(): "Error occured retrieving cppcheck version:\n{}\n\n{}" ) - version_regex = re.search('^Cppcheck (.*)$', invoke_cppcheck, flags=re.M) + version_regex = re.search('^Cppcheck (\d+).(\d+)(?:.\d+)?$', + invoke_cppcheck, flags=re.M) # Currently, only cppcheck version >= 2.7 is supported, but version 2.8 is # known to be broken, please refer to docs/misra/cppcheck.txt - if (not version_regex) or (not version_regex.group(1).startswith("2.7")): + if (not version_regex) or len(version_regex.groups()) < 2: raise CppcheckDepsPhaseError( - "Can't find cppcheck version or version is not 2.7" - ) + "Can't find cppcheck version or version not identified: " + "{}".format(invoke_cppcheck) + ) + major = int(version_regex.group(1)) + minor = int(version_regex.group(2)) + if major < 2 or (major == 2 and minor < 7): + raise CppcheckDepsPhaseError( + "Cppcheck version < 2.7 is not supported" + ) + if major == 2 and minor == 8: + raise CppcheckDepsPhaseError( + "Cppcheck version 2.8 is known to be broken, see the documentation" + ) # If misra option is selected, append misra addon and generate cppcheck # files for misra analysis
Signature · 1 line
2.34.1
Re: [PATCH 2/3] xen/misra: xen-analysis.py: allow cppcheck version above 2.7
Quoted 29 lines · Luca Fancellu
Allow the use of Cppcheck version above 2.7, exception for 2.8 which is known and documented do be broken.
Signed-off-by Luca Fancellu <[email protected]>--- xen/scripts/xen_analysis/cppcheck_analysis.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)xen/scripts/xen_analysis/cppcheck_analysis.py +6
-4@@ -157,13 +157,25 @@ def generate_cppcheck_deps(): "Error occured retrieving cppcheck version:\n{}\n\n{}" ) - version_regex = re.search('^Cppcheck (.*)$', invoke_cppcheck, flags=re.M) + version_regex = re.search('^Cppcheck (\d+).(\d+)(?:.\d+)?$', + invoke_cppcheck, flags=re.M) # Currently, only cppcheck version >= 2.7 is supported, but version 2.8 is # known to be broken, please refer to docs/misra/cppcheck.txt - if (not version_regex) or (not version_regex.group(1).startswith("2.7")): + if (not version_regex) or len(version_regex.groups()) < 2: raise CppcheckDepsPhaseError( - "Can't find cppcheck version or version is not 2.7" - ) + "Can't find cppcheck version or version not identified: " + "{}".format(invoke_cppcheck) + )
xen/scripts/xen_analysis/cppcheck_analysis.py def generate_cppcheck_deps(): · line 178
Quoted 10 lines
xen/scripts/xen_analysis/cppcheck_analysis.py +10
-0+ major = int(version_regex.group(1)) + minor = int(version_regex.group(2)) + if major < 2 or (major == 2 and minor < 7): + raise CppcheckDepsPhaseError( + "Cppcheck version < 2.7 is not supported" + ) + if major == 2 and minor == 8: + raise CppcheckDepsPhaseError( + "Cppcheck version 2.8 is known to be broken, see the documentation" + )
Python sorts tuples the helpful way around, so for example
v = (2, 9)
if v < (2, 7) or v == (2, 8):
# handle error
does what you want, and far more concisely.
~Andrew
Re: [PATCH 2/3] xen/misra: xen-analysis.py: allow cppcheck version above 2.7
Quoted 47 lines · Andrew Cooper
Quoted 29 lines · Luca Fancellu
Allow the use of Cppcheck version above 2.7, exception for 2.8 which is known and documented do be broken.
Signed-off-by Luca Fancellu <[email protected]>---
xen/scripts/xen_analysis/cppcheck_analysis.py| 20 +++++++++++++++----1 file changed, 16 insertions(+), 4 deletions(-)xen/scripts/xen_analysis/cppcheck_analysis.py +6
-4@@ -157,13 +157,25 @@ def generate_cppcheck_deps(): "Error occured retrieving cppcheck version:\n{}\n\n{}" ) - version_regex = re.search('^Cppcheck (.*)$', invoke_cppcheck, flags=re.M) + version_regex = re.search('^Cppcheck (\d+).(\d+)(?:.\d+)?$', + invoke_cppcheck, flags=re.M) # Currently, only cppcheck version >= 2.7 is supported, but version 2.8 is # known to be broken, please refer to docs/misra/cppcheck.txt - if (not version_regex) or (not version_regex.group(1).startswith("2.7")): + if (not version_regex) or len(version_regex.groups()) < 2: raise CppcheckDepsPhaseError( - "Can't find cppcheck version or version is not 2.7" - ) + "Can't find cppcheck version or version not identified: " + "{}".format(invoke_cppcheck) + )xen/scripts/xen_analysis/cppcheck_analysis.py def generate_cppcheck_deps(): · line 178
Quoted 10 lines
xen/scripts/xen_analysis/cppcheck_analysis.py +10
-0+ major = int(version_regex.group(1)) + minor = int(version_regex.group(2)) + if major < 2 or (major == 2 and minor < 7): + raise CppcheckDepsPhaseError( + "Cppcheck version < 2.7 is not supported" + ) + if major == 2 and minor == 8: + raise CppcheckDepsPhaseError( + "Cppcheck version 2.8 is known to be broken, see the documentation" + )Python sorts tuples the helpful way around, so for example
Quoted 6 lines
v = (2, 9)
if v < (2, 7) or v == (2, 8):
# handle errordoes what you want, and far more concisely.
Hi Andrew,
Thank you, this is very helpful, it’s clear that I’m at my first experiences with Python, I will change the code to use this more coincise form.
Cheers,
Luca
Quoted 2 lines
~Andrew
Re: [PATCH 2/3] xen/misra: xen-analysis.py: allow cppcheck version above 2.7
In reply to Luca FancelluQuoted 4 lines · Luca Fancellu
Allow the use of Cppcheck version above 2.7, exception for 2.8 which is known and documented do be broken.
Signed-off-by Luca Fancellu <[email protected]>
Quoted 41 lines
--- xen/scripts/xen_analysis/cppcheck_analysis.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)xen/scripts/xen_analysis/cppcheck_analysis.py +16
-4@@ -157,13 +157,25 @@ def generate_cppcheck_deps(): "Error occured retrieving cppcheck version:\n{}\n\n{}" ) - version_regex = re.search('^Cppcheck (.*)$', invoke_cppcheck, flags=re.M) + version_regex = re.search('^Cppcheck (\d+).(\d+)(?:.\d+)?$', + invoke_cppcheck, flags=re.M) # Currently, only cppcheck version >= 2.7 is supported, but version 2.8 is # known to be broken, please refer to docs/misra/cppcheck.txt - if (not version_regex) or (not version_regex.group(1).startswith("2.7")): + if (not version_regex) or len(version_regex.groups()) < 2: raise CppcheckDepsPhaseError( - "Can't find cppcheck version or version is not 2.7" - ) + "Can't find cppcheck version or version not identified: " + "{}".format(invoke_cppcheck) + ) + major = int(version_regex.group(1)) + minor = int(version_regex.group(2)) + if major < 2 or (major == 2 and minor < 7): + raise CppcheckDepsPhaseError( + "Cppcheck version < 2.7 is not supported" + ) + if major == 2 and minor == 8: + raise CppcheckDepsPhaseError( + "Cppcheck version 2.8 is known to be broken, see the documentation" + ) # If misra option is selected, append misra addon and generate cppcheck # files for misra analysisSignature · 1 line
2.34.1
PATCH 3/3 xen/misra: xen-analysis.py: use the relative path from the ...
In reply to Luca Fancellurepository in the reports
Currently the cppcheck report entries shows the relative file path from the /xen folder of the repository instead of the base folder. In order to ease the checks, for example, when looking a git diff output and the report, use the repository folder as base.
--- xen/scripts/xen_analysis/cppcheck_analysis.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
xen/scripts/xen_analysis/cppcheck_analysis.py +5 -5
@@ -149,7 +149,7 @@ def generate_cppcheck_deps(): --suppress='unusedStructMember:*' --include={}/include/xen/config.h -DCPPCHECK -""".format(settings.xen_dir, settings.outdir, settings.xen_dir) +""".format(settings.repo_dir, settings.outdir, settings.xen_dir) invoke_cppcheck = utils.invoke_command( "{} --version".format(settings.cppcheck_binpath),
@@ -240,7 +240,7 @@ def generate_cppcheck_report(): try: cppcheck_report_utils.cppcheck_merge_txt_fragments(fragments, report_filename, - [settings.xen_dir]) + [settings.repo_dir]) except cppcheck_report_utils.CppcheckTXTReportError as e: raise CppcheckReportPhaseError(e)
@@ -257,7 +257,7 @@ def generate_cppcheck_report(): try: cppcheck_report_utils.cppcheck_merge_xml_fragments(fragments, xml_filename, - settings.xen_dir, + settings.repo_dir, settings.outdir) except cppcheck_report_utils.CppcheckHTMLReportError as e: raise CppcheckReportPhaseError(e)
@@ -265,7 +265,7 @@ def generate_cppcheck_report(): utils.invoke_command( "{} --file={} --source-dir={} --report-dir={}/html --title=Xen" .format(settings.cppcheck_htmlreport_binpath, xml_filename, - settings.xen_dir, html_report_dir), + settings.repo_dir, html_report_dir), False, CppcheckReportPhaseError, "Error occured generating Cppcheck HTML report:\n{}" )
@@ -273,7 +273,7 @@ def generate_cppcheck_report(): html_files = utils.recursive_find_file(html_report_dir, r'.*\.html$') try: cppcheck_report_utils.cppcheck_strip_path_html(html_files, - (settings.xen_dir, + (settings.repo_dir, settings.outdir)) except cppcheck_report_utils.CppcheckHTMLReportError as e: raise CppcheckReportPhaseError(e)
Signature · 1 line
2.34.1
Re: [PATCH 3/3] xen/misra: xen-analysis.py: use the relative path from the ...
Quoted 8 lines · Luca Fancellu
repository in the reports
Currently the cppcheck report entries shows the relative file path from the /xen folder of the repository instead of the base folder. In order to ease the checks, for example, when looking a git diff output and the report, use the repository folder as base.
Signed-off-by Luca Fancellu <[email protected]>
Quoted 56 lines
--- xen/scripts/xen_analysis/cppcheck_analysis.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)xen/scripts/xen_analysis/cppcheck_analysis.py +5
-5@@ -149,7 +149,7 @@ def generate_cppcheck_deps(): --suppress='unusedStructMember:*' --include={}/include/xen/config.h -DCPPCHECK -""".format(settings.xen_dir, settings.outdir, settings.xen_dir) +""".format(settings.repo_dir, settings.outdir, settings.xen_dir) invoke_cppcheck = utils.invoke_command( "{} --version".format(settings.cppcheck_binpath),@@ -240,7 +240,7 @@ def generate_cppcheck_report(): try: cppcheck_report_utils.cppcheck_merge_txt_fragments(fragments, report_filename, - [settings.xen_dir]) + [settings.repo_dir]) except cppcheck_report_utils.CppcheckTXTReportError as e: raise CppcheckReportPhaseError(e)@@ -257,7 +257,7 @@ def generate_cppcheck_report(): try: cppcheck_report_utils.cppcheck_merge_xml_fragments(fragments, xml_filename, - settings.xen_dir, + settings.repo_dir, settings.outdir) except cppcheck_report_utils.CppcheckHTMLReportError as e: raise CppcheckReportPhaseError(e)@@ -265,7 +265,7 @@ def generate_cppcheck_report(): utils.invoke_command( "{} --file={} --source-dir={} --report-dir={}/html --title=Xen" .format(settings.cppcheck_htmlreport_binpath, xml_filename, - settings.xen_dir, html_report_dir), + settings.repo_dir, html_report_dir), False, CppcheckReportPhaseError, "Error occured generating Cppcheck HTML report:\n{}" )@@ -273,7 +273,7 @@ def generate_cppcheck_report(): html_files = utils.recursive_find_file(html_report_dir, r'.*\.html$') try: cppcheck_report_utils.cppcheck_strip_path_html(html_files, - (settings.xen_dir, + (settings.repo_dir, settings.outdir)) except cppcheck_report_utils.CppcheckHTMLReportError as e: raise CppcheckReportPhaseError(e)Signature · 1 line
2.34.1
Re: [PATCH 3/3] xen/misra: xen-analysis.py: use the relative path from the ...
Hi Luca,
Quoted 10 lines · Stefano Stabellini
Quoted 7 lines · Luca Fancellu
repository in the reports
Currently the cppcheck report entries shows the relative file path from the /xen folder of the repository instead of the base folder. In order to ease the checks, for example, when looking a git diff output and the report, use the repository folder as base.
Quoted 4 lines
Quoted 1 line
Signed-off-by Luca Fancellu <[email protected]>Tested-by Stefano Stabellini <[email protected]>
I know this patch is now committed but there is something confusing here. At the moment, in the cppcheck report we have paths relative to xen/ e.g.:
arch/arm/arm64/lib/bitops.c(117,1):...
So after this patch, I would expect to see the path relative to root of repository e.g.:
*xen/*arch/arm/arm64/lib/bitops.c(117,1):...
However, with or without this patch the behavior is the same. Did I misunderstand your patch?
~Michal
Re: [PATCH 3/3] xen/misra: xen-analysis.py: use the relative path from the ...
Quoted 26 lines · Michal Orzel
Hi Luca,
Quoted 10 lines · Stefano Stabellini
Quoted 7 lines · Luca Fancellu
repository in the reports
Currently the cppcheck report entries shows the relative file path from the /xen folder of the repository instead of the base folder. In order to ease the checks, for example, when looking a git diff output and the report, use the repository folder as base.
Quoted 4 lines
Quoted 1 line
Signed-off-by Luca Fancellu <[email protected]>Tested-by Stefano Stabellini <[email protected]>I know this patch is now committed but there is something confusing here. At the moment, in the cppcheck report we have paths relative to xen/ e.g.:
arch/arm/arm64/lib/bitops.c(117,1):...
Quoted 5 lines
So after this patch, I would expect to see the path relative to root of repository e.g.:
*xen/*arch/arm/arm64/lib/bitops.c(117,1):...However, with or without this patch the behavior is the same. Did I misunderstand your patch?
Hi Michal,
Thank you for having spotted this, during my tests I was using Xen-analysis.py so that it calls the makefile with out-of-tree build, I’ve found after your mail that when it calls the makefile with in-tree-build, cppcheck is run from /xen/xen and it causes it to produce relative path from there in the TXT fragments, showing the issue you observed.
I have ready a fix for that and I’ll push that soon.
Quoted 2 lines
~Michal
Re: [PATCH 3/3] xen/misra: xen-analysis.py: use the relative path from the ...
Quoted 32 lines · Luca Fancellu
Quoted 26 lines · Michal Orzel
Hi Luca,
Quoted 10 lines · Stefano Stabellini
Quoted 7 lines · Luca Fancellu
repository in the reports
Currently the cppcheck report entries shows the relative file path from the /xen folder of the repository instead of the base folder. In order to ease the checks, for example, when looking a git diff output and the report, use the repository folder as base.
Quoted 4 lines
Quoted 1 line
Signed-off-by Luca Fancellu <[email protected]>Tested-by Stefano Stabellini <[email protected]>I know this patch is now committed but there is something confusing here. At the moment, in the cppcheck report we have paths relative to xen/ e.g.:
arch/arm/arm64/lib/bitops.c(117,1):...Quoted 5 lines
So after this patch, I would expect to see the path relative to root of repository e.g.:
*xen/*arch/arm/arm64/lib/bitops.c(117,1):...However, with or without this patch the behavior is the same. Did I misunderstand your patch?
Quoted 6 lines
Hi Michal,
Thank you for having spotted this, during my tests I was using
Xen-analysis.pyso that it calls the makefile with out-of-tree build, I’ve found after your mail that when it calls the makefile with in-tree-build, cppcheck is run from /xen/xen and it causes it to produce relative path from there in the TXT fragments, showing the issue you observed.
Ok, the way I test it is the same as in our gitlab CI so this needs to be fixed.
Quoted 2 lines
I have ready a fix for that and I’ll push that soon.
Thanks.
~Michal
Re: [PATCH 3/3] xen/misra: xen-analysis.py: use the relative path from the ...
Quoted 38 lines · Michal Orzel
Quoted 32 lines · Luca Fancellu
Quoted 31 lines · Michal Orzel
Hi Luca,
Quoted 10 lines · Stefano Stabellini
Quoted 7 lines · Luca Fancellu
repository in the reports
Currently the cppcheck report entries shows the relative file path from the /xen folder of the repository instead of the base folder. In order to ease the checks, for example, when looking a git diff output and the report, use the repository folder as base.
Quoted 4 lines
Quoted 1 line
Signed-off-by Luca Fancellu <[email protected]>Tested-by Stefano Stabellini <[email protected]>I know this patch is now committed but there is something confusing here. At the moment, in the cppcheck report we have paths relative to xen/ e.g.:
arch/arm/arm64/lib/bitops.c(117,1):...So after this patch, I would expect to see the path relative to root of repository e.g.:
*xen/*arch/arm/arm64/lib/bitops.c(117,1):...However, with or without this patch the behavior is the same. Did I misunderstand your patch?
Quoted 7 lines
Quoted 6 lines
Hi Michal,
Thank you for having spotted this, during my tests I was using
Xen-analysis.pyso that it calls the makefile with out-of-tree build, I’ve found after your mail that when it calls the makefile with in-tree-build, cppcheck is run from /xen/xen and it causes it to produce relative path from there in the TXT fragments, showing the issue you observed.Ok, the way I test it is the same as in our gitlab CI so this needs to be fixed.
Here it is the fix: https://patchwork.kernel.org/project/xen-devel/patch/[email protected]/
I’ve updated my internal test script to test it on in-tree and out-of-tree makefile invocation. Hope I did not forget anything, apologies for the inconvenience!
Quoted 6 lines
Quoted 3 lines
I have ready a fix for that and I’ll push that soon.
Thanks.
~Michal