[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] CI: Fix cppcheck parallel build more



commit e27436fba7f52ddc00c33e569ef91a07da433067
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Oct 31 16:14:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Oct 31 17:25:40 2024 +0000

    CI: Fix cppcheck parallel build more
    
    A recent cppcheck run was found to fail:
    
      https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/8237167472
    
    with:
    
      "type mismatch! call is<type>() before get<type>()" && is<std::string>()
      make[3]: *** [arch/x86/boot/Makefile:28: 
arch/x86/boot/reloc-trampoline.32.o] Error 1
    
    This turns out to be a parallel build issue, combined with a recent change 
to
    x86.  Notably, we now have a case where we build both:
    
      CC      arch/x86/boot/reloc-trampoline.32.o
      CC      arch/x86/boot/reloc-trampoline.o
    
    from the same original C file, and cppcheck uses the source C file as the 
key
    for generating it's intermediate files.
    
    Switch cppcheck to use the object file as the unique key instead.
    
    Fixes: 45bfff651173 ("xen/misra: xen-analysis.py: fix parallel analysis 
Cppcheck errors")
    Fixes: db8acf31f96b ("x86/boot: Reuse code to relocate trampoline")
    Suggested-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
 xen/tools/cppcheck-cc.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/tools/cppcheck-cc.sh b/xen/tools/cppcheck-cc.sh
index 16a965edb7..8a58c3aa86 100755
--- a/xen/tools/cppcheck-cc.sh
+++ b/xen/tools/cppcheck-cc.sh
@@ -26,6 +26,7 @@ EOF
 
 BUILD_DIR=""
 CC_FILE=""
+OBJ_FILE=""
 COMPILER=""
 CPPCHECK_HTML="n"
 CPPCHECK_PLAT_PATH=""
@@ -56,6 +57,7 @@ do
         then
             # This must be the path to the obj file, turn off flag and save 
path
             OBJTREE_PATH="$(dirname "${OPTION}")"
+            OBJ_FILE="$(basename "${OPTION}")"
             obj_arg_content="n"
         fi
         # Forward any argument to the compiler
@@ -177,12 +179,12 @@ then
     done
     if [ "${IGNORE_PATH}" = "n" ]
     then
-        JDB_FILE="${OBJTREE_PATH}/$(basename "${CC_FILE}".json)"
+        JDB_FILE="${OBJTREE_PATH}/${OBJ_FILE}.json"
 
         # Prepare the Json Compilation Database for the file
         create_jcd "${COMPILER} ${FORWARD_FLAGS}"
 
-        out_file="${OBJTREE_PATH}/$(basename "${CC_FILE%.c}".cppcheck.txt)"
+        out_file="${OBJTREE_PATH}/${OBJ_FILE}.cppcheck.txt"
 
         # Select the right target platform, ARCH is generated from Xen Makefile
         case ${ARCH} in
@@ -211,7 +213,7 @@ then
         fi
 
         # Generate build directory for the analysed file
-        cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}"
+        cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}/${OBJ_FILE}"
         mkdir -p "${cppcheck_build_dir}"
 
         # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS, but
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.