[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/misra: xen-analysis.py: fix return error on PhaseExceptions
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Wed, 26 Apr 2023 14:37:12 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VpklSiqmCRDey2bBIC0y66olfvI4v9WoIdqkHYIUQW4=; b=KAS1UR3m8ZZCakVf6JmF1oSbnftwEo6jNtFxFqVysVvgH357zIX8TQrH+GORuir9gCuZwgotOufFGU8h7Qc4zUci6Y/6SEmTTi4sYPyjzK3uuJIxseAwLNgNEFwZjwrkjF1puiCUO7foZ7MEj1aUF0Eh1xcpDRxwD1HMzGBPzy8XNQFwq4k21f96dz5aVF/898gdCAy1HLiNDM7Ug8CRQqGrFGggQcOYUg85qeIlkOGvTKYXrTH9qUkSL1rsmId2UWdlsOcbopPM8LohrJxA+0L5onqzBANkVRfqCnjUqgtPw6tNNMilbNcyRSqebZpn0dhYBIltsXsTo8xlQRqOuQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bdkVgVykaG9bawPESTtfodSSSEg4ROHhkmm7KTPeol8uTICYJ4/Xm4kD19tXs8F9vsqih0P4EYXV8niaxsU9gHULjvW95vkLy8z+ehAxmhMfPhY8Yg8oLKM7nh0N/Hw/1hjedIXacwy/uRqfPjZ74fwkxUnK+wau4qtjPePZmqqJtNOzCily39aNDsI6bMTHj0CTVNNofeG8TIecRxlrhAF7teptPftMS0I6zG2LglstYkAOuPH+b/Qeays/GDNU8/Zxxvc+ruAC3SBAo4omUccx4Z5xN24PkMKejl056+v6SCHQDf40Z/dZntdj1PcFyhKVbI6UOx5L4/i4vdp5jA==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Wed, 26 Apr 2023 14:37:44 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHZeCxqGE3P3XkfFUu99Ot710R/Aa89oOqAgAAH2wA=
- Thread-topic: [PATCH] xen/misra: xen-analysis.py: fix return error on PhaseExceptions
> On 26 Apr 2023, at 15:08, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
>
> On 26/04/2023 11:46 am, Luca Fancellu wrote:
>> 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>
>> ---
>> 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 8e50c27cd898..7185c5a06d2c 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 = e.errorcode if hasattr(e, "errorcode") else 1
>
> ret_code = getattr(e, "errorcode", 1)
>
> is rather more succinct, and pythonic.
Yes it looks better, I’ll update the patch
>
> ~Andrew
|