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

[xen master] xen/misra: xen-analysis.py: fix return error on PhaseExceptions



commit 09c7179f0a2c66d4d1716cc41c498349bf78811b
Author:     Luca Fancellu <luca.fancellu@xxxxxxx>
AuthorDate: Thu Apr 27 14:25:59 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Apr 27 21:44:44 2023 +0100

    xen/misra: xen-analysis.py: fix return error on PhaseExceptions
    
    Currently the script return code is 0 even if an exception is
    found, because the return code is written only if the exception
    object has the errorcode member.
    
    Fix the issue returning the errorcode member in case it exists,
    otherwise use a generic value different from 0.
    
    Fixes: 02b26c02c7c4 ("xen/scripts: add cppcheck tool to the xen-analysis.py 
script")
    Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/scripts/xen-analysis.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/scripts/xen-analysis.py b/xen/scripts/xen-analysis.py
index 8e50c27cd8..5e8f2910cd 100755
--- a/xen/scripts/xen-analysis.py
+++ b/xen/scripts/xen-analysis.py
@@ -26,8 +26,7 @@ def main(argv):
             cppcheck_analysis.generate_cppcheck_report()
     except PhaseExceptions as e:
         print("ERROR: {}".format(e))
-        if hasattr(e, "errorcode"):
-            ret_code = e.errorcode
+        ret_code = getattr(e, "errorcode", 1)
     finally:
         if settings.step_clean_analysis:
             cppcheck_analysis.clean_analysis_artifacts()
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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